Hex Artifact Content

Artifact 3980f852163c1d168dea86eafa94e43ffada2a50:


0000: 23 21 2f 62 69 6e 2f 62 61 73 68 0a 23 20 53 68  #!/bin/bash.# Sh
0010: 65 6c 6c 20 53 63 72 69 70 74 20 74 6f 20 6d 61  ell Script to ma
0020: 6b 65 20 4d 61 63 20 4f 53 20 58 20 52 65 6c 65  ke Mac OS X Rele
0030: 61 73 65 73 20 6f 66 20 43 41 43 4b 65 79 0a 23  ases of CACKey.#
0040: 20 4b 65 6e 6e 65 74 68 20 56 61 6e 20 41 6c 73   Kenneth Van Als
0050: 74 79 6e 65 0a 23 20 6b 65 6e 6e 65 74 68 2e 6c  tyne.# kenneth.l
0060: 2e 76 61 6e 61 6c 73 74 79 6e 65 40 75 73 61 63  .vanalstyne@usac
0070: 65 2e 61 72 6d 79 2e 6d 69 6c 0a 43 41 43 4b 45  e.army.mil.CACKE
0080: 59 5f 56 45 52 53 49 4f 4e 3d 60 63 61 74 20 63  Y_VERSION=`cat c
0090: 6f 6e 66 69 67 75 72 65 2e 61 63 20 7c 20 67 72  onfigure.ac | gr
00a0: 65 70 20 41 43 5f 49 4e 49 54 20 7c 20 63 75 74  ep AC_INIT | cut
00b0: 20 2d 64 20 22 20 22 20 2d 66 20 32 20 7c 20 73   -d " " -f 2 | s
00c0: 65 64 20 27 73 5f 29 5f 5f 27 60 0a 0a 23 20 43  ed 's_)__'`..# C
00d0: 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 20 77  heck to see if w
00e0: 65 27 72 65 20 62 75 69 6c 64 69 6e 67 20 6f 6e  e're building on
00f0: 20 4d 61 63 20 4f 53 20 58 20 31 30 2e 37 20 22   Mac OS X 10.7 "
0100: 4c 69 6f 6e 22 0a 69 66 20 5b 20 22 60 75 6e 61  Lion".if [ "`una
0110: 6d 65 20 2d 72 20 7c 20 63 75 74 20 2d 64 20 2e  me -r | cut -d .
0120: 20 2d 66 20 31 60 22 20 3d 20 22 31 31 22 20 5d   -f 1`" = "11" ]
0130: 3b 20 74 68 65 6e 0a 09 4c 49 4f 4e 42 55 49 4c  ; then..LIONBUIL
0140: 44 3d 31 0a 66 69 0a 0a 23 20 55 73 61 67 65 20  D=1.fi..# Usage 
0150: 66 75 6e 63 74 69 6f 6e 0a 75 73 61 67 65 28 29  function.usage()
0160: 20 7b 0a 09 65 63 68 6f 20 22 55 73 61 67 65 3a   {..echo "Usage:
0170: 20 62 75 69 6c 64 5f 6f 73 78 2e 73 68 20 3c 74   build_osx.sh <t
0180: 61 72 67 65 74 3e 22 0a 09 65 63 68 6f 20 57 68  arget>"..echo Wh
0190: 65 72 65 20 74 61 72 67 65 74 20 69 73 20 6f 6e  ere target is on
01a0: 65 20 6f 66 3a 0a 09 65 63 68 6f 20 22 20 20 20  e of:..echo "   
01b0: 20 6c 65 6f 70 61 72 64 20 20 2d 20 28 42 75 69   leopard  - (Bui
01c0: 6c 64 73 20 55 6e 69 76 65 72 73 61 6c 20 31 30  lds Universal 10
01d0: 2e 35 20 4c 69 62 72 61 72 79 20 66 6f 72 20 50  .5 Library for P
01e0: 50 43 47 34 2f 69 33 38 36 29 22 0a 09 65 63 68  PCG4/i386)"..ech
01f0: 6f 20 22 20 20 20 20 73 6e 6f 77 6c 65 6f 70 61  o "    snowleopa
0200: 72 64 20 20 2d 20 28 42 75 69 6c 64 73 20 55 6e  rd  - (Builds Un
0210: 69 76 65 72 73 61 6c 20 31 30 2e 36 20 4c 69 62  iversal 10.6 Lib
0220: 72 61 72 79 20 66 6f 72 20 69 33 38 36 2f 78 38  rary for i386/x8
0230: 36 5f 36 34 29 22 0a 09 65 63 68 6f 20 22 20 20  6_64)"..echo "  
0240: 20 20 6c 69 6f 6e 20 20 2d 20 28 42 75 69 6c 64    lion  - (Build
0250: 73 20 55 6e 69 76 65 72 73 61 6c 20 31 30 2e 37  s Universal 10.7
0260: 20 4c 69 62 72 61 72 79 20 66 6f 72 20 69 33 38   Library for i38
0270: 36 2f 78 38 36 5f 36 34 29 22 0a 09 65 63 68 6f  6/x86_64)"..echo
0280: 20 22 20 20 20 20 73 6c 74 6f 6d 6c 20 2d 20 28   "    sltoml - (
0290: 42 75 69 6c 64 73 20 55 6e 69 76 65 72 73 61 6c  Builds Universal
02a0: 20 31 30 2e 36 2f 31 30 2e 37 2f 31 30 2e 38 20   10.6/10.7/10.8 
02b0: 4c 69 62 72 61 72 79 20 66 6f 72 20 69 33 38 36  Library for i386
02c0: 2f 78 38 36 5f 36 34 29 22 0a 09 65 63 68 6f 20  /x86_64)"..echo 
02d0: 22 20 20 20 20 61 6c 6c 20 2d 20 28 42 75 69 6c  "    all - (Buil
02e0: 64 73 20 66 6f 72 20 61 6c 6c 20 73 75 70 70 6f  ds for all suppo
02f0: 72 74 65 64 20 74 61 72 67 65 74 73 29 22 0a 09  rted targets)"..
0300: 65 63 68 6f 20 22 20 20 20 20 63 6c 65 61 6e 20  echo "    clean 
0310: 2d 20 28 43 6c 65 61 6e 73 20 75 70 29 22 0a 09  - (Cleans up)"..
0320: 65 63 68 6f 20 22 52 75 6e 20 66 72 6f 6d 20 43  echo "Run from C
0330: 41 43 4b 65 79 20 42 75 69 6c 64 20 52 6f 6f 74  ACKey Build Root
0340: 2e 22 0a 09 65 78 69 74 20 24 3f 0a 7d 0a 0a 23  ."..exit $?.}..#
0350: 20 43 6c 65 61 6e 20 75 70 20 66 75 6e 63 74 69   Clean up functi
0360: 6f 6e 0a 63 6c 65 61 6e 28 29 20 7b 0a 09 72 6d  on.clean() {..rm
0370: 20 2d 66 20 62 75 69 6c 64 2f 63 61 63 6b 65 79   -f build/cackey
0380: 5f 6f 73 78 5f 62 75 69 6c 64 2f 63 61 63 6b 65  _osx_build/cacke
0390: 79 2e 64 79 6c 69 62 0a 09 72 6d 20 2d 72 66 20  y.dylib..rm -rf 
03a0: 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78  build/cackey_osx
03b0: 5f 62 75 69 6c 64 2f 50 4b 43 53 31 31 2e 74 6f  _build/PKCS11.to
03c0: 6b 65 6e 64 0a 09 72 6d 20 2d 72 66 20 50 4b 43  kend..rm -rf PKC
03d0: 53 31 31 2e 74 6f 6b 65 6e 64 0a 09 72 6d 20 2d  S11.tokend..rm -
03e0: 72 66 20 6d 61 63 62 75 69 6c 64 0a 09 72 6d 20  rf macbuild..rm 
03f0: 2d 72 66 20 62 75 69 6c 64 2f 63 61 63 6b 65 79  -rf build/cackey
0400: 5f 6f 73 78 5f 62 75 69 6c 64 2f 2a 2e 70 6d 64  _osx_build/*.pmd
0410: 6f 63 0a 09 6d 61 6b 65 20 64 69 73 74 63 6c 65  oc..make distcle
0420: 61 6e 0a 7d 0a 0a 23 20 44 69 72 65 63 74 6f 72  an.}..# Director
0430: 79 20 63 72 65 61 74 69 6f 6e 20 66 75 6e 63 74  y creation funct
0440: 69 6f 6e 0a 6d 61 6b 65 64 69 72 28 29 20 7b 0a  ion.makedir() {.
0450: 09 69 66 20 5b 20 22 60 75 6e 61 6d 65 20 2d 72  .if [ "`uname -r
0460: 20 7c 20 63 75 74 20 2d 64 20 2e 20 2d 66 20 31   | cut -d . -f 1
0470: 60 22 20 2d 6c 74 20 22 31 30 22 20 5d 3b 20 74  `" -lt "10" ]; t
0480: 68 65 6e 0a 09 09 4c 49 42 54 4f 4f 4c 44 49 52  hen...LIBTOOLDIR
0490: 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 75 73 72 2f  =/Developer/usr/
04a0: 73 68 61 72 65 2f 6c 69 62 74 6f 6f 6c 0a 09 65  share/libtool..e
04b0: 6c 73 65 0a 09 09 4c 49 42 54 4f 4f 4c 44 49 52  lse...LIBTOOLDIR
04c0: 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 75 73 72 2f  =/Developer/usr/
04d0: 73 68 61 72 65 2f 6c 69 62 74 6f 6f 6c 2f 63 6f  share/libtool/co
04e0: 6e 66 69 67 0a 09 66 69 0a 09 69 66 20 5b 20 21  nfig..fi..if [ !
04f0: 20 2d 64 20 6d 61 63 62 75 69 6c 64 20 5d 3b 20   -d macbuild ]; 
0500: 74 68 65 6e 0a 09 09 6d 6b 64 69 72 20 6d 61 63  then...mkdir mac
0510: 62 75 69 6c 64 0a 09 09 6d 6b 64 69 72 20 6d 61  build...mkdir ma
0520: 63 62 75 69 6c 64 2f 4c 65 6f 70 61 72 64 0a 09  cbuild/Leopard..
0530: 09 6d 6b 64 69 72 20 6d 61 63 62 75 69 6c 64 2f  .mkdir macbuild/
0540: 53 6e 6f 77 6c 65 6f 70 61 72 64 0a 09 09 6d 6b  Snowleopard...mk
0550: 64 69 72 20 6d 61 63 62 75 69 6c 64 2f 4c 69 6f  dir macbuild/Lio
0560: 6e 0a 09 09 6d 6b 64 69 72 20 6d 61 63 62 75 69  n...mkdir macbui
0570: 6c 64 2f 53 6c 74 6f 6d 6c 0a 09 09 6d 6b 64 69  ld/Sltoml...mkdi
0580: 72 20 6d 61 63 62 75 69 6c 64 2f 70 6b 67 0a 09  r macbuild/pkg..
0590: 66 69 0a 09 69 66 20 5b 20 21 20 2d 66 20 63 6f  fi..if [ ! -f co
05a0: 6e 66 69 67 2e 67 75 65 73 73 20 5d 3b 20 74 68  nfig.guess ]; th
05b0: 65 6e 0a 09 09 63 70 20 24 7b 4c 49 42 54 4f 4f  en...cp ${LIBTOO
05c0: 4c 44 49 52 7d 2f 63 6f 6e 66 69 67 2e 67 75 65  LDIR}/config.gue
05d0: 73 73 20 2e 0a 09 66 69 0a 09 69 66 20 5b 20 21  ss ...fi..if [ !
05e0: 20 2d 66 20 63 6f 6e 66 69 67 2e 73 75 62 20 5d   -f config.sub ]
05f0: 3b 20 74 68 65 6e 0a 09 09 63 70 20 24 7b 4c 49  ; then...cp ${LI
0600: 42 54 4f 4f 4c 44 49 52 7d 2f 63 6f 6e 66 69 67  BTOOLDIR}/config
0610: 2e 73 75 62 20 2e 0a 09 66 69 0a 09 69 66 20 5b  .sub ...fi..if [
0620: 20 21 20 2d 66 20 69 6e 73 74 61 6c 6c 2d 73 68   ! -f install-sh
0630: 20 5d 3b 20 74 68 65 6e 0a 09 09 63 70 20 24 7b   ]; then...cp ${
0640: 4c 49 42 54 4f 4f 4c 44 49 52 7d 2f 69 6e 73 74  LIBTOOLDIR}/inst
0650: 61 6c 6c 2d 73 68 20 2e 0a 09 66 69 0a 7d 0a 0a  all-sh ...fi.}..
0660: 23 20 42 75 69 6c 64 20 66 75 6e 63 74 69 6f 6e  # Build function
0670: 20 66 6f 72 20 4c 65 6f 70 61 72 64 0a 6c 65 6f   for Leopard.leo
0680: 70 61 72 64 28 29 20 7b 0a 09 6d 61 6b 65 64 69  pard() {..makedi
0690: 72 0a 09 48 45 41 44 45 52 53 3d 2f 44 65 76 65  r..HEADERS=/Deve
06a0: 6c 6f 70 65 72 2f 53 44 4b 73 2f 4d 61 63 4f 53  loper/SDKs/MacOS
06b0: 58 31 30 2e 35 2e 73 64 6b 2f 53 79 73 74 65 6d  X10.5.sdk/System
06c0: 2f 4c 69 62 72 61 72 79 2f 46 72 61 6d 65 77 6f  /Library/Framewo
06d0: 72 6b 73 2f 50 43 53 43 2e 66 72 61 6d 65 77 6f  rks/PCSC.framewo
06e0: 72 6b 2f 56 65 72 73 69 6f 6e 73 2f 41 2f 48 65  rk/Versions/A/He
06f0: 61 64 65 72 73 2f 0a 09 4c 49 42 52 41 52 59 3d  aders/..LIBRARY=
0700: 2f 44 65 76 65 6c 6f 70 65 72 2f 53 44 4b 73 2f  /Developer/SDKs/
0710: 4d 61 63 4f 53 58 31 30 2e 35 2e 73 64 6b 2f 53  MacOSX10.5.sdk/S
0720: 79 73 74 65 6d 2f 4c 69 62 72 61 72 79 2f 46 72  ystem/Library/Fr
0730: 61 6d 65 77 6f 72 6b 73 2f 50 43 53 43 2e 66 72  ameworks/PCSC.fr
0740: 61 6d 65 77 6f 72 6b 2f 50 43 53 43 0a 09 4c 49  amework/PCSC..LI
0750: 42 3d 22 22 0a 09 41 52 43 48 4c 49 53 54 3d 22  B=""..ARCHLIST="
0760: 22 0a 09 44 4c 49 42 3d 22 22 0a 09 44 41 52 43  "..DLIB=""..DARC
0770: 48 4c 49 53 54 3d 22 22 0a 09 4f 53 58 3d 4c 65  HLIST=""..OSX=Le
0780: 6f 70 61 72 64 0a 09 50 4b 54 41 52 47 45 54 4f  opard..PKTARGETO
0790: 53 3d 33 0a 09 4e 45 58 54 4f 53 58 56 45 52 3d  S=3..NEXTOSXVER=
07a0: 31 30 2e 36 0a 09 43 55 52 4f 53 58 56 45 52 3d  10.6..CUROSXVER=
07b0: 31 30 2e 35 0a 09 66 6f 72 20 48 4f 53 54 20 69  10.5..for HOST i
07c0: 6e 20 70 6f 77 65 72 70 63 2d 61 70 70 6c 65 2d  n powerpc-apple-
07d0: 64 61 72 77 69 6e 39 20 69 33 38 36 2d 61 70 70  darwin9 i386-app
07e0: 6c 65 2d 64 61 72 77 69 6e 39 3b 20 64 6f 0a 09  le-darwin9; do..
07f0: 09 67 65 6e 62 75 69 6c 64 0a 09 64 6f 6e 65 0a  .genbuild..done.
0800: 09 6c 69 62 62 75 69 6c 64 0a 09 70 6b 67 62 75  .libbuild..pkgbu
0810: 69 6c 64 0a 7d 0a 0a 23 20 42 75 69 6c 64 20 66  ild.}..# Build f
0820: 75 6e 63 74 69 6f 6e 20 66 6f 72 20 53 6e 6f 77  unction for Snow
0830: 20 4c 65 6f 70 61 72 64 0a 73 6e 6f 77 6c 65 6f   Leopard.snowleo
0840: 70 61 72 64 28 29 20 7b 0a 09 6d 61 6b 65 64 69  pard() {..makedi
0850: 72 0a 09 48 45 41 44 45 52 53 3d 2f 44 65 76 65  r..HEADERS=/Deve
0860: 6c 6f 70 65 72 2f 53 44 4b 73 2f 4d 61 63 4f 53  loper/SDKs/MacOS
0870: 58 31 30 2e 36 2e 73 64 6b 2f 53 79 73 74 65 6d  X10.6.sdk/System
0880: 2f 4c 69 62 72 61 72 79 2f 46 72 61 6d 65 77 6f  /Library/Framewo
0890: 72 6b 73 2f 50 43 53 43 2e 66 72 61 6d 65 77 6f  rks/PCSC.framewo
08a0: 72 6b 2f 56 65 72 73 69 6f 6e 73 2f 41 2f 48 65  rk/Versions/A/He
08b0: 61 64 65 72 73 2f 0a 09 4c 49 42 52 41 52 59 3d  aders/..LIBRARY=
08c0: 2f 44 65 76 65 6c 6f 70 65 72 2f 53 44 4b 73 2f  /Developer/SDKs/
08d0: 4d 61 63 4f 53 58 31 30 2e 36 2e 73 64 6b 2f 53  MacOSX10.6.sdk/S
08e0: 79 73 74 65 6d 2f 4c 69 62 72 61 72 79 2f 46 72  ystem/Library/Fr
08f0: 61 6d 65 77 6f 72 6b 73 2f 50 43 53 43 2e 66 72  ameworks/PCSC.fr
0900: 61 6d 65 77 6f 72 6b 2f 50 43 53 43 0a 09 4c 49  amework/PCSC..LI
0910: 42 3d 22 22 0a 09 41 52 43 48 4c 49 53 54 3d 22  B=""..ARCHLIST="
0920: 22 0a 09 44 4c 49 42 3d 22 22 0a 09 44 41 52 43  "..DLIB=""..DARC
0930: 48 4c 49 53 54 3d 22 22 0a 09 4f 53 58 3d 53 6e  HLIST=""..OSX=Sn
0940: 6f 77 6c 65 6f 70 61 72 64 0a 09 50 4b 54 41 52  owleopard..PKTAR
0950: 47 45 54 4f 53 3d 33 0a 09 4e 45 58 54 4f 53 58  GETOS=3..NEXTOSX
0960: 56 45 52 3d 31 30 2e 37 0a 09 43 55 52 4f 53 58  VER=10.7..CUROSX
0970: 56 45 52 3d 31 30 2e 36 0a 09 66 6f 72 20 48 4f  VER=10.6..for HO
0980: 53 54 20 69 6e 20 69 33 38 36 2d 61 70 70 6c 65  ST in i386-apple
0990: 2d 64 61 72 77 69 6e 31 30 20 78 38 36 5f 36 34  -darwin10 x86_64
09a0: 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e 31 30 3b  -apple-darwin10;
09b0: 20 64 6f 0a 09 09 67 65 6e 62 75 69 6c 64 0a 09   do...genbuild..
09c0: 64 6f 6e 65 0a 09 6c 69 62 62 75 69 6c 64 0a 09  done..libbuild..
09d0: 70 6b 67 62 75 69 6c 64 0a 7d 0a 0a 23 20 42 75  pkgbuild.}..# Bu
09e0: 69 6c 64 20 66 75 6e 63 74 69 6f 6e 20 66 6f 72  ild function for
09f0: 20 4c 69 6f 6e 0a 6c 69 6f 6e 28 29 20 7b 0a 09   Lion.lion() {..
0a00: 6d 61 6b 65 64 69 72 0a 09 48 45 41 44 45 52 53  makedir..HEADERS
0a10: 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 53 44 4b 73  =/Developer/SDKs
0a20: 2f 4d 61 63 4f 53 58 31 30 2e 37 2e 73 64 6b 2f  /MacOSX10.7.sdk/
0a30: 53 79 73 74 65 6d 2f 4c 69 62 72 61 72 79 2f 46  System/Library/F
0a40: 72 61 6d 65 77 6f 72 6b 73 2f 50 43 53 43 2e 66  rameworks/PCSC.f
0a50: 72 61 6d 65 77 6f 72 6b 2f 56 65 72 73 69 6f 6e  ramework/Version
0a60: 73 2f 41 2f 48 65 61 64 65 72 73 2f 0a 09 4c 49  s/A/Headers/..LI
0a70: 42 52 41 52 59 3d 2f 44 65 76 65 6c 6f 70 65 72  BRARY=/Developer
0a80: 2f 53 44 4b 73 2f 4d 61 63 4f 53 58 31 30 2e 37  /SDKs/MacOSX10.7
0a90: 2e 73 64 6b 2f 53 79 73 74 65 6d 2f 4c 69 62 72  .sdk/System/Libr
0aa0: 61 72 79 2f 46 72 61 6d 65 77 6f 72 6b 73 2f 50  ary/Frameworks/P
0ab0: 43 53 43 2e 66 72 61 6d 65 77 6f 72 6b 2f 50 43  CSC.framework/PC
0ac0: 53 43 0a 09 4c 49 42 3d 22 22 0a 09 41 52 43 48  SC..LIB=""..ARCH
0ad0: 4c 49 53 54 3d 22 22 0a 09 44 4c 49 42 3d 22 22  LIST=""..DLIB=""
0ae0: 0a 09 44 41 52 43 48 4c 49 53 54 3d 22 22 0a 09  ..DARCHLIST=""..
0af0: 4f 53 58 3d 4c 69 6f 6e 0a 09 50 4b 54 41 52 47  OSX=Lion..PKTARG
0b00: 45 54 4f 53 3d 33 0a 09 4e 45 58 54 4f 53 58 56  ETOS=3..NEXTOSXV
0b10: 45 52 3d 31 30 2e 38 0a 09 43 55 52 4f 53 58 56  ER=10.8..CUROSXV
0b20: 45 52 3d 31 30 2e 37 0a 09 66 6f 72 20 48 4f 53  ER=10.7..for HOS
0b30: 54 20 69 6e 20 69 33 38 36 2d 61 70 70 6c 65 2d  T in i386-apple-
0b40: 64 61 72 77 69 6e 31 31 20 78 38 36 5f 36 34 2d  darwin11 x86_64-
0b50: 61 70 70 6c 65 2d 64 61 72 77 69 6e 31 31 3b 20  apple-darwin11; 
0b60: 64 6f 0a 09 09 67 65 6e 62 75 69 6c 64 0a 09 64  do...genbuild..d
0b70: 6f 6e 65 0a 09 6c 69 62 62 75 69 6c 64 0a 09 70  one..libbuild..p
0b80: 6b 67 62 75 69 6c 64 0a 7d 0a 0a 23 20 42 75 69  kgbuild.}..# Bui
0b90: 6c 64 20 66 75 6e 63 74 69 6f 6e 20 66 6f 72 20  ld function for 
0ba0: 53 6e 6f 77 20 4c 65 6f 70 61 72 64 2f 4c 69 6f  Snow Leopard/Lio
0bb0: 6e 2f 4d 6f 75 6e 74 61 69 6e 20 4c 69 6f 6e 0a  n/Mountain Lion.
0bc0: 73 6c 74 6f 6d 6c 28 29 20 7b 0a 09 6d 61 6b 65  sltoml() {..make
0bd0: 64 69 72 0a 09 48 45 41 44 45 52 53 3d 2f 44 65  dir..HEADERS=/De
0be0: 76 65 6c 6f 70 65 72 2f 53 44 4b 73 2f 4d 61 63  veloper/SDKs/Mac
0bf0: 4f 53 58 31 30 2e 36 2e 73 64 6b 2f 53 79 73 74  OSX10.6.sdk/Syst
0c00: 65 6d 2f 4c 69 62 72 61 72 79 2f 46 72 61 6d 65  em/Library/Frame
0c10: 77 6f 72 6b 73 2f 50 43 53 43 2e 66 72 61 6d 65  works/PCSC.frame
0c20: 77 6f 72 6b 2f 56 65 72 73 69 6f 6e 73 2f 41 2f  work/Versions/A/
0c30: 48 65 61 64 65 72 73 2f 0a 09 4c 49 42 52 41 52  Headers/..LIBRAR
0c40: 59 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 53 44 4b  Y=/Developer/SDK
0c50: 73 2f 4d 61 63 4f 53 58 31 30 2e 36 2e 73 64 6b  s/MacOSX10.6.sdk
0c60: 2f 53 79 73 74 65 6d 2f 4c 69 62 72 61 72 79 2f  /System/Library/
0c70: 46 72 61 6d 65 77 6f 72 6b 73 2f 50 43 53 43 2e  Frameworks/PCSC.
0c80: 66 72 61 6d 65 77 6f 72 6b 2f 50 43 53 43 0a 09  framework/PCSC..
0c90: 4c 49 42 3d 22 22 0a 09 41 52 43 48 4c 49 53 54  LIB=""..ARCHLIST
0ca0: 3d 22 22 0a 09 44 4c 49 42 3d 22 22 0a 09 44 41  =""..DLIB=""..DA
0cb0: 52 43 48 4c 49 53 54 3d 22 22 0a 09 4f 53 58 3d  RCHLIST=""..OSX=
0cc0: 53 6c 74 6f 6d 6c 0a 09 50 4b 54 41 52 47 45 54  Sltoml..PKTARGET
0cd0: 4f 53 3d 33 0a 09 4e 45 58 54 4f 53 58 56 45 52  OS=3..NEXTOSXVER
0ce0: 3d 31 30 2e 39 0a 09 43 55 52 4f 53 58 56 45 52  =10.9..CUROSXVER
0cf0: 3d 31 30 2e 36 0a 09 66 6f 72 20 48 4f 53 54 20  =10.6..for HOST 
0d00: 69 6e 20 69 33 38 36 2d 61 70 70 6c 65 2d 64 61  in i386-apple-da
0d10: 72 77 69 6e 31 30 20 78 38 36 5f 36 34 2d 61 70  rwin10 x86_64-ap
0d20: 70 6c 65 2d 64 61 72 77 69 6e 31 30 3b 20 64 6f  ple-darwin10; do
0d30: 0a 09 09 67 65 6e 62 75 69 6c 64 0a 09 64 6f 6e  ...genbuild..don
0d40: 65 0a 09 6c 69 62 62 75 69 6c 64 0a 09 70 6b 67  e..libbuild..pkg
0d50: 62 75 69 6c 64 0a 7d 0a 0a 23 20 47 65 6e 65 72  build.}..# Gener
0d60: 69 63 20 62 75 69 6c 64 20 66 75 6e 63 74 69 6f  ic build functio
0d70: 6e 0a 67 65 6e 62 75 69 6c 64 28 29 20 7b 0a 09  n.genbuild() {..
0d80: 6d 61 6b 65 20 64 69 73 74 63 6c 65 61 6e 0a 09  make distclean..
0d90: 41 52 43 48 3d 60 65 63 68 6f 20 24 7b 48 4f 53  ARCH=`echo ${HOS
0da0: 54 7d 20 7c 20 63 75 74 20 2d 64 20 22 2d 22 20  T} | cut -d "-" 
0db0: 2d 66 20 31 60 0a 09 69 66 20 5b 20 24 7b 41 52  -f 1`..if [ ${AR
0dc0: 43 48 7d 20 3d 3d 20 22 70 6f 77 65 72 70 63 22  CH} == "powerpc"
0dd0: 20 5d 3b 20 74 68 65 6e 0a 09 09 69 66 20 5b 20   ]; then...if [ 
0de0: 24 7b 4f 53 58 7d 20 3d 3d 20 22 4c 65 6f 70 61  ${OSX} == "Leopa
0df0: 72 64 22 20 5d 3b 20 74 68 65 6e 0a 09 09 09 41  rd" ]; then....A
0e00: 52 43 48 3d 22 70 70 63 20 2d 6d 63 70 75 3d 47  RCH="ppc -mcpu=G
0e10: 34 22 0a 09 09 65 6c 73 65 0a 09 09 09 41 52 43  4"...else....ARC
0e20: 48 3d 22 70 70 63 20 2d 6d 63 70 75 3d 47 33 22  H="ppc -mcpu=G3"
0e30: 0a 09 09 66 69 0a 09 66 69 0a 09 69 66 20 5b 20  ...fi..fi..if [ 
0e40: 22 24 7b 4c 49 4f 4e 42 55 49 4c 44 7d 22 20 3d  "${LIONBUILD}" =
0e50: 20 31 20 5d 3b 20 74 68 65 6e 0a 09 09 69 66 20   1 ]; then...if 
0e60: 5b 20 22 24 7b 41 52 43 48 7d 22 20 3d 3d 20 22  [ "${ARCH}" == "
0e70: 70 70 63 20 2d 6d 63 70 75 3d 47 34 22 20 5d 3b  ppc -mcpu=G4" ];
0e80: 20 74 68 65 6e 0a 09 09 09 43 43 3d 70 6f 77 65   then....CC=powe
0e90: 72 70 63 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e  rpc-apple-darwin
0ea0: 31 31 2d 67 63 63 2d 34 2e 32 2e 31 20 43 50 50  11-gcc-4.2.1 CPP
0eb0: 3d 70 6f 77 65 72 70 63 2d 61 70 70 6c 65 2d 64  =powerpc-apple-d
0ec0: 61 72 77 69 6e 31 31 2d 63 70 70 2d 34 2e 32 2e  arwin11-cpp-4.2.
0ed0: 31 20 43 46 4c 41 47 53 3d 22 2d 6d 33 32 20 2d  1 CFLAGS="-m32 -
0ee0: 49 2f 44 65 76 65 6c 6f 70 65 72 2f 50 6c 61 74  I/Developer/Plat
0ef0: 66 6f 72 6d 73 2f 69 50 68 6f 6e 65 4f 53 2e 70  forms/iPhoneOS.p
0f00: 6c 61 74 66 6f 72 6d 2f 44 65 76 65 6c 6f 70 65  latform/Develope
0f10: 72 2f 75 73 72 2f 6c 69 62 2f 67 63 63 2f 70 6f  r/usr/lib/gcc/po
0f20: 77 65 72 70 63 2d 61 70 70 6c 65 2d 64 61 72 77  werpc-apple-darw
0f30: 69 6e 31 30 2f 34 2e 32 2e 31 2f 69 6e 63 6c 75  in10/4.2.1/inclu
0f40: 64 65 20 2d 69 73 79 73 72 6f 6f 74 20 2f 44 65  de -isysroot /De
0f50: 76 65 6c 6f 70 65 72 2f 53 44 4b 73 2f 4d 61 63  veloper/SDKs/Mac
0f60: 4f 53 58 31 30 2e 35 2e 73 64 6b 22 20 43 50 50  OSX10.5.sdk" CPP
0f70: 46 4c 41 47 53 3d 22 2d 44 5f 4c 49 42 43 5f 4c  FLAGS="-D_LIBC_L
0f80: 49 4d 49 54 53 5f 48 5f 22 20 2e 2f 63 6f 6e 66  IMITS_H_" ./conf
0f90: 69 67 75 72 65 20 2d 2d 77 69 74 68 2d 70 63 73  igure --with-pcs
0fa0: 63 2d 68 65 61 64 65 72 73 3d 24 7b 48 45 41 44  c-headers=${HEAD
0fb0: 45 52 53 7d 20 2d 2d 77 69 74 68 2d 70 63 73 63  ERS} --with-pcsc
0fc0: 2d 6c 69 62 73 3d 24 7b 4c 49 42 52 41 52 59 7d  -libs=${LIBRARY}
0fd0: 20 2d 2d 68 6f 73 74 3d 24 7b 48 4f 53 54 7d 0a   --host=${HOST}.
0fe0: 09 09 65 6c 73 65 0a 09 09 09 43 46 4c 41 47 53  ..else....CFLAGS
0ff0: 3d 22 2d 61 72 63 68 20 24 7b 41 52 43 48 7d 22  ="-arch ${ARCH}"
1000: 20 2e 2f 63 6f 6e 66 69 67 75 72 65 20 2d 2d 77   ./configure --w
1010: 69 74 68 2d 70 63 73 63 2d 68 65 61 64 65 72 73  ith-pcsc-headers
1020: 3d 24 7b 48 45 41 44 45 52 53 7d 20 2d 2d 77 69  =${HEADERS} --wi
1030: 74 68 2d 70 63 73 63 2d 6c 69 62 73 3d 24 7b 4c  th-pcsc-libs=${L
1040: 49 42 52 41 52 59 7d 20 2d 2d 68 6f 73 74 3d 24  IBRARY} --host=$
1050: 7b 48 4f 53 54 7d 0a 09 09 66 69 0a 09 65 6c 73  {HOST}...fi..els
1060: 65 0a 09 09 43 46 4c 41 47 53 3d 22 2d 61 72 63  e...CFLAGS="-arc
1070: 68 20 24 7b 41 52 43 48 7d 22 20 2e 2f 63 6f 6e  h ${ARCH}" ./con
1080: 66 69 67 75 72 65 20 2d 2d 77 69 74 68 2d 70 63  figure --with-pc
1090: 73 63 2d 68 65 61 64 65 72 73 3d 24 7b 48 45 41  sc-headers=${HEA
10a0: 44 45 52 53 7d 20 2d 2d 77 69 74 68 2d 70 63 73  DERS} --with-pcs
10b0: 63 2d 6c 69 62 73 3d 24 7b 4c 49 42 52 41 52 59  c-libs=${LIBRARY
10c0: 7d 20 2d 2d 68 6f 73 74 3d 24 7b 48 4f 53 54 7d  } --host=${HOST}
10d0: 0a 09 66 69 0a 09 6d 61 6b 65 0a 09 63 70 20 6c  ..fi..make..cp l
10e0: 69 62 63 61 63 6b 65 79 2e 64 79 6c 69 62 20 6d  ibcackey.dylib m
10f0: 61 63 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c  acbuild/${OSX}/l
1100: 69 62 63 61 63 6b 65 79 2e 64 79 6c 69 62 2e 60  ibcackey.dylib.`
1110: 65 63 68 6f 20 24 7b 41 52 43 48 7d 20 7c 20 63  echo ${ARCH} | c
1120: 75 74 20 2d 64 20 27 20 27 20 2d 66 20 31 60 0a  ut -d ' ' -f 1`.
1130: 09 63 70 20 6c 69 62 63 61 63 6b 65 79 5f 67 2e  .cp libcackey_g.
1140: 64 79 6c 69 62 20 6d 61 63 62 75 69 6c 64 2f 24  dylib macbuild/$
1150: 7b 4f 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79 5f  {OSX}/libcackey_
1160: 67 2e 64 79 6c 69 62 2e 60 65 63 68 6f 20 24 7b  g.dylib.`echo ${
1170: 41 52 43 48 7d 20 7c 20 63 75 74 20 2d 64 20 27  ARCH} | cut -d '
1180: 20 27 20 2d 66 20 31 60 20 0a 7d 0a 0a 23 20 4c   ' -f 1` .}..# L
1190: 69 62 72 61 72 79 20 62 75 69 6c 64 20 66 75 6e  ibrary build fun
11a0: 63 74 69 6f 6e 0a 6c 69 62 62 75 69 6c 64 28 29  ction.libbuild()
11b0: 20 7b 0a 09 66 6f 72 20 4c 49 42 20 69 6e 20 6d   {..for LIB in m
11c0: 61 63 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c  acbuild/${OSX}/l
11d0: 69 62 63 61 63 6b 65 79 2e 64 79 6c 69 62 2e 2a  ibcackey.dylib.*
11e0: 3b 20 64 6f 0a 09 09 41 52 43 48 4c 49 53 54 3d  ; do...ARCHLIST=
11f0: 22 24 7b 41 52 43 48 4c 49 53 54 7d 20 60 65 63  "${ARCHLIST} `ec
1200: 68 6f 20 27 2d 61 72 63 68 20 27 60 20 60 65 63  ho '-arch '` `ec
1210: 68 6f 20 24 7b 4c 49 42 7d 20 7c 20 63 75 74 20  ho ${LIB} | cut 
1220: 2d 64 20 2e 20 2d 66 20 33 60 20 60 65 63 68 6f  -d . -f 3` `echo
1230: 20 27 20 27 60 20 60 65 63 68 6f 20 24 7b 4c 49   ' '` `echo ${LI
1240: 42 7d 60 22 0a 09 64 6f 6e 65 0a 09 6c 69 70 6f  B}`"..done..lipo
1250: 20 2d 63 72 65 61 74 65 20 24 7b 41 52 43 48 4c   -create ${ARCHL
1260: 49 53 54 7d 20 2d 6f 75 74 70 75 74 20 6d 61 63  IST} -output mac
1270: 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c 69 62  build/${OSX}/lib
1280: 63 61 63 6b 65 79 2e 64 79 6c 69 62 0a 09 66 6f  cackey.dylib..fo
1290: 72 20 44 4c 49 42 20 69 6e 20 6d 61 63 62 75 69  r DLIB in macbui
12a0: 6c 64 2f 24 7b 4f 53 58 7d 2f 6c 69 62 63 61 63  ld/${OSX}/libcac
12b0: 6b 65 79 5f 67 2e 64 79 6c 69 62 2e 2a 3b 20 64  key_g.dylib.*; d
12c0: 6f 0a 09 09 44 41 52 43 48 4c 49 53 54 3d 22 24  o...DARCHLIST="$
12d0: 7b 44 41 52 43 48 4c 49 53 54 7d 20 60 65 63 68  {DARCHLIST} `ech
12e0: 6f 20 27 2d 61 72 63 68 20 27 60 20 60 65 63 68  o '-arch '` `ech
12f0: 6f 20 24 7b 44 4c 49 42 7d 20 7c 20 63 75 74 20  o ${DLIB} | cut 
1300: 2d 64 20 2e 20 2d 66 20 33 60 20 60 65 63 68 6f  -d . -f 3` `echo
1310: 20 27 20 27 60 20 60 65 63 68 6f 20 24 7b 44 4c   ' '` `echo ${DL
1320: 49 42 7d 60 22 0a 09 64 6f 6e 65 0a 09 6c 69 70  IB}`"..done..lip
1330: 6f 20 2d 63 72 65 61 74 65 20 24 7b 44 41 52 43  o -create ${DARC
1340: 48 4c 49 53 54 7d 20 2d 6f 75 74 70 75 74 20 6d  HLIST} -output m
1350: 61 63 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c  acbuild/${OSX}/l
1360: 69 62 63 61 63 6b 65 79 5f 67 2e 64 79 6c 69 62  ibcackey_g.dylib
1370: 0a 09 72 6d 20 6d 61 63 62 75 69 6c 64 2f 24 7b  ..rm macbuild/${
1380: 4f 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79 2a 2e  OSX}/libcackey*.
1390: 64 79 6c 69 62 2e 2a 0a 7d 0a 0a 23 20 46 75 6e  dylib.*.}..# Fun
13a0: 63 74 69 6f 6e 20 74 6f 20 62 75 69 6c 64 20 4d  ction to build M
13b0: 61 63 20 4f 53 20 58 20 50 61 63 6b 61 67 65 73  ac OS X Packages
13c0: 0a 70 6b 67 62 75 69 6c 64 28 29 20 7b 0a 09 69  .pkgbuild() {..i
13d0: 66 20 5b 20 22 60 75 6e 61 6d 65 20 2d 72 20 7c  f [ "`uname -r |
13e0: 20 63 75 74 20 2d 64 20 2e 20 2d 66 20 31 60 22   cut -d . -f 1`"
13f0: 20 2d 6c 74 20 22 31 30 22 20 5d 3b 20 74 68 65   -lt "10" ]; the
1400: 6e 0a 09 09 4c 49 42 43 41 43 4b 45 59 47 3d 6c  n...LIBCACKEYG=l
1410: 69 62 63 61 63 6b 65 79 67 2e 70 6b 67 0a 09 65  ibcackeyg.pkg..e
1420: 6c 73 65 0a 09 09 4c 49 42 43 41 43 4b 45 59 47  lse...LIBCACKEYG
1430: 3d 6c 69 62 63 61 63 6b 65 79 5f 67 2e 70 6b 67  =libcackey_g.pkg
1440: 0a 09 66 69 0a 09 72 6d 20 2d 66 20 62 75 69 6c  ..fi..rm -f buil
1450: 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69  d/cackey_osx_bui
1460: 6c 64 2f 63 61 63 6b 65 79 2e 64 79 6c 69 62 0a  ld/cackey.dylib.
1470: 09 6c 6e 20 6d 61 63 62 75 69 6c 64 2f 24 7b 4f  .ln macbuild/${O
1480: 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79 2e 64 79  SX}/libcackey.dy
1490: 6c 69 62 20 62 75 69 6c 64 2f 63 61 63 6b 65 79  lib build/cackey
14a0: 5f 6f 73 78 5f 62 75 69 6c 64 2f 63 61 63 6b 65  _osx_build/cacke
14b0: 79 2e 64 79 6c 69 62 0a 09 72 6d 20 2d 72 66 20  y.dylib..rm -rf 
14c0: 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78  build/cackey_osx
14d0: 5f 62 75 69 6c 64 2f 50 4b 43 53 31 31 2e 74 6f  _build/PKCS11.to
14e0: 6b 65 6e 64 0a 09 69 66 20 5b 20 22 24 7b 4c 49  kend..if [ "${LI
14f0: 4f 4e 42 55 49 4c 44 7d 22 20 3d 20 31 20 5d 3b  ONBUILD}" = 1 ];
1500: 20 74 68 65 6e 0a 09 09 54 41 52 3d 67 6e 75 74   then...TAR=gnut
1510: 61 72 0a 09 65 6c 73 65 0a 09 09 54 41 52 3d 74  ar..else...TAR=t
1520: 61 72 0a 09 66 69 0a 09 69 66 20 5b 20 22 24 7b  ar..fi..if [ "${
1530: 4f 53 58 7d 22 20 3d 20 22 4c 65 6f 70 61 72 64  OSX}" = "Leopard
1540: 22 20 5d 3b 20 74 68 65 6e 0a 09 09 63 75 72 6c  " ]; then...curl
1550: 20 68 74 74 70 3a 2f 2f 64 65 76 65 6c 2e 6b 76   http://devel.kv
1560: 61 6e 61 6c 73 2e 6f 72 67 2f 50 4b 43 53 31 31  anals.org/PKCS11
1570: 5f 54 6f 6b 65 6e 64 2f 50 4b 43 53 31 31 5f 74  _Tokend/PKCS11_t
1580: 6f 6b 65 6e 64 2d 6c 61 74 65 73 74 2e 74 61 72  okend-latest.tar
1590: 2e 67 7a 20 7c 20 24 7b 54 41 52 7d 20 2d 2d 73  .gz | ${TAR} --s
15a0: 74 72 69 70 2d 63 6f 6d 70 6f 6e 65 6e 74 73 20  trip-components 
15b0: 33 20 2d 2d 77 69 6c 64 63 61 72 64 73 20 2d 78  3 --wildcards -x
15c0: 20 2d 7a 20 2d 66 20 2d 20 22 50 4b 43 53 31 31   -z -f - "PKCS11
15d0: 5f 74 6f 6b 65 6e 64 2d 2a 2f 70 72 65 62 75 69  _tokend-*/prebui
15e0: 6c 74 2f 6c 65 6f 70 61 72 64 2f 50 4b 43 53 31  lt/leopard/PKCS1
15f0: 31 2e 74 6f 6b 65 6e 64 22 0a 09 09 6d 76 20 50  1.tokend"...mv P
1600: 4b 43 53 31 31 2e 74 6f 6b 65 6e 64 20 62 75 69  KCS11.tokend bui
1610: 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75  ld/cackey_osx_bu
1620: 69 6c 64 2f 50 4b 43 53 31 31 2e 74 6f 6b 65 6e  ild/PKCS11.token
1630: 64 0a 09 65 6c 73 65 0a 09 09 63 75 72 6c 20 68  d..else...curl h
1640: 74 74 70 3a 2f 2f 64 65 76 65 6c 2e 6b 76 61 6e  ttp://devel.kvan
1650: 61 6c 73 2e 6f 72 67 2f 50 4b 43 53 31 31 5f 54  als.org/PKCS11_T
1660: 6f 6b 65 6e 64 2f 50 4b 43 53 31 31 5f 74 6f 6b  okend/PKCS11_tok
1670: 65 6e 64 2d 6c 61 74 65 73 74 2e 74 61 72 2e 67  end-latest.tar.g
1680: 7a 20 7c 20 24 7b 54 41 52 7d 20 2d 2d 73 74 72  z | ${TAR} --str
1690: 69 70 2d 63 6f 6d 70 6f 6e 65 6e 74 73 20 33 20  ip-components 3 
16a0: 2d 2d 77 69 6c 64 63 61 72 64 73 20 2d 78 20 2d  --wildcards -x -
16b0: 7a 20 2d 66 20 2d 20 22 50 4b 43 53 31 31 5f 74  z -f - "PKCS11_t
16c0: 6f 6b 65 6e 64 2d 2a 2f 70 72 65 62 75 69 6c 74  okend-*/prebuilt
16d0: 2f 73 6e 6f 77 6c 65 6f 70 61 72 64 2f 50 4b 43  /snowleopard/PKC
16e0: 53 31 31 2e 74 6f 6b 65 6e 64 22 0a 09 09 6d 76  S11.tokend"...mv
16f0: 20 50 4b 43 53 31 31 2e 74 6f 6b 65 6e 64 20 62   PKCS11.tokend b
1700: 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f  uild/cackey_osx_
1710: 62 75 69 6c 64 2f 50 4b 43 53 31 31 2e 74 6f 6b  build/PKCS11.tok
1720: 65 6e 64 0a 09 66 69 0a 09 66 6f 72 20 50 4d 44  end..fi..for PMD
1730: 4f 43 20 69 6e 20 62 75 69 6c 64 2f 63 61 63 6b  OC in build/cack
1740: 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 54 65 6d  ey_osx_build/Tem
1750: 70 6c 61 74 65 5f 70 6d 62 75 69 6c 64 2f 2a 2e  plate_pmbuild/*.
1760: 69 6e 3b 20 64 6f 0a 09 09 50 4d 44 4f 43 3d 22  in; do...PMDOC="
1770: 60 65 63 68 6f 20 22 24 7b 50 4d 44 4f 43 7d 22  `echo "${PMDOC}"
1780: 20 7c 20 73 65 64 20 27 73 7c 6c 2e 69 6e 7c 6c   | sed 's|l.in|l
1790: 7c 67 27 20 7c 20 73 65 64 20 27 73 7c 62 75 69  |g' | sed 's|bui
17a0: 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75  ld/cackey_osx_bu
17b0: 69 6c 64 2f 54 65 6d 70 6c 61 74 65 5f 70 6d 62  ild/Template_pmb
17c0: 75 69 6c 64 2f 7c 7c 67 27 60 22 0a 09 09 55 55  uild/||g'`"...UU
17d0: 49 44 3d 22 60 70 79 74 68 6f 6e 20 2d 63 20 27  ID="`python -c '
17e0: 69 6d 70 6f 72 74 20 75 75 69 64 3b 20 70 72 69  import uuid; pri
17f0: 6e 74 20 75 75 69 64 2e 75 75 69 64 31 28 29 27  nt uuid.uuid1()'
1800: 20 7c 20 64 64 20 63 6f 6e 76 3d 75 63 61 73 65   | dd conv=ucase
1810: 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 60 22 0a 09   2>/dev/null`"..
1820: 09 6d 6b 64 69 72 20 2d 70 20 62 75 69 6c 64 2f  .mkdir -p build/
1830: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1840: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
1850: 70 6d 64 6f 63 0a 09 09 73 65 64 20 22 73 7c 40  pmdoc...sed "s|@
1860: 40 42 55 49 4c 44 52 4f 4f 54 44 49 52 40 40 7c  @BUILDROOTDIR@@|
1870: 24 28 70 77 64 29 7c 67 22 20 62 75 69 6c 64 2f  $(pwd)|g" build/
1880: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1890: 2f 54 65 6d 70 6c 61 74 65 5f 70 6d 62 75 69 6c  /Template_pmbuil
18a0: 64 2f 24 7b 50 4d 44 4f 43 7d 2e 69 6e 20 3e 20  d/${PMDOC}.in > 
18b0: 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78  build/cackey_osx
18c0: 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d  _build/${OSX}_pm
18d0: 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d  build.pmdoc/${PM
18e0: 44 4f 43 7d 0a 09 09 73 65 64 20 22 73 7c 40 40  DOC}...sed "s|@@
18f0: 4f 53 58 56 45 52 53 49 4f 4e 40 40 7c 24 7b 4f  OSXVERSION@@|${O
1900: 53 58 7d 7c 67 22 20 62 75 69 6c 64 2f 63 61 63  SX}|g" build/cac
1910: 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b  key_osx_build/${
1920: 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64  OSX}_pmbuild.pmd
1930: 6f 63 2f 24 7b 50 4d 44 4f 43 7d 20 3e 20 62 75  oc/${PMDOC} > bu
1940: 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62  ild/cackey_osx_b
1950: 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75  uild/${OSX}_pmbu
1960: 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f  ild.pmdoc/${PMDO
1970: 43 7d 2e 31 0a 09 09 73 65 64 20 22 73 7c 40 40  C}.1...sed "s|@@
1980: 55 55 49 44 40 40 7c 24 7b 55 55 49 44 7d 7c 67  UUID@@|${UUID}|g
1990: 22 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  " build/cackey_o
19a0: 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f  sx_build/${OSX}_
19b0: 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b  pmbuild.pmdoc/${
19c0: 50 4d 44 4f 43 7d 2e 31 20 3e 20 62 75 69 6c 64  PMDOC}.1 > build
19d0: 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c  /cackey_osx_buil
19e0: 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64  d/${OSX}_pmbuild
19f0: 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 0a  .pmdoc/${PMDOC}.
1a00: 09 09 73 65 64 20 22 73 7c 40 40 54 41 52 47 45  ..sed "s|@@TARGE
1a10: 54 4f 53 40 40 7c 24 7b 50 4b 54 41 52 47 45 54  TOS@@|${PKTARGET
1a20: 4f 53 7d 7c 67 22 20 62 75 69 6c 64 2f 63 61 63  OS}|g" build/cac
1a30: 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b  key_osx_build/${
1a40: 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64  OSX}_pmbuild.pmd
1a50: 6f 63 2f 24 7b 50 4d 44 4f 43 7d 20 3e 20 62 75  oc/${PMDOC} > bu
1a60: 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62  ild/cackey_osx_b
1a70: 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75  uild/${OSX}_pmbu
1a80: 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f  ild.pmdoc/${PMDO
1a90: 43 7d 2e 31 0a 09 09 73 65 64 20 22 73 7c 40 40  C}.1...sed "s|@@
1aa0: 4e 45 58 54 4f 53 58 56 45 52 40 40 7c 24 7b 4e  NEXTOSXVER@@|${N
1ab0: 45 58 54 4f 53 58 56 45 52 7d 7c 67 22 20 62 75  EXTOSXVER}|g" bu
1ac0: 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62  ild/cackey_osx_b
1ad0: 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75  uild/${OSX}_pmbu
1ae0: 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f  ild.pmdoc/${PMDO
1af0: 43 7d 2e 31 20 3e 20 62 75 69 6c 64 2f 63 61 63  C}.1 > build/cac
1b00: 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b  key_osx_build/${
1b10: 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64  OSX}_pmbuild.pmd
1b20: 6f 63 2f 24 7b 50 4d 44 4f 43 7d 0a 09 09 73 65  oc/${PMDOC}...se
1b30: 64 20 22 73 7c 40 40 43 55 52 4f 53 58 56 45 52  d "s|@@CUROSXVER
1b40: 40 40 7c 24 7b 43 55 52 4f 53 58 56 45 52 7d 7c  @@|${CUROSXVER}|
1b50: 67 22 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f  g" build/cackey_
1b60: 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d  osx_build/${OSX}
1b70: 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24  _pmbuild.pmdoc/$
1b80: 7b 50 4d 44 4f 43 7d 20 3e 20 62 75 69 6c 64 2f  {PMDOC} > build/
1b90: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1ba0: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
1bb0: 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31  pmdoc/${PMDOC}.1
1bc0: 0a 09 09 73 65 64 20 22 73 7c 40 40 4c 49 42 43  ...sed "s|@@LIBC
1bd0: 41 43 4b 45 59 47 40 40 7c 24 7b 4c 49 42 43 41  ACKEYG@@|${LIBCA
1be0: 43 4b 45 59 47 7d 7c 67 22 20 62 75 69 6c 64 2f  CKEYG}|g" build/
1bf0: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1c00: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
1c10: 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31  pmdoc/${PMDOC}.1
1c20: 20 3e 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f   > build/cackey_
1c30: 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d  osx_build/${OSX}
1c40: 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24  _pmbuild.pmdoc/$
1c50: 7b 50 4d 44 4f 43 7d 0a 09 09 63 70 20 62 75 69  {PMDOC}...cp bui
1c60: 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75  ld/cackey_osx_bu
1c70: 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69  ild/${OSX}_pmbui
1c80: 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43  ld.pmdoc/${PMDOC
1c90: 7d 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  } build/cackey_o
1ca0: 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f  sx_build/${OSX}_
1cb0: 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b  pmbuild.pmdoc/${
1cc0: 50 4d 44 4f 43 7d 2e 31 0a 09 09 6d 76 20 62 75  PMDOC}.1...mv bu
1cd0: 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62  ild/cackey_osx_b
1ce0: 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75  uild/${OSX}_pmbu
1cf0: 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f  ild.pmdoc/${PMDO
1d00: 43 7d 2e 31 20 62 75 69 6c 64 2f 63 61 63 6b 65  C}.1 build/cacke
1d10: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53  y_osx_build/${OS
1d20: 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63  X}_pmbuild.pmdoc
1d30: 2f 24 7b 50 4d 44 4f 43 7d 0a 09 64 6f 6e 65 0a  /${PMDOC}..done.
1d40: 09 45 58 54 3d 70 6b 67 0a 09 69 66 20 5b 20 24  .EXT=pkg..if [ $
1d50: 7b 4f 53 58 7d 20 3d 3d 20 22 53 6e 6f 77 6c 65  {OSX} == "Snowle
1d60: 6f 70 61 72 64 22 20 5d 3b 20 74 68 65 6e 0a 09  opard" ]; then..
1d70: 09 63 61 74 20 62 75 69 6c 64 2f 63 61 63 6b 65  .cat build/cacke
1d80: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53  y_osx_build/${OS
1d90: 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63  X}_pmbuild.pmdoc
1da0: 2f 69 6e 64 65 78 2e 78 6d 6c 20 7c 20 73 65 64  /index.xml | sed
1db0: 20 27 73 7c 66 6f 72 20 4d 61 63 20 4f 53 20 58   's|for Mac OS X
1dc0: 20 53 6e 6f 77 6c 65 6f 70 61 72 64 7c 66 6f 72   Snowleopard|for
1dd0: 20 4d 61 63 20 4f 53 20 58 20 53 6e 6f 77 4c 65   Mac OS X SnowLe
1de0: 6f 70 61 72 64 7c 67 27 20 3e 20 62 75 69 6c 64  opard|g' > build
1df0: 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c  /cackey_osx_buil
1e00: 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64  d/${OSX}_pmbuild
1e10: 2e 70 6d 64 6f 63 2f 69 6e 64 65 78 2e 78 6d 6c  .pmdoc/index.xml
1e20: 2e 6e 65 77 0a 09 09 6d 76 20 62 75 69 6c 64 2f  .new...mv build/
1e30: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1e40: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
1e50: 70 6d 64 6f 63 2f 69 6e 64 65 78 2e 78 6d 6c 2e  pmdoc/index.xml.
1e60: 6e 65 77 20 62 75 69 6c 64 2f 63 61 63 6b 65 79  new build/cackey
1e70: 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58  _osx_build/${OSX
1e80: 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f  }_pmbuild.pmdoc/
1e90: 69 6e 64 65 78 2e 78 6d 6c 0a 09 66 69 0a 09 69  index.xml..fi..i
1ea0: 66 20 5b 20 24 7b 4f 53 58 7d 20 3d 3d 20 22 53  f [ ${OSX} == "S
1eb0: 6c 74 6f 6d 6c 22 20 5d 3b 20 74 68 65 6e 0a 09  ltoml" ]; then..
1ec0: 09 63 61 74 20 62 75 69 6c 64 2f 63 61 63 6b 65  .cat build/cacke
1ed0: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53  y_osx_build/${OS
1ee0: 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63  X}_pmbuild.pmdoc
1ef0: 2f 69 6e 64 65 78 2e 78 6d 6c 20 7c 20 73 65 64  /index.xml | sed
1f00: 20 27 73 7c 66 6f 72 20 4d 61 63 20 4f 53 20 58   's|for Mac OS X
1f10: 20 53 6c 74 6f 6d 6c 7c 66 6f 72 20 4d 61 63 20   Sltoml|for Mac 
1f20: 4f 53 20 58 20 53 4c 74 6f 4d 4c 7c 67 27 20 3e  OS X SLtoML|g' >
1f30: 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73   build/cackey_os
1f40: 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70  x_build/${OSX}_p
1f50: 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 69 6e 64  mbuild.pmdoc/ind
1f60: 65 78 2e 78 6d 6c 2e 6e 65 77 0a 09 09 6d 76 20  ex.xml.new...mv 
1f70: 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78  build/cackey_osx
1f80: 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d  _build/${OSX}_pm
1f90: 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 69 6e 64 65  build.pmdoc/inde
1fa0: 78 2e 78 6d 6c 2e 6e 65 77 20 62 75 69 6c 64 2f  x.xml.new build/
1fb0: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1fc0: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
1fd0: 70 6d 64 6f 63 2f 69 6e 64 65 78 2e 78 6d 6c 0a  pmdoc/index.xml.
1fe0: 09 66 69 0a 09 2f 44 65 76 65 6c 6f 70 65 72 2f  .fi../Developer/
1ff0: 41 70 70 6c 69 63 61 74 69 6f 6e 73 2f 55 74 69  Applications/Uti
2000: 6c 69 74 69 65 73 2f 50 61 63 6b 61 67 65 4d 61  lities/PackageMa
2010: 6b 65 72 2e 61 70 70 2f 43 6f 6e 74 65 6e 74 73  ker.app/Contents
2020: 2f 4d 61 63 4f 53 2f 50 61 63 6b 61 67 65 4d 61  /MacOS/PackageMa
2030: 6b 65 72 20 2d 64 20 62 75 69 6c 64 2f 63 61 63  ker -d build/cac
2040: 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b  key_osx_build/${
2050: 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64  OSX}_pmbuild.pmd
2060: 6f 63 20 2d 6f 20 6d 61 63 62 75 69 6c 64 2f 70  oc -o macbuild/p
2070: 6b 67 2f 43 41 43 4b 65 79 5f 24 7b 43 41 43 4b  kg/CACKey_${CACK
2080: 45 59 5f 56 45 52 53 49 4f 4e 7d 5f 24 7b 4f 53  EY_VERSION}_${OS
2090: 58 7d 2e 24 7b 45 58 54 7d 0a 09 74 61 72 20 2d  X}.${EXT}..tar -
20a0: 2d 63 72 65 61 74 65 20 2d 2d 64 69 72 65 63 74  -create --direct
20b0: 6f 72 79 20 6d 61 63 62 75 69 6c 64 2f 70 6b 67  ory macbuild/pkg
20c0: 2f 20 2d 2d 66 69 6c 65 20 6d 61 63 62 75 69 6c  / --file macbuil
20d0: 64 2f 70 6b 67 2f 43 41 43 4b 65 79 5f 24 7b 43  d/pkg/CACKey_${C
20e0: 41 43 4b 45 59 5f 56 45 52 53 49 4f 4e 7d 5f 24  ACKEY_VERSION}_$
20f0: 7b 4f 53 58 7d 2e 24 7b 45 58 54 7d 2e 74 61 72  {OSX}.${EXT}.tar
2100: 20 43 41 43 4b 65 79 5f 24 7b 43 41 43 4b 45 59   CACKey_${CACKEY
2110: 5f 56 45 52 53 49 4f 4e 7d 5f 24 7b 4f 53 58 7d  _VERSION}_${OSX}
2120: 2e 24 7b 45 58 54 7d 0a 09 67 7a 69 70 20 2d 39  .${EXT}..gzip -9
2130: 20 6d 61 63 62 75 69 6c 64 2f 70 6b 67 2f 43 41   macbuild/pkg/CA
2140: 43 4b 65 79 5f 24 7b 43 41 43 4b 45 59 5f 56 45  CKey_${CACKEY_VE
2150: 52 53 49 4f 4e 7d 5f 24 7b 4f 53 58 7d 2e 24 7b  RSION}_${OSX}.${
2160: 45 58 54 7d 2e 74 61 72 0a 09 72 6d 20 2d 72 66  EXT}.tar..rm -rf
2170: 20 6d 61 63 62 75 69 6c 64 2f 70 6b 67 2f 43 41   macbuild/pkg/CA
2180: 43 4b 65 79 5f 24 7b 43 41 43 4b 45 59 5f 56 45  CKey_${CACKEY_VE
2190: 52 53 49 4f 4e 7d 5f 24 7b 4f 53 58 7d 2e 24 7b  RSION}_${OSX}.${
21a0: 45 58 54 7d 0a 09 72 6d 20 2d 66 20 62 75 69 6c  EXT}..rm -f buil
21b0: 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69  d/cackey_osx_bui
21c0: 6c 64 2f 63 61 63 6b 65 79 2e 64 79 6c 69 62 0a  ld/cackey.dylib.
21d0: 09 72 6d 20 2d 72 66 20 62 75 69 6c 64 2f 63 61  .rm -rf build/ca
21e0: 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 50  ckey_osx_build/P
21f0: 4b 43 53 31 31 2e 74 6f 6b 65 6e 64 0a 09 65 63  KCS11.tokend..ec
2200: 68 6f 20 22 24 7b 4f 53 58 7d 20 62 75 69 6c 64  ho "${OSX} build
2210: 20 63 6f 6d 70 6c 65 74 65 22 0a 7d 0a 0a 23 20   complete".}..# 
2220: 54 61 6b 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e  Take command lin
2230: 65 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20  e arguments and 
2240: 65 78 65 63 75 74 65 0a 63 61 73 65 20 22 24 31  execute.case "$1
2250: 22 20 69 6e 0a 09 22 22 29 0a 09 09 75 73 61 67  " in.."")...usag
2260: 65 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b 0a  e...exit $?..;;.
2270: 0a 09 22 6c 65 6f 70 61 72 64 22 29 0a 09 09 2e  .."leopard")....
2280: 2f 61 75 74 6f 67 65 6e 2e 73 68 0a 09 09 6c 65  /autogen.sh...le
2290: 6f 70 61 72 64 0a 09 09 65 78 69 74 20 24 3f 0a  opard...exit $?.
22a0: 09 3b 3b 0a 0a 09 22 73 6e 6f 77 6c 65 6f 70 61  .;;..."snowleopa
22b0: 72 64 22 29 0a 09 09 2e 2f 61 75 74 6f 67 65 6e  rd")..../autogen
22c0: 2e 73 68 0a 09 09 73 6e 6f 77 6c 65 6f 70 61 72  .sh...snowleopar
22d0: 64 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b 0a  d...exit $?..;;.
22e0: 09 0a 09 22 6c 69 6f 6e 22 29 0a 09 09 2e 2f 61  ..."lion")..../a
22f0: 75 74 6f 67 65 6e 2e 73 68 0a 09 09 6c 69 6f 6e  utogen.sh...lion
2300: 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b 0a 09  ...exit $?..;;..
2310: 0a 09 22 73 6c 74 6f 6d 6c 22 29 0a 09 09 2e 2f  .."sltoml")..../
2320: 61 75 74 6f 67 65 6e 2e 73 68 0a 09 09 73 6c 74  autogen.sh...slt
2330: 6f 6d 6c 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b  oml...exit $?..;
2340: 3b 0a 0a 09 22 61 6c 6c 22 29 0a 09 09 2e 2f 61  ;..."all")..../a
2350: 75 74 6f 67 65 6e 2e 73 68 0a 09 09 6c 65 6f 70  utogen.sh...leop
2360: 61 72 64 0a 09 09 73 6c 74 6f 6d 6c 0a 09 09 65  ard...sltoml...e
2370: 63 68 6f 20 22 22 0a 09 09 65 63 68 6f 20 22 41  cho ""...echo "A
2380: 6c 6c 20 62 75 69 6c 64 73 20 63 6f 6d 70 6c 65  ll builds comple
2390: 74 65 2e 22 0a 09 09 65 78 69 74 20 24 3f 0a 09  te."...exit $?..
23a0: 3b 3b 0a 0a 09 22 63 6c 65 61 6e 22 29 0a 09 09  ;;..."clean")...
23b0: 63 6c 65 61 6e 0a 09 09 65 78 69 74 20 24 3f 0a  clean...exit $?.
23c0: 09 3b 3b 0a 0a 09 2a 29 0a 09 09 75 73 61 67 65  .;;...*)...usage
23d0: 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b 0a 65  ...exit $?..;;.e
23e0: 73 61 63 20 0a                                   sac .