Hex Artifact Content

Artifact 3bcceffb9b2e0e4fce5f9bcc9ae24c2cade71c2e:


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 61 6c 6c 20 2d 20 28 42 75 69   "    all - (Bui
0290: 6c 64 73 20 66 6f 72 20 61 6c 6c 20 73 75 70 70  lds for all supp
02a0: 6f 72 74 65 64 20 74 61 72 67 65 74 73 29 22 0a  orted targets)".
02b0: 09 65 63 68 6f 20 22 20 20 20 20 63 6c 65 61 6e  .echo "    clean
02c0: 20 2d 20 28 43 6c 65 61 6e 73 20 75 70 29 22 0a   - (Cleans up)".
02d0: 09 65 63 68 6f 20 22 52 75 6e 20 66 72 6f 6d 20  .echo "Run from 
02e0: 43 41 43 4b 65 79 20 42 75 69 6c 64 20 52 6f 6f  CACKey Build Roo
02f0: 74 2e 22 0a 09 65 78 69 74 20 24 3f 0a 7d 0a 0a  t."..exit $?.}..
0300: 23 20 43 6c 65 61 6e 20 75 70 20 66 75 6e 63 74  # Clean up funct
0310: 69 6f 6e 0a 63 6c 65 61 6e 28 29 20 7b 0a 09 72  ion.clean() {..r
0320: 6d 20 2d 66 20 62 75 69 6c 64 2f 63 61 63 6b 65  m -f build/cacke
0330: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 63 61 63 6b  y_osx_build/cack
0340: 65 79 2e 64 79 6c 69 62 0a 09 72 6d 20 2d 72 66  ey.dylib..rm -rf
0350: 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73   build/cackey_os
0360: 78 5f 62 75 69 6c 64 2f 50 4b 43 53 31 31 2e 74  x_build/PKCS11.t
0370: 6f 6b 65 6e 64 0a 09 72 6d 20 2d 72 66 20 50 4b  okend..rm -rf PK
0380: 43 53 31 31 2e 74 6f 6b 65 6e 64 0a 09 72 6d 20  CS11.tokend..rm 
0390: 2d 72 66 20 6d 61 63 62 75 69 6c 64 0a 09 72 6d  -rf macbuild..rm
03a0: 20 2d 72 66 20 62 75 69 6c 64 2f 63 61 63 6b 65   -rf build/cacke
03b0: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 2a 2e 70 6d  y_osx_build/*.pm
03c0: 64 6f 63 0a 09 6d 61 6b 65 20 64 69 73 74 63 6c  doc..make distcl
03d0: 65 61 6e 0a 7d 0a 0a 23 20 44 69 72 65 63 74 6f  ean.}..# Directo
03e0: 72 79 20 63 72 65 61 74 69 6f 6e 20 66 75 6e 63  ry creation func
03f0: 74 69 6f 6e 0a 6d 61 6b 65 64 69 72 28 29 20 7b  tion.makedir() {
0400: 0a 09 69 66 20 5b 20 22 60 75 6e 61 6d 65 20 2d  ..if [ "`uname -
0410: 72 20 7c 20 63 75 74 20 2d 64 20 2e 20 2d 66 20  r | cut -d . -f 
0420: 31 60 22 20 2d 6c 74 20 22 31 30 22 20 5d 3b 20  1`" -lt "10" ]; 
0430: 74 68 65 6e 0a 09 09 4c 49 42 54 4f 4f 4c 44 49  then...LIBTOOLDI
0440: 52 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 75 73 72  R=/Developer/usr
0450: 2f 73 68 61 72 65 2f 6c 69 62 74 6f 6f 6c 0a 09  /share/libtool..
0460: 65 6c 73 65 0a 09 09 4c 49 42 54 4f 4f 4c 44 49  else...LIBTOOLDI
0470: 52 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 75 73 72  R=/Developer/usr
0480: 2f 73 68 61 72 65 2f 6c 69 62 74 6f 6f 6c 2f 63  /share/libtool/c
0490: 6f 6e 66 69 67 0a 09 66 69 0a 09 69 66 20 5b 20  onfig..fi..if [ 
04a0: 21 20 2d 64 20 6d 61 63 62 75 69 6c 64 20 5d 3b  ! -d macbuild ];
04b0: 20 74 68 65 6e 0a 09 09 6d 6b 64 69 72 20 6d 61   then...mkdir ma
04c0: 63 62 75 69 6c 64 0a 09 09 6d 6b 64 69 72 20 6d  cbuild...mkdir m
04d0: 61 63 62 75 69 6c 64 2f 4c 65 6f 70 61 72 64 0a  acbuild/Leopard.
04e0: 09 09 6d 6b 64 69 72 20 6d 61 63 62 75 69 6c 64  ..mkdir macbuild
04f0: 2f 53 6e 6f 77 6c 65 6f 70 61 72 64 0a 09 09 6d  /Snowleopard...m
0500: 6b 64 69 72 20 6d 61 63 62 75 69 6c 64 2f 4c 69  kdir macbuild/Li
0510: 6f 6e 0a 09 09 6d 6b 64 69 72 20 6d 61 63 62 75  on...mkdir macbu
0520: 69 6c 64 2f 70 6b 67 0a 09 66 69 0a 09 69 66 20  ild/pkg..fi..if 
0530: 5b 20 21 20 2d 66 20 63 6f 6e 66 69 67 2e 67 75  [ ! -f config.gu
0540: 65 73 73 20 5d 3b 20 74 68 65 6e 0a 09 09 63 70  ess ]; then...cp
0550: 20 24 7b 4c 49 42 54 4f 4f 4c 44 49 52 7d 2f 63   ${LIBTOOLDIR}/c
0560: 6f 6e 66 69 67 2e 67 75 65 73 73 20 2e 0a 09 66  onfig.guess ...f
0570: 69 0a 09 69 66 20 5b 20 21 20 2d 66 20 63 6f 6e  i..if [ ! -f con
0580: 66 69 67 2e 73 75 62 20 5d 3b 20 74 68 65 6e 0a  fig.sub ]; then.
0590: 09 09 63 70 20 24 7b 4c 49 42 54 4f 4f 4c 44 49  ..cp ${LIBTOOLDI
05a0: 52 7d 2f 63 6f 6e 66 69 67 2e 73 75 62 20 2e 0a  R}/config.sub ..
05b0: 09 66 69 0a 09 69 66 20 5b 20 21 20 2d 66 20 69  .fi..if [ ! -f i
05c0: 6e 73 74 61 6c 6c 2d 73 68 20 5d 3b 20 74 68 65  nstall-sh ]; the
05d0: 6e 0a 09 09 63 70 20 24 7b 4c 49 42 54 4f 4f 4c  n...cp ${LIBTOOL
05e0: 44 49 52 7d 2f 69 6e 73 74 61 6c 6c 2d 73 68 20  DIR}/install-sh 
05f0: 2e 0a 09 66 69 0a 7d 0a 0a 23 20 42 75 69 6c 64  ...fi.}..# Build
0600: 20 66 75 6e 63 74 69 6f 6e 20 66 6f 72 20 4c 65   function for Le
0610: 6f 70 61 72 64 0a 6c 65 6f 70 61 72 64 28 29 20  opard.leopard() 
0620: 7b 0a 09 6d 61 6b 65 64 69 72 0a 09 48 45 41 44  {..makedir..HEAD
0630: 45 52 53 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 53  ERS=/Developer/S
0640: 44 4b 73 2f 4d 61 63 4f 53 58 31 30 2e 35 2e 73  DKs/MacOSX10.5.s
0650: 64 6b 2f 53 79 73 74 65 6d 2f 4c 69 62 72 61 72  dk/System/Librar
0660: 79 2f 46 72 61 6d 65 77 6f 72 6b 73 2f 50 43 53  y/Frameworks/PCS
0670: 43 2e 66 72 61 6d 65 77 6f 72 6b 2f 56 65 72 73  C.framework/Vers
0680: 69 6f 6e 73 2f 41 2f 48 65 61 64 65 72 73 2f 0a  ions/A/Headers/.
0690: 09 4c 49 42 52 41 52 59 3d 2f 44 65 76 65 6c 6f  .LIBRARY=/Develo
06a0: 70 65 72 2f 53 44 4b 73 2f 4d 61 63 4f 53 58 31  per/SDKs/MacOSX1
06b0: 30 2e 35 2e 73 64 6b 2f 53 79 73 74 65 6d 2f 4c  0.5.sdk/System/L
06c0: 69 62 72 61 72 79 2f 46 72 61 6d 65 77 6f 72 6b  ibrary/Framework
06d0: 73 2f 50 43 53 43 2e 66 72 61 6d 65 77 6f 72 6b  s/PCSC.framework
06e0: 2f 50 43 53 43 0a 09 4c 49 42 3d 22 22 0a 09 41  /PCSC..LIB=""..A
06f0: 52 43 48 4c 49 53 54 3d 22 22 0a 09 44 4c 49 42  RCHLIST=""..DLIB
0700: 3d 22 22 0a 09 44 41 52 43 48 4c 49 53 54 3d 22  =""..DARCHLIST="
0710: 22 0a 09 4f 53 58 3d 4c 65 6f 70 61 72 64 0a 09  "..OSX=Leopard..
0720: 50 4b 54 41 52 47 45 54 4f 53 3d 33 0a 09 4e 45  PKTARGETOS=3..NE
0730: 58 54 4f 53 58 56 45 52 3d 31 30 2e 36 0a 09 43  XTOSXVER=10.6..C
0740: 55 52 4f 53 58 56 45 52 3d 31 30 2e 35 0a 09 66  UROSXVER=10.5..f
0750: 6f 72 20 48 4f 53 54 20 69 6e 20 70 6f 77 65 72  or HOST in power
0760: 70 63 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e 39  pc-apple-darwin9
0770: 20 69 33 38 36 2d 61 70 70 6c 65 2d 64 61 72 77   i386-apple-darw
0780: 69 6e 39 3b 20 64 6f 0a 09 09 67 65 6e 62 75 69  in9; do...genbui
0790: 6c 64 0a 09 64 6f 6e 65 0a 09 6c 69 62 62 75 69  ld..done..libbui
07a0: 6c 64 0a 09 70 6b 67 62 75 69 6c 64 0a 7d 0a 0a  ld..pkgbuild.}..
07b0: 23 20 42 75 69 6c 64 20 66 75 6e 63 74 69 6f 6e  # Build function
07c0: 20 66 6f 72 20 53 6e 6f 77 20 4c 65 6f 70 61 72   for Snow Leopar
07d0: 64 0a 73 6e 6f 77 6c 65 6f 70 61 72 64 28 29 20  d.snowleopard() 
07e0: 7b 0a 09 6d 61 6b 65 64 69 72 0a 09 48 45 41 44  {..makedir..HEAD
07f0: 45 52 53 3d 2f 44 65 76 65 6c 6f 70 65 72 2f 53  ERS=/Developer/S
0800: 44 4b 73 2f 4d 61 63 4f 53 58 31 30 2e 36 2e 73  DKs/MacOSX10.6.s
0810: 64 6b 2f 53 79 73 74 65 6d 2f 4c 69 62 72 61 72  dk/System/Librar
0820: 79 2f 46 72 61 6d 65 77 6f 72 6b 73 2f 50 43 53  y/Frameworks/PCS
0830: 43 2e 66 72 61 6d 65 77 6f 72 6b 2f 56 65 72 73  C.framework/Vers
0840: 69 6f 6e 73 2f 41 2f 48 65 61 64 65 72 73 2f 0a  ions/A/Headers/.
0850: 09 4c 49 42 52 41 52 59 3d 2f 44 65 76 65 6c 6f  .LIBRARY=/Develo
0860: 70 65 72 2f 53 44 4b 73 2f 4d 61 63 4f 53 58 31  per/SDKs/MacOSX1
0870: 30 2e 36 2e 73 64 6b 2f 53 79 73 74 65 6d 2f 4c  0.6.sdk/System/L
0880: 69 62 72 61 72 79 2f 46 72 61 6d 65 77 6f 72 6b  ibrary/Framework
0890: 73 2f 50 43 53 43 2e 66 72 61 6d 65 77 6f 72 6b  s/PCSC.framework
08a0: 2f 50 43 53 43 0a 09 4c 49 42 3d 22 22 0a 09 41  /PCSC..LIB=""..A
08b0: 52 43 48 4c 49 53 54 3d 22 22 0a 09 44 4c 49 42  RCHLIST=""..DLIB
08c0: 3d 22 22 0a 09 44 41 52 43 48 4c 49 53 54 3d 22  =""..DARCHLIST="
08d0: 22 0a 09 4f 53 58 3d 53 6e 6f 77 6c 65 6f 70 61  "..OSX=Snowleopa
08e0: 72 64 0a 09 50 4b 54 41 52 47 45 54 4f 53 3d 33  rd..PKTARGETOS=3
08f0: 0a 09 4e 45 58 54 4f 53 58 56 45 52 3d 31 30 2e  ..NEXTOSXVER=10.
0900: 37 0a 09 43 55 52 4f 53 58 56 45 52 3d 31 30 2e  7..CUROSXVER=10.
0910: 36 0a 09 66 6f 72 20 48 4f 53 54 20 69 6e 20 69  6..for HOST in i
0920: 33 38 36 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e  386-apple-darwin
0930: 31 30 20 78 38 36 5f 36 34 2d 61 70 70 6c 65 2d  10 x86_64-apple-
0940: 64 61 72 77 69 6e 31 30 3b 20 64 6f 0a 09 09 67  darwin10; do...g
0950: 65 6e 62 75 69 6c 64 0a 09 64 6f 6e 65 0a 09 6c  enbuild..done..l
0960: 69 62 62 75 69 6c 64 0a 09 70 6b 67 62 75 69 6c  ibbuild..pkgbuil
0970: 64 0a 7d 0a 0a 23 20 42 75 69 6c 64 20 66 75 6e  d.}..# Build fun
0980: 63 74 69 6f 6e 20 66 6f 72 20 4c 69 6f 6e 0a 6c  ction for Lion.l
0990: 69 6f 6e 28 29 20 7b 0a 09 6d 61 6b 65 64 69 72  ion() {..makedir
09a0: 0a 09 48 45 41 44 45 52 53 3d 2f 44 65 76 65 6c  ..HEADERS=/Devel
09b0: 6f 70 65 72 2f 53 44 4b 73 2f 4d 61 63 4f 53 58  oper/SDKs/MacOSX
09c0: 31 30 2e 37 2e 73 64 6b 2f 53 79 73 74 65 6d 2f  10.7.sdk/System/
09d0: 4c 69 62 72 61 72 79 2f 46 72 61 6d 65 77 6f 72  Library/Framewor
09e0: 6b 73 2f 50 43 53 43 2e 66 72 61 6d 65 77 6f 72  ks/PCSC.framewor
09f0: 6b 2f 56 65 72 73 69 6f 6e 73 2f 41 2f 48 65 61  k/Versions/A/Hea
0a00: 64 65 72 73 2f 0a 09 4c 49 42 52 41 52 59 3d 2f  ders/..LIBRARY=/
0a10: 44 65 76 65 6c 6f 70 65 72 2f 53 44 4b 73 2f 4d  Developer/SDKs/M
0a20: 61 63 4f 53 58 31 30 2e 37 2e 73 64 6b 2f 53 79  acOSX10.7.sdk/Sy
0a30: 73 74 65 6d 2f 4c 69 62 72 61 72 79 2f 46 72 61  stem/Library/Fra
0a40: 6d 65 77 6f 72 6b 73 2f 50 43 53 43 2e 66 72 61  meworks/PCSC.fra
0a50: 6d 65 77 6f 72 6b 2f 50 43 53 43 0a 09 4c 49 42  mework/PCSC..LIB
0a60: 3d 22 22 0a 09 41 52 43 48 4c 49 53 54 3d 22 22  =""..ARCHLIST=""
0a70: 0a 09 44 4c 49 42 3d 22 22 0a 09 44 41 52 43 48  ..DLIB=""..DARCH
0a80: 4c 49 53 54 3d 22 22 0a 09 4f 53 58 3d 4c 69 6f  LIST=""..OSX=Lio
0a90: 6e 0a 09 50 4b 54 41 52 47 45 54 4f 53 3d 33 0a  n..PKTARGETOS=3.
0aa0: 09 4e 45 58 54 4f 53 58 56 45 52 3d 31 30 2e 38  .NEXTOSXVER=10.8
0ab0: 0a 09 43 55 52 4f 53 58 56 45 52 3d 31 30 2e 37  ..CUROSXVER=10.7
0ac0: 0a 09 66 6f 72 20 48 4f 53 54 20 69 6e 20 69 33  ..for HOST in i3
0ad0: 38 36 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e 31  86-apple-darwin1
0ae0: 31 20 78 38 36 5f 36 34 2d 61 70 70 6c 65 2d 64  1 x86_64-apple-d
0af0: 61 72 77 69 6e 31 31 3b 20 64 6f 0a 09 09 67 65  arwin11; do...ge
0b00: 6e 62 75 69 6c 64 0a 09 64 6f 6e 65 0a 09 6c 69  nbuild..done..li
0b10: 62 62 75 69 6c 64 0a 09 70 6b 67 62 75 69 6c 64  bbuild..pkgbuild
0b20: 0a 7d 0a 0a 23 20 47 65 6e 65 72 69 63 20 62 75  .}..# Generic bu
0b30: 69 6c 64 20 66 75 6e 63 74 69 6f 6e 0a 67 65 6e  ild function.gen
0b40: 62 75 69 6c 64 28 29 20 7b 0a 09 6d 61 6b 65 20  build() {..make 
0b50: 64 69 73 74 63 6c 65 61 6e 0a 09 41 52 43 48 3d  distclean..ARCH=
0b60: 60 65 63 68 6f 20 24 7b 48 4f 53 54 7d 20 7c 20  `echo ${HOST} | 
0b70: 63 75 74 20 2d 64 20 22 2d 22 20 2d 66 20 31 60  cut -d "-" -f 1`
0b80: 0a 09 69 66 20 5b 20 24 7b 41 52 43 48 7d 20 3d  ..if [ ${ARCH} =
0b90: 3d 20 22 70 6f 77 65 72 70 63 22 20 5d 3b 20 74  = "powerpc" ]; t
0ba0: 68 65 6e 0a 09 09 69 66 20 5b 20 24 7b 4f 53 58  hen...if [ ${OSX
0bb0: 7d 20 3d 3d 20 22 4c 65 6f 70 61 72 64 22 20 5d  } == "Leopard" ]
0bc0: 3b 20 74 68 65 6e 0a 09 09 09 41 52 43 48 3d 22  ; then....ARCH="
0bd0: 70 70 63 20 2d 6d 63 70 75 3d 47 34 22 0a 09 09  ppc -mcpu=G4"...
0be0: 65 6c 73 65 0a 09 09 09 41 52 43 48 3d 22 70 70  else....ARCH="pp
0bf0: 63 20 2d 6d 63 70 75 3d 47 33 22 0a 09 09 66 69  c -mcpu=G3"...fi
0c00: 0a 09 66 69 0a 09 69 66 20 5b 20 22 24 7b 4c 49  ..fi..if [ "${LI
0c10: 4f 4e 42 55 49 4c 44 7d 22 20 3d 20 31 20 5d 3b  ONBUILD}" = 1 ];
0c20: 20 74 68 65 6e 0a 09 09 69 66 20 5b 20 22 24 7b   then...if [ "${
0c30: 41 52 43 48 7d 22 20 3d 3d 20 22 70 70 63 20 2d  ARCH}" == "ppc -
0c40: 6d 63 70 75 3d 47 34 22 20 5d 3b 20 74 68 65 6e  mcpu=G4" ]; then
0c50: 0a 09 09 09 43 43 3d 70 6f 77 65 72 70 63 2d 61  ....CC=powerpc-a
0c60: 70 70 6c 65 2d 64 61 72 77 69 6e 31 31 2d 67 63  pple-darwin11-gc
0c70: 63 2d 34 2e 32 2e 31 20 43 50 50 3d 70 6f 77 65  c-4.2.1 CPP=powe
0c80: 72 70 63 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e  rpc-apple-darwin
0c90: 31 31 2d 63 70 70 2d 34 2e 32 2e 31 20 43 46 4c  11-cpp-4.2.1 CFL
0ca0: 41 47 53 3d 22 2d 6d 33 32 20 2d 49 2f 44 65 76  AGS="-m32 -I/Dev
0cb0: 65 6c 6f 70 65 72 2f 50 6c 61 74 66 6f 72 6d 73  eloper/Platforms
0cc0: 2f 69 50 68 6f 6e 65 4f 53 2e 70 6c 61 74 66 6f  /iPhoneOS.platfo
0cd0: 72 6d 2f 44 65 76 65 6c 6f 70 65 72 2f 75 73 72  rm/Developer/usr
0ce0: 2f 6c 69 62 2f 67 63 63 2f 70 6f 77 65 72 70 63  /lib/gcc/powerpc
0cf0: 2d 61 70 70 6c 65 2d 64 61 72 77 69 6e 31 30 2f  -apple-darwin10/
0d00: 34 2e 32 2e 31 2f 69 6e 63 6c 75 64 65 20 2d 69  4.2.1/include -i
0d10: 73 79 73 72 6f 6f 74 20 2f 44 65 76 65 6c 6f 70  sysroot /Develop
0d20: 65 72 2f 53 44 4b 73 2f 4d 61 63 4f 53 58 31 30  er/SDKs/MacOSX10
0d30: 2e 35 2e 73 64 6b 22 20 43 50 50 46 4c 41 47 53  .5.sdk" CPPFLAGS
0d40: 3d 22 2d 44 5f 4c 49 42 43 5f 4c 49 4d 49 54 53  ="-D_LIBC_LIMITS
0d50: 5f 48 5f 22 20 2e 2f 63 6f 6e 66 69 67 75 72 65  _H_" ./configure
0d60: 20 2d 2d 77 69 74 68 2d 70 63 73 63 2d 68 65 61   --with-pcsc-hea
0d70: 64 65 72 73 3d 24 7b 48 45 41 44 45 52 53 7d 20  ders=${HEADERS} 
0d80: 2d 2d 77 69 74 68 2d 70 63 73 63 2d 6c 69 62 73  --with-pcsc-libs
0d90: 3d 24 7b 4c 49 42 52 41 52 59 7d 20 2d 2d 68 6f  =${LIBRARY} --ho
0da0: 73 74 3d 24 7b 48 4f 53 54 7d 20 2d 2d 65 6e 61  st=${HOST} --ena
0db0: 62 6c 65 2d 64 6f 64 2d 63 65 72 74 73 2d 6f 6e  ble-dod-certs-on
0dc0: 2d 68 77 2d 73 6c 6f 74 73 0a 09 09 65 6c 73 65  -hw-slots...else
0dd0: 0a 09 09 09 43 46 4c 41 47 53 3d 22 2d 61 72 63  ....CFLAGS="-arc
0de0: 68 20 24 7b 41 52 43 48 7d 22 20 2e 2f 63 6f 6e  h ${ARCH}" ./con
0df0: 66 69 67 75 72 65 20 2d 2d 77 69 74 68 2d 70 63  figure --with-pc
0e00: 73 63 2d 68 65 61 64 65 72 73 3d 24 7b 48 45 41  sc-headers=${HEA
0e10: 44 45 52 53 7d 20 2d 2d 77 69 74 68 2d 70 63 73  DERS} --with-pcs
0e20: 63 2d 6c 69 62 73 3d 24 7b 4c 49 42 52 41 52 59  c-libs=${LIBRARY
0e30: 7d 20 2d 2d 68 6f 73 74 3d 24 7b 48 4f 53 54 7d  } --host=${HOST}
0e40: 20 2d 2d 65 6e 61 62 6c 65 2d 64 6f 64 2d 63 65   --enable-dod-ce
0e50: 72 74 73 2d 6f 6e 2d 68 77 2d 73 6c 6f 74 73 0a  rts-on-hw-slots.
0e60: 09 09 66 69 0a 09 65 6c 73 65 0a 09 09 43 46 4c  ..fi..else...CFL
0e70: 41 47 53 3d 22 2d 61 72 63 68 20 24 7b 41 52 43  AGS="-arch ${ARC
0e80: 48 7d 22 20 2e 2f 63 6f 6e 66 69 67 75 72 65 20  H}" ./configure 
0e90: 2d 2d 77 69 74 68 2d 70 63 73 63 2d 68 65 61 64  --with-pcsc-head
0ea0: 65 72 73 3d 24 7b 48 45 41 44 45 52 53 7d 20 2d  ers=${HEADERS} -
0eb0: 2d 77 69 74 68 2d 70 63 73 63 2d 6c 69 62 73 3d  -with-pcsc-libs=
0ec0: 24 7b 4c 49 42 52 41 52 59 7d 20 2d 2d 68 6f 73  ${LIBRARY} --hos
0ed0: 74 3d 24 7b 48 4f 53 54 7d 20 2d 2d 65 6e 61 62  t=${HOST} --enab
0ee0: 6c 65 2d 64 6f 64 2d 63 65 72 74 73 2d 6f 6e 2d  le-dod-certs-on-
0ef0: 68 77 2d 73 6c 6f 74 73 0a 09 66 69 0a 09 6d 61  hw-slots..fi..ma
0f00: 6b 65 0a 09 63 70 20 6c 69 62 63 61 63 6b 65 79  ke..cp libcackey
0f10: 2e 64 79 6c 69 62 20 6d 61 63 62 75 69 6c 64 2f  .dylib macbuild/
0f20: 24 7b 4f 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79  ${OSX}/libcackey
0f30: 2e 64 79 6c 69 62 2e 60 65 63 68 6f 20 24 7b 41  .dylib.`echo ${A
0f40: 52 43 48 7d 20 7c 20 63 75 74 20 2d 64 20 27 20  RCH} | cut -d ' 
0f50: 27 20 2d 66 20 31 60 0a 09 63 70 20 6c 69 62 63  ' -f 1`..cp libc
0f60: 61 63 6b 65 79 5f 67 2e 64 79 6c 69 62 20 6d 61  ackey_g.dylib ma
0f70: 63 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c 69  cbuild/${OSX}/li
0f80: 62 63 61 63 6b 65 79 5f 67 2e 64 79 6c 69 62 2e  bcackey_g.dylib.
0f90: 60 65 63 68 6f 20 24 7b 41 52 43 48 7d 20 7c 20  `echo ${ARCH} | 
0fa0: 63 75 74 20 2d 64 20 27 20 27 20 2d 66 20 31 60  cut -d ' ' -f 1`
0fb0: 20 0a 7d 0a 0a 23 20 4c 69 62 72 61 72 79 20 62   .}..# Library b
0fc0: 75 69 6c 64 20 66 75 6e 63 74 69 6f 6e 0a 6c 69  uild function.li
0fd0: 62 62 75 69 6c 64 28 29 20 7b 0a 09 66 6f 72 20  bbuild() {..for 
0fe0: 4c 49 42 20 69 6e 20 6d 61 63 62 75 69 6c 64 2f  LIB in macbuild/
0ff0: 24 7b 4f 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79  ${OSX}/libcackey
1000: 2e 64 79 6c 69 62 2e 2a 3b 20 64 6f 0a 09 09 41  .dylib.*; do...A
1010: 52 43 48 4c 49 53 54 3d 22 24 7b 41 52 43 48 4c  RCHLIST="${ARCHL
1020: 49 53 54 7d 20 60 65 63 68 6f 20 27 2d 61 72 63  IST} `echo '-arc
1030: 68 20 27 60 20 60 65 63 68 6f 20 24 7b 4c 49 42  h '` `echo ${LIB
1040: 7d 20 7c 20 63 75 74 20 2d 64 20 2e 20 2d 66 20  } | cut -d . -f 
1050: 33 60 20 60 65 63 68 6f 20 27 20 27 60 20 60 65  3` `echo ' '` `e
1060: 63 68 6f 20 24 7b 4c 49 42 7d 60 22 0a 09 64 6f  cho ${LIB}`"..do
1070: 6e 65 0a 09 6c 69 70 6f 20 2d 63 72 65 61 74 65  ne..lipo -create
1080: 20 24 7b 41 52 43 48 4c 49 53 54 7d 20 2d 6f 75   ${ARCHLIST} -ou
1090: 74 70 75 74 20 6d 61 63 62 75 69 6c 64 2f 24 7b  tput macbuild/${
10a0: 4f 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79 2e 64  OSX}/libcackey.d
10b0: 79 6c 69 62 0a 09 66 6f 72 20 44 4c 49 42 20 69  ylib..for DLIB i
10c0: 6e 20 6d 61 63 62 75 69 6c 64 2f 24 7b 4f 53 58  n macbuild/${OSX
10d0: 7d 2f 6c 69 62 63 61 63 6b 65 79 5f 67 2e 64 79  }/libcackey_g.dy
10e0: 6c 69 62 2e 2a 3b 20 64 6f 0a 09 09 44 41 52 43  lib.*; do...DARC
10f0: 48 4c 49 53 54 3d 22 24 7b 44 41 52 43 48 4c 49  HLIST="${DARCHLI
1100: 53 54 7d 20 60 65 63 68 6f 20 27 2d 61 72 63 68  ST} `echo '-arch
1110: 20 27 60 20 60 65 63 68 6f 20 24 7b 44 4c 49 42   '` `echo ${DLIB
1120: 7d 20 7c 20 63 75 74 20 2d 64 20 2e 20 2d 66 20  } | cut -d . -f 
1130: 33 60 20 60 65 63 68 6f 20 27 20 27 60 20 60 65  3` `echo ' '` `e
1140: 63 68 6f 20 24 7b 44 4c 49 42 7d 60 22 0a 09 64  cho ${DLIB}`"..d
1150: 6f 6e 65 0a 09 6c 69 70 6f 20 2d 63 72 65 61 74  one..lipo -creat
1160: 65 20 24 7b 44 41 52 43 48 4c 49 53 54 7d 20 2d  e ${DARCHLIST} -
1170: 6f 75 74 70 75 74 20 6d 61 63 62 75 69 6c 64 2f  output macbuild/
1180: 24 7b 4f 53 58 7d 2f 6c 69 62 63 61 63 6b 65 79  ${OSX}/libcackey
1190: 5f 67 2e 64 79 6c 69 62 0a 09 72 6d 20 6d 61 63  _g.dylib..rm mac
11a0: 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c 69 62  build/${OSX}/lib
11b0: 63 61 63 6b 65 79 2a 2e 64 79 6c 69 62 2e 2a 0a  cackey*.dylib.*.
11c0: 7d 0a 0a 23 20 46 75 6e 63 74 69 6f 6e 20 74 6f  }..# Function to
11d0: 20 62 75 69 6c 64 20 4d 61 63 20 4f 53 20 58 20   build Mac OS X 
11e0: 50 61 63 6b 61 67 65 73 0a 70 6b 67 62 75 69 6c  Packages.pkgbuil
11f0: 64 28 29 20 7b 0a 09 69 66 20 5b 20 22 60 75 6e  d() {..if [ "`un
1200: 61 6d 65 20 2d 72 20 7c 20 63 75 74 20 2d 64 20  ame -r | cut -d 
1210: 2e 20 2d 66 20 31 60 22 20 2d 6c 74 20 22 31 30  . -f 1`" -lt "10
1220: 22 20 5d 3b 20 74 68 65 6e 0a 09 09 4c 49 42 43  " ]; then...LIBC
1230: 41 43 4b 45 59 47 3d 6c 69 62 63 61 63 6b 65 79  ACKEYG=libcackey
1240: 67 2e 70 6b 67 0a 09 65 6c 73 65 0a 09 09 4c 49  g.pkg..else...LI
1250: 42 43 41 43 4b 45 59 47 3d 6c 69 62 63 61 63 6b  BCACKEYG=libcack
1260: 65 79 5f 67 2e 70 6b 67 0a 09 66 69 0a 09 72 6d  ey_g.pkg..fi..rm
1270: 20 2d 66 20 62 75 69 6c 64 2f 63 61 63 6b 65 79   -f build/cackey
1280: 5f 6f 73 78 5f 62 75 69 6c 64 2f 63 61 63 6b 65  _osx_build/cacke
1290: 79 2e 64 79 6c 69 62 0a 09 6c 6e 20 6d 61 63 62  y.dylib..ln macb
12a0: 75 69 6c 64 2f 24 7b 4f 53 58 7d 2f 6c 69 62 63  uild/${OSX}/libc
12b0: 61 63 6b 65 79 2e 64 79 6c 69 62 20 62 75 69 6c  ackey.dylib buil
12c0: 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69  d/cackey_osx_bui
12d0: 6c 64 2f 63 61 63 6b 65 79 2e 64 79 6c 69 62 0a  ld/cackey.dylib.
12e0: 09 72 6d 20 2d 72 66 20 62 75 69 6c 64 2f 63 61  .rm -rf build/ca
12f0: 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 50  ckey_osx_build/P
1300: 4b 43 53 31 31 2e 74 6f 6b 65 6e 64 0a 09 69 66  KCS11.tokend..if
1310: 20 5b 20 22 24 7b 4c 49 4f 4e 42 55 49 4c 44 7d   [ "${LIONBUILD}
1320: 22 20 3d 20 31 20 5d 3b 20 74 68 65 6e 0a 09 09  " = 1 ]; then...
1330: 54 41 52 3d 67 6e 75 74 61 72 0a 09 65 6c 73 65  TAR=gnutar..else
1340: 0a 09 09 54 41 52 3d 74 61 72 0a 09 66 69 0a 09  ...TAR=tar..fi..
1350: 69 66 20 5b 20 22 24 7b 4f 53 58 7d 22 20 3d 20  if [ "${OSX}" = 
1360: 22 4c 65 6f 70 61 72 64 22 20 5d 3b 20 74 68 65  "Leopard" ]; the
1370: 6e 0a 09 09 63 75 72 6c 20 68 74 74 70 3a 2f 2f  n...curl http://
1380: 64 65 76 65 6c 2e 6b 76 61 6e 61 6c 73 2e 6f 72  devel.kvanals.or
1390: 67 2f 50 4b 43 53 31 31 5f 54 6f 6b 65 6e 64 2f  g/PKCS11_Tokend/
13a0: 50 4b 43 53 31 31 5f 74 6f 6b 65 6e 64 2d 6c 61  PKCS11_tokend-la
13b0: 74 65 73 74 2e 74 61 72 2e 67 7a 20 7c 20 24 7b  test.tar.gz | ${
13c0: 54 41 52 7d 20 2d 2d 73 74 72 69 70 2d 63 6f 6d  TAR} --strip-com
13d0: 70 6f 6e 65 6e 74 73 20 33 20 2d 2d 77 69 6c 64  ponents 3 --wild
13e0: 63 61 72 64 73 20 2d 78 20 2d 7a 20 2d 66 20 2d  cards -x -z -f -
13f0: 20 22 50 4b 43 53 31 31 5f 74 6f 6b 65 6e 64 2d   "PKCS11_tokend-
1400: 2a 2f 70 72 65 62 75 69 6c 74 2f 6c 65 6f 70 61  */prebuilt/leopa
1410: 72 64 2f 50 4b 43 53 31 31 2e 74 6f 6b 65 6e 64  rd/PKCS11.tokend
1420: 22 0a 09 09 6d 76 20 50 4b 43 53 31 31 2e 74 6f  "...mv PKCS11.to
1430: 6b 65 6e 64 20 62 75 69 6c 64 2f 63 61 63 6b 65  kend build/cacke
1440: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 50 4b 43 53  y_osx_build/PKCS
1450: 31 31 2e 74 6f 6b 65 6e 64 0a 09 65 6c 73 65 0a  11.tokend..else.
1460: 09 09 63 75 72 6c 20 68 74 74 70 3a 2f 2f 64 65  ..curl http://de
1470: 76 65 6c 2e 6b 76 61 6e 61 6c 73 2e 6f 72 67 2f  vel.kvanals.org/
1480: 50 4b 43 53 31 31 5f 54 6f 6b 65 6e 64 2f 50 4b  PKCS11_Tokend/PK
1490: 43 53 31 31 5f 74 6f 6b 65 6e 64 2d 6c 61 74 65  CS11_tokend-late
14a0: 73 74 2e 74 61 72 2e 67 7a 20 7c 20 24 7b 54 41  st.tar.gz | ${TA
14b0: 52 7d 20 2d 2d 73 74 72 69 70 2d 63 6f 6d 70 6f  R} --strip-compo
14c0: 6e 65 6e 74 73 20 33 20 2d 2d 77 69 6c 64 63 61  nents 3 --wildca
14d0: 72 64 73 20 2d 78 20 2d 7a 20 2d 66 20 2d 20 22  rds -x -z -f - "
14e0: 50 4b 43 53 31 31 5f 74 6f 6b 65 6e 64 2d 2a 2f  PKCS11_tokend-*/
14f0: 70 72 65 62 75 69 6c 74 2f 73 6e 6f 77 6c 65 6f  prebuilt/snowleo
1500: 70 61 72 64 2f 50 4b 43 53 31 31 2e 74 6f 6b 65  pard/PKCS11.toke
1510: 6e 64 22 0a 09 09 6d 76 20 50 4b 43 53 31 31 2e  nd"...mv PKCS11.
1520: 74 6f 6b 65 6e 64 20 62 75 69 6c 64 2f 63 61 63  tokend build/cac
1530: 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 50 4b  key_osx_build/PK
1540: 43 53 31 31 2e 74 6f 6b 65 6e 64 0a 09 66 69 0a  CS11.tokend..fi.
1550: 09 66 6f 72 20 50 4d 44 4f 43 20 69 6e 20 62 75  .for PMDOC in bu
1560: 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62  ild/cackey_osx_b
1570: 75 69 6c 64 2f 54 65 6d 70 6c 61 74 65 5f 70 6d  uild/Template_pm
1580: 62 75 69 6c 64 2f 2a 2e 69 6e 3b 20 64 6f 0a 09  build/*.in; do..
1590: 09 50 4d 44 4f 43 3d 22 60 65 63 68 6f 20 22 24  .PMDOC="`echo "$
15a0: 7b 50 4d 44 4f 43 7d 22 20 7c 20 73 65 64 20 27  {PMDOC}" | sed '
15b0: 73 7c 6c 2e 69 6e 7c 6c 7c 67 27 20 7c 20 73 65  s|l.in|l|g' | se
15c0: 64 20 27 73 7c 62 75 69 6c 64 2f 63 61 63 6b 65  d 's|build/cacke
15d0: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 54 65 6d 70  y_osx_build/Temp
15e0: 6c 61 74 65 5f 70 6d 62 75 69 6c 64 2f 7c 7c 67  late_pmbuild/||g
15f0: 27 60 22 0a 09 09 55 55 49 44 3d 22 60 70 79 74  '`"...UUID="`pyt
1600: 68 6f 6e 20 2d 63 20 27 69 6d 70 6f 72 74 20 75  hon -c 'import u
1610: 75 69 64 3b 20 70 72 69 6e 74 20 75 75 69 64 2e  uid; print uuid.
1620: 75 75 69 64 31 28 29 27 20 7c 20 64 64 20 63 6f  uuid1()' | dd co
1630: 6e 76 3d 75 63 61 73 65 20 32 3e 2f 64 65 76 2f  nv=ucase 2>/dev/
1640: 6e 75 6c 6c 60 22 0a 09 09 6d 6b 64 69 72 20 2d  null`"...mkdir -
1650: 70 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  p build/cackey_o
1660: 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f  sx_build/${OSX}_
1670: 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 0a 09 09  pmbuild.pmdoc...
1680: 73 65 64 20 22 73 7c 40 40 42 55 49 4c 44 52 4f  sed "s|@@BUILDRO
1690: 4f 54 44 49 52 40 40 7c 24 28 70 77 64 29 7c 67  OTDIR@@|$(pwd)|g
16a0: 22 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  " build/cackey_o
16b0: 73 78 5f 62 75 69 6c 64 2f 54 65 6d 70 6c 61 74  sx_build/Templat
16c0: 65 5f 70 6d 62 75 69 6c 64 2f 24 7b 50 4d 44 4f  e_pmbuild/${PMDO
16d0: 43 7d 2e 69 6e 20 3e 20 62 75 69 6c 64 2f 63 61  C}.in > build/ca
16e0: 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24  ckey_osx_build/$
16f0: 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d  {OSX}_pmbuild.pm
1700: 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 0a 09 09 73  doc/${PMDOC}...s
1710: 65 64 20 22 73 7c 40 40 4f 53 58 56 45 52 53 49  ed "s|@@OSXVERSI
1720: 4f 4e 40 40 7c 24 7b 4f 53 58 7d 7c 67 22 20 62  ON@@|${OSX}|g" b
1730: 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f  uild/cackey_osx_
1740: 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62  build/${OSX}_pmb
1750: 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44  uild.pmdoc/${PMD
1760: 4f 43 7d 20 3e 20 62 75 69 6c 64 2f 63 61 63 6b  OC} > build/cack
1770: 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f  ey_osx_build/${O
1780: 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f  SX}_pmbuild.pmdo
1790: 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31 0a 09 09 73  c/${PMDOC}.1...s
17a0: 65 64 20 22 73 7c 40 40 55 55 49 44 40 40 7c 24  ed "s|@@UUID@@|$
17b0: 7b 55 55 49 44 7d 7c 67 22 20 62 75 69 6c 64 2f  {UUID}|g" build/
17c0: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
17d0: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
17e0: 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31  pmdoc/${PMDOC}.1
17f0: 20 3e 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f   > build/cackey_
1800: 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d  osx_build/${OSX}
1810: 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24  _pmbuild.pmdoc/$
1820: 7b 50 4d 44 4f 43 7d 0a 09 09 73 65 64 20 22 73  {PMDOC}...sed "s
1830: 7c 40 40 54 41 52 47 45 54 4f 53 40 40 7c 24 7b  |@@TARGETOS@@|${
1840: 50 4b 54 41 52 47 45 54 4f 53 7d 7c 67 22 20 62  PKTARGETOS}|g" b
1850: 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f  uild/cackey_osx_
1860: 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62  build/${OSX}_pmb
1870: 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44  uild.pmdoc/${PMD
1880: 4f 43 7d 20 3e 20 62 75 69 6c 64 2f 63 61 63 6b  OC} > build/cack
1890: 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f  ey_osx_build/${O
18a0: 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f  SX}_pmbuild.pmdo
18b0: 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31 0a 09 09 73  c/${PMDOC}.1...s
18c0: 65 64 20 22 73 7c 40 40 4e 45 58 54 4f 53 58 56  ed "s|@@NEXTOSXV
18d0: 45 52 40 40 7c 24 7b 4e 45 58 54 4f 53 58 56 45  ER@@|${NEXTOSXVE
18e0: 52 7d 7c 67 22 20 62 75 69 6c 64 2f 63 61 63 6b  R}|g" build/cack
18f0: 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f  ey_osx_build/${O
1900: 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f  SX}_pmbuild.pmdo
1910: 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31 20 3e 20 62  c/${PMDOC}.1 > b
1920: 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f  uild/cackey_osx_
1930: 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62  build/${OSX}_pmb
1940: 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44  uild.pmdoc/${PMD
1950: 4f 43 7d 0a 09 09 73 65 64 20 22 73 7c 40 40 43  OC}...sed "s|@@C
1960: 55 52 4f 53 58 56 45 52 40 40 7c 24 7b 43 55 52  UROSXVER@@|${CUR
1970: 4f 53 58 56 45 52 7d 7c 67 22 20 62 75 69 6c 64  OSXVER}|g" build
1980: 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c  /cackey_osx_buil
1990: 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64  d/${OSX}_pmbuild
19a0: 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 20  .pmdoc/${PMDOC} 
19b0: 3e 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  > build/cackey_o
19c0: 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f  sx_build/${OSX}_
19d0: 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b  pmbuild.pmdoc/${
19e0: 50 4d 44 4f 43 7d 2e 31 0a 09 09 73 65 64 20 22  PMDOC}.1...sed "
19f0: 73 7c 40 40 4c 49 42 43 41 43 4b 45 59 47 40 40  s|@@LIBCACKEYG@@
1a00: 7c 24 7b 4c 49 42 43 41 43 4b 45 59 47 7d 7c 67  |${LIBCACKEYG}|g
1a10: 22 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  " build/cackey_o
1a20: 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f  sx_build/${OSX}_
1a30: 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 24 7b  pmbuild.pmdoc/${
1a40: 50 4d 44 4f 43 7d 2e 31 20 3e 20 62 75 69 6c 64  PMDOC}.1 > build
1a50: 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c  /cackey_osx_buil
1a60: 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64  d/${OSX}_pmbuild
1a70: 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 0a  .pmdoc/${PMDOC}.
1a80: 09 09 63 70 20 62 75 69 6c 64 2f 63 61 63 6b 65  ..cp build/cacke
1a90: 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53  y_osx_build/${OS
1aa0: 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63  X}_pmbuild.pmdoc
1ab0: 2f 24 7b 50 4d 44 4f 43 7d 20 62 75 69 6c 64 2f  /${PMDOC} build/
1ac0: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1ad0: 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e  /${OSX}_pmbuild.
1ae0: 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31  pmdoc/${PMDOC}.1
1af0: 0a 09 09 6d 76 20 62 75 69 6c 64 2f 63 61 63 6b  ...mv build/cack
1b00: 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f  ey_osx_build/${O
1b10: 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f  SX}_pmbuild.pmdo
1b20: 63 2f 24 7b 50 4d 44 4f 43 7d 2e 31 20 62 75 69  c/${PMDOC}.1 bui
1b30: 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75  ld/cackey_osx_bu
1b40: 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69  ild/${OSX}_pmbui
1b50: 6c 64 2e 70 6d 64 6f 63 2f 24 7b 50 4d 44 4f 43  ld.pmdoc/${PMDOC
1b60: 7d 0a 09 64 6f 6e 65 0a 09 45 58 54 3d 70 6b 67  }..done..EXT=pkg
1b70: 0a 09 69 66 20 5b 20 24 7b 4f 53 58 7d 20 3d 3d  ..if [ ${OSX} ==
1b80: 20 22 53 6e 6f 77 6c 65 6f 70 61 72 64 22 20 5d   "Snowleopard" ]
1b90: 3b 20 74 68 65 6e 0a 09 09 63 61 74 20 62 75 69  ; then...cat bui
1ba0: 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75  ld/cackey_osx_bu
1bb0: 69 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69  ild/${OSX}_pmbui
1bc0: 6c 64 2e 70 6d 64 6f 63 2f 69 6e 64 65 78 2e 78  ld.pmdoc/index.x
1bd0: 6d 6c 20 7c 20 73 65 64 20 27 73 7c 66 6f 72 20  ml | sed 's|for 
1be0: 4d 61 63 20 4f 53 20 58 20 53 6e 6f 77 6c 65 6f  Mac OS X Snowleo
1bf0: 70 61 72 64 7c 66 6f 72 20 4d 61 63 20 4f 53 20  pard|for Mac OS 
1c00: 58 20 53 6e 6f 77 4c 65 6f 70 61 72 64 7c 67 27  X SnowLeopard|g'
1c10: 20 3e 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f   > build/cackey_
1c20: 6f 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d  osx_build/${OSX}
1c30: 5f 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 69  _pmbuild.pmdoc/i
1c40: 6e 64 65 78 2e 78 6d 6c 2e 6e 65 77 0a 09 09 6d  ndex.xml.new...m
1c50: 76 20 62 75 69 6c 64 2f 63 61 63 6b 65 79 5f 6f  v build/cackey_o
1c60: 73 78 5f 62 75 69 6c 64 2f 24 7b 4f 53 58 7d 5f  sx_build/${OSX}_
1c70: 70 6d 62 75 69 6c 64 2e 70 6d 64 6f 63 2f 69 6e  pmbuild.pmdoc/in
1c80: 64 65 78 2e 78 6d 6c 2e 6e 65 77 20 62 75 69 6c  dex.xml.new buil
1c90: 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69  d/cackey_osx_bui
1ca0: 6c 64 2f 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c  ld/${OSX}_pmbuil
1cb0: 64 2e 70 6d 64 6f 63 2f 69 6e 64 65 78 2e 78 6d  d.pmdoc/index.xm
1cc0: 6c 0a 09 66 69 0a 09 2f 44 65 76 65 6c 6f 70 65  l..fi../Develope
1cd0: 72 2f 41 70 70 6c 69 63 61 74 69 6f 6e 73 2f 55  r/Applications/U
1ce0: 74 69 6c 69 74 69 65 73 2f 50 61 63 6b 61 67 65  tilities/Package
1cf0: 4d 61 6b 65 72 2e 61 70 70 2f 43 6f 6e 74 65 6e  Maker.app/Conten
1d00: 74 73 2f 4d 61 63 4f 53 2f 50 61 63 6b 61 67 65  ts/MacOS/Package
1d10: 4d 61 6b 65 72 20 2d 64 20 62 75 69 6c 64 2f 63  Maker -d build/c
1d20: 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64 2f  ackey_osx_build/
1d30: 24 7b 4f 53 58 7d 5f 70 6d 62 75 69 6c 64 2e 70  ${OSX}_pmbuild.p
1d40: 6d 64 6f 63 20 2d 6f 20 6d 61 63 62 75 69 6c 64  mdoc -o macbuild
1d50: 2f 70 6b 67 2f 43 41 43 4b 65 79 5f 24 7b 43 41  /pkg/CACKey_${CA
1d60: 43 4b 45 59 5f 56 45 52 53 49 4f 4e 7d 5f 24 7b  CKEY_VERSION}_${
1d70: 4f 53 58 7d 2e 24 7b 45 58 54 7d 0a 09 74 61 72  OSX}.${EXT}..tar
1d80: 20 2d 2d 63 72 65 61 74 65 20 2d 2d 64 69 72 65   --create --dire
1d90: 63 74 6f 72 79 20 6d 61 63 62 75 69 6c 64 2f 70  ctory macbuild/p
1da0: 6b 67 2f 20 2d 2d 66 69 6c 65 20 6d 61 63 62 75  kg/ --file macbu
1db0: 69 6c 64 2f 70 6b 67 2f 43 41 43 4b 65 79 5f 24  ild/pkg/CACKey_$
1dc0: 7b 43 41 43 4b 45 59 5f 56 45 52 53 49 4f 4e 7d  {CACKEY_VERSION}
1dd0: 5f 24 7b 4f 53 58 7d 2e 24 7b 45 58 54 7d 2e 74  _${OSX}.${EXT}.t
1de0: 61 72 20 43 41 43 4b 65 79 5f 24 7b 43 41 43 4b  ar CACKey_${CACK
1df0: 45 59 5f 56 45 52 53 49 4f 4e 7d 5f 24 7b 4f 53  EY_VERSION}_${OS
1e00: 58 7d 2e 24 7b 45 58 54 7d 0a 09 67 7a 69 70 20  X}.${EXT}..gzip 
1e10: 2d 39 20 6d 61 63 62 75 69 6c 64 2f 70 6b 67 2f  -9 macbuild/pkg/
1e20: 43 41 43 4b 65 79 5f 24 7b 43 41 43 4b 45 59 5f  CACKey_${CACKEY_
1e30: 56 45 52 53 49 4f 4e 7d 5f 24 7b 4f 53 58 7d 2e  VERSION}_${OSX}.
1e40: 24 7b 45 58 54 7d 2e 74 61 72 0a 09 72 6d 20 2d  ${EXT}.tar..rm -
1e50: 72 66 20 6d 61 63 62 75 69 6c 64 2f 70 6b 67 2f  rf macbuild/pkg/
1e60: 43 41 43 4b 65 79 5f 24 7b 43 41 43 4b 45 59 5f  CACKey_${CACKEY_
1e70: 56 45 52 53 49 4f 4e 7d 5f 24 7b 4f 53 58 7d 2e  VERSION}_${OSX}.
1e80: 24 7b 45 58 54 7d 0a 09 72 6d 20 2d 66 20 62 75  ${EXT}..rm -f bu
1e90: 69 6c 64 2f 63 61 63 6b 65 79 5f 6f 73 78 5f 62  ild/cackey_osx_b
1ea0: 75 69 6c 64 2f 63 61 63 6b 65 79 2e 64 79 6c 69  uild/cackey.dyli
1eb0: 62 0a 09 72 6d 20 2d 72 66 20 62 75 69 6c 64 2f  b..rm -rf build/
1ec0: 63 61 63 6b 65 79 5f 6f 73 78 5f 62 75 69 6c 64  cackey_osx_build
1ed0: 2f 50 4b 43 53 31 31 2e 74 6f 6b 65 6e 64 0a 09  /PKCS11.tokend..
1ee0: 65 63 68 6f 20 22 24 7b 4f 53 58 7d 20 62 75 69  echo "${OSX} bui
1ef0: 6c 64 20 63 6f 6d 70 6c 65 74 65 22 0a 7d 0a 0a  ld complete".}..
1f00: 23 20 54 61 6b 65 20 63 6f 6d 6d 61 6e 64 20 6c  # Take command l
1f10: 69 6e 65 20 61 72 67 75 6d 65 6e 74 73 20 61 6e  ine arguments an
1f20: 64 20 65 78 65 63 75 74 65 0a 63 61 73 65 20 22  d execute.case "
1f30: 24 31 22 20 69 6e 0a 09 22 22 29 0a 09 09 75 73  $1" in.."")...us
1f40: 61 67 65 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b  age...exit $?..;
1f50: 3b 0a 0a 09 22 6c 65 6f 70 61 72 64 22 29 0a 09  ;..."leopard")..
1f60: 09 2e 2f 61 75 74 6f 67 65 6e 2e 73 68 0a 09 09  ../autogen.sh...
1f70: 6c 65 6f 70 61 72 64 0a 09 09 65 78 69 74 20 24  leopard...exit $
1f80: 3f 0a 09 3b 3b 0a 0a 09 22 73 6e 6f 77 6c 65 6f  ?..;;..."snowleo
1f90: 70 61 72 64 22 29 0a 09 09 2e 2f 61 75 74 6f 67  pard")..../autog
1fa0: 65 6e 2e 73 68 0a 09 09 73 6e 6f 77 6c 65 6f 70  en.sh...snowleop
1fb0: 61 72 64 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b  ard...exit $?..;
1fc0: 3b 0a 09 0a 09 22 6c 69 6f 6e 22 29 0a 09 09 2e  ;...."lion")....
1fd0: 2f 61 75 74 6f 67 65 6e 2e 73 68 0a 09 09 6c 69  /autogen.sh...li
1fe0: 6f 6e 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b  on...exit $?..;;
1ff0: 0a 0a 09 22 61 6c 6c 22 29 0a 09 09 2e 2f 61 75  ..."all")..../au
2000: 74 6f 67 65 6e 2e 73 68 0a 09 09 6c 65 6f 70 61  togen.sh...leopa
2010: 72 64 0a 09 09 73 6e 6f 77 6c 65 6f 70 61 72 64  rd...snowleopard
2020: 0a 09 09 6c 69 6f 6e 0a 09 09 65 63 68 6f 20 22  ...lion...echo "
2030: 22 0a 09 09 65 63 68 6f 20 22 41 6c 6c 20 62 75  "...echo "All bu
2040: 69 6c 64 73 20 63 6f 6d 70 6c 65 74 65 2e 22 0a  ilds complete.".
2050: 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b 0a 0a 09  ..exit $?..;;...
2060: 22 63 6c 65 61 6e 22 29 0a 09 09 63 6c 65 61 6e  "clean")...clean
2070: 0a 09 09 65 78 69 74 20 24 3f 0a 09 3b 3b 0a 0a  ...exit $?..;;..
2080: 09 2a 29 0a 09 09 75 73 61 67 65 0a 09 09 65 78  .*)...usage...ex
2090: 69 74 20 24 3f 0a 09 3b 3b 0a 65 73 61 63 20 0a  it $?..;;.esac .