Hex Artifact Content

Artifact 15de6138727ea6615a1135e43163f21508b458c0:


0000: 23 21 20 2f 62 69 6e 2f 62 61 73 68 0a 0a 54 43  #! /bin/bash..TC
0010: 4c 56 45 52 53 3d 22 38 2e 34 2e 31 39 22 0a 69  LVERS="8.4.19".i
0020: 66 20 65 63 68 6f 20 22 24 31 22 20 7c 20 67 72  f echo "$1" | gr
0030: 65 70 20 27 5e 5b 30 2d 39 5d 5b 30 2d 39 5d 2a  ep '^[0-9][0-9]*
0040: 5c 2e 27 20 3e 2f 64 65 76 2f 6e 75 6c 6c 20 7c  \.' >/dev/null |
0050: 7c 20 65 63 68 6f 20 22 24 31 22 20 7c 20 67 72  | echo "$1" | gr
0060: 65 70 20 27 5e 63 76 73 5f 27 20 3e 2f 64 65 76  ep '^cvs_' >/dev
0070: 2f 6e 75 6c 6c 3b 20 74 68 65 6e 0a 09 54 43 4c  /null; then..TCL
0080: 56 45 52 53 3d 22 24 31 22 0a 0a 09 73 68 69 66  VERS="$1"...shif
0090: 74 0a 66 69 0a 65 78 70 6f 72 74 20 54 43 4c 56  t.fi.export TCLV
00a0: 45 52 53 0a 0a 23 20 44 65 74 65 72 6d 69 6e 65  ERS..# Determine
00b0: 20 61 70 70 72 6f 70 72 69 61 74 65 20 6d 6f 64   appropriate mod
00c0: 65 0a 6d 6f 64 65 3d 22 62 75 69 6c 64 22 0a 69  e.mode="build".i
00d0: 66 20 5b 20 22 24 31 22 20 3d 20 22 63 6c 65 61  f [ "$1" = "clea
00e0: 6e 22 20 5d 3b 20 74 68 65 6e 0a 09 73 68 69 66  n" ]; then..shif
00f0: 74 0a 0a 09 6d 6f 64 65 3d 22 63 6c 65 61 6e 22  t...mode="clean"
0100: 0a 66 69 0a 69 66 20 5b 20 22 24 31 22 20 3d 20  .fi.if [ "$1" = 
0110: 22 64 69 73 74 63 6c 65 61 6e 22 20 5d 3b 20 74  "distclean" ]; t
0120: 68 65 6e 0a 09 73 68 69 66 74 0a 0a 09 6d 6f 64  hen..shift...mod
0130: 65 3d 22 64 69 73 74 63 6c 65 61 6e 22 0a 66 69  e="distclean".fi
0140: 0a 0a 23 20 44 65 66 69 6e 65 20 74 68 65 20 6c  ..# Define the l
0150: 69 73 74 20 6f 66 20 61 6c 6c 20 70 61 63 6b 61  ist of all packa
0160: 67 65 73 2c 20 66 6f 72 20 63 6c 65 61 6e 69 6e  ges, for cleanin
0170: 67 20 70 75 72 70 6f 73 65 73 0a 4b 49 54 43 52  g purposes.KITCR
0180: 45 41 54 4f 52 5f 41 4c 4c 50 4b 47 53 3d 22 6b  EATOR_ALLPKGS="k
0190: 69 74 73 68 20 74 63 6c 20 74 63 6c 76 66 73 20  itsh tcl tclvfs 
01a0: 7a 6c 69 62 20 74 6b 20 69 74 63 6c 20 6d 6b 34  zlib tk itcl mk4
01b0: 74 63 6c 20 74 68 72 65 61 64 20 6b 69 74 64 6c  tcl thread kitdl
01c0: 6c 22 0a 66 6f 72 20 70 6b 67 20 69 6e 20 24 7b  l".for pkg in ${
01d0: 4b 49 54 43 52 45 41 54 4f 52 5f 41 4c 4c 50 4b  KITCREATOR_ALLPK
01e0: 47 53 7d 3b 20 64 6f 0a 09 72 6d 20 2d 66 20 22  GS}; do..rm -f "
01f0: 24 7b 70 6b 67 7d 2f 62 75 69 6c 64 2e 6c 6f 67  ${pkg}/build.log
0200: 22 0a 09 72 6d 20 2d 72 66 20 22 24 7b 70 6b 67  "..rm -rf "${pkg
0210: 7d 2f 6f 75 74 22 20 22 24 7b 70 6b 67 7d 2f 69  }/out" "${pkg}/i
0220: 6e 73 74 22 20 22 24 7b 70 6b 67 7d 2f 62 75 69  nst" "${pkg}/bui
0230: 6c 64 22 0a 0a 09 69 66 20 5b 20 22 24 7b 6d 6f  ld"...if [ "${mo
0240: 64 65 7d 22 20 3d 20 22 64 69 73 74 63 6c 65 61  de}" = "distclea
0250: 6e 22 20 5d 3b 20 74 68 65 6e 0a 09 09 72 6d 20  n" ]; then...rm 
0260: 2d 72 66 20 22 24 7b 70 6b 67 7d 2f 73 72 63 22  -rf "${pkg}/src"
0270: 0a 09 66 69 0a 64 6f 6e 65 0a 0a 23 20 57 65 27  ..fi.done..# We'
0280: 72 65 20 61 6c 6c 20 64 6f 6e 65 20 69 66 20 77  re all done if w
0290: 65 27 72 65 20 69 6e 20 63 6c 65 61 6e 20 6f 72  e're in clean or
02a0: 20 64 69 73 74 63 6c 65 61 6e 20 6d 6f 64 65 0a   distclean mode.
02b0: 69 66 20 5b 20 22 24 7b 6d 6f 64 65 7d 22 20 3d  if [ "${mode}" =
02c0: 20 22 63 6c 65 61 6e 22 20 2d 6f 20 22 24 7b 6d   "clean" -o "${m
02d0: 6f 64 65 7d 22 20 3d 20 22 64 69 73 74 63 6c 65  ode}" = "distcle
02e0: 61 6e 22 20 5d 3b 20 74 68 65 6e 0a 09 72 6d 20  an" ]; then..rm 
02f0: 2d 66 20 74 63 6c 6b 69 74 2d 2a 0a 09 72 6d 20  -f tclkit-*..rm 
0300: 2d 66 20 6c 69 62 74 63 6c 6b 69 74 2a 2e 2a 0a  -f libtclkit*.*.
0310: 0a 09 65 78 69 74 20 30 0a 66 69 0a 0a 23 20 41  ..exit 0.fi..# A
0320: 64 64 20 70 61 63 6b 61 67 65 73 20 69 6d 70 6c  dd packages impl
0330: 69 65 64 20 62 79 20 74 68 65 20 61 64 64 69 74  ied by the addit
0340: 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74 73 0a  ional arguments.
0350: 69 66 20 5b 20 2d 7a 20 22 24 7b 4b 49 54 43 52  if [ -z "${KITCR
0360: 45 41 54 4f 52 5f 50 4b 47 53 7d 22 20 5d 3b 20  EATOR_PKGS}" ]; 
0370: 74 68 65 6e 0a 09 4b 49 54 43 52 45 41 54 4f 52  then..KITCREATOR
0380: 5f 50 4b 47 53 3d 22 74 6b 20 69 74 63 6c 20 6d  _PKGS="tk itcl m
0390: 6b 34 74 63 6c 22 0a 66 69 0a 0a 43 4f 4e 46 49  k4tcl".fi..CONFI
03a0: 47 55 52 45 45 58 54 52 41 3d 22 24 40 22 0a 65  GUREEXTRA="$@".e
03b0: 78 70 6f 72 74 20 43 4f 4e 46 49 47 55 52 45 45  xport CONFIGUREE
03c0: 58 54 52 41 0a 0a 69 66 20 65 63 68 6f 20 22 20  XTRA..if echo " 
03d0: 24 7b 43 4f 4e 46 49 47 55 52 45 45 58 54 52 41  ${CONFIGUREEXTRA
03e0: 7d 20 22 20 7c 20 67 72 65 70 20 27 20 2d 2d 65  } " | grep ' --e
03f0: 6e 61 62 6c 65 2d 74 68 72 65 61 64 73 27 20 3e  nable-threads' >
0400: 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 2f 64 65 76  /dev/null 2>/dev
0410: 2f 6e 75 6c 6c 3b 20 74 68 65 6e 0a 09 4b 49 54  /null; then..KIT
0420: 43 52 45 41 54 4f 52 5f 50 4b 47 53 3d 22 24 7b  CREATOR_PKGS="${
0430: 4b 49 54 43 52 45 41 54 4f 52 5f 50 4b 47 53 7d  KITCREATOR_PKGS}
0440: 20 74 68 72 65 61 64 22 0a 66 69 0a 0a 23 20 53   thread".fi..# S
0450: 65 74 20 64 65 66 61 75 6c 74 20 74 61 72 67 65  et default targe
0460: 74 0a 4b 49 54 54 41 52 47 45 54 3d 22 6b 69 74  t.KITTARGET="kit
0470: 73 68 22 0a 65 78 70 6f 72 74 20 4b 49 54 54 41  sh".export KITTA
0480: 52 47 45 54 0a 0a 23 20 46 69 78 20 75 70 20 70  RGET..# Fix up p
0490: 61 63 6b 61 67 65 20 6c 69 73 74 0a 23 23 20 49  ackage list.## I
04a0: 66 20 62 75 69 6c 64 69 6e 67 20 4b 69 74 44 4c  f building KitDL
04b0: 4c 2c 20 64 65 66 69 6e 65 20 69 74 20 61 73 20  L, define it as 
04c0: 6f 75 72 20 74 61 72 67 65 74 0a 69 66 20 65 63  our target.if ec
04d0: 68 6f 20 22 20 24 7b 4b 49 54 43 52 45 41 54 4f  ho " ${KITCREATO
04e0: 52 5f 50 4b 47 53 7d 20 22 20 7c 20 67 72 65 70  R_PKGS} " | grep
04f0: 20 27 20 6b 69 74 64 6c 6c 20 27 20 3e 2f 64 65   ' kitdll ' >/de
0500: 76 2f 6e 75 6c 6c 20 32 3e 2f 64 65 76 2f 6e 75  v/null 2>/dev/nu
0510: 6c 6c 3b 20 74 68 65 6e 0a 09 4b 49 54 43 52 45  ll; then..KITCRE
0520: 41 54 4f 52 5f 50 4b 47 53 3d 22 24 28 65 63 68  ATOR_PKGS="$(ech
0530: 6f 20 22 20 24 7b 4b 49 54 43 52 45 41 54 4f 52  o " ${KITCREATOR
0540: 5f 50 4b 47 53 7d 20 22 20 7c 20 73 65 64 20 27  _PKGS} " | sed '
0550: 73 40 20 6b 69 74 64 6c 6c 20 40 20 40 67 3b 73  s@ kitdll @ @g;s
0560: 40 5e 20 20 2a 40 40 3b 73 40 20 20 2a 24 40 40  @^  *@@;s@  *$@@
0570: 3b 73 40 20 20 20 2a 40 20 40 67 27 29 22 0a 09  ;s@   *@ @g')"..
0580: 4b 49 54 54 41 52 47 45 54 3d 22 6b 69 74 64 6c  KITTARGET="kitdl
0590: 6c 22 0a 66 69 0a 0a 23 23 20 49 66 20 62 75 69  l".fi..## If bui
05a0: 6c 64 69 6e 67 20 4b 69 74 44 4c 4c 20 61 6e 64  lding KitDLL and
05b0: 20 54 6b 2c 20 6d 75 73 74 20 64 6f 20 54 6b 20   Tk, must do Tk 
05c0: 73 74 61 74 69 63 61 6c 6c 79 0a 23 23 23 20 28  statically.### (
05d0: 57 65 6c 6c 2c 20 77 65 20 64 6f 6e 27 74 20 48  Well, we don't H
05e0: 41 56 45 20 74 6f 2c 20 62 75 74 20 69 74 20 77  AVE to, but it w
05f0: 6f 75 6c 64 20 64 65 66 65 61 74 20 6d 75 63 68  ould defeat much
0600: 20 6f 66 20 74 68 65 20 70 75 72 70 6f 73 65 29   of the purpose)
0610: 0a 69 66 20 5b 20 22 24 7b 4b 49 54 54 41 52 47  .if [ "${KITTARG
0620: 45 54 7d 22 20 3d 20 22 6b 69 74 64 6c 6c 22 20  ET}" = "kitdll" 
0630: 5d 3b 20 74 68 65 6e 0a 09 69 66 20 65 63 68 6f  ]; then..if echo
0640: 20 22 20 24 7b 4b 49 54 43 52 45 41 54 4f 52 5f   " ${KITCREATOR_
0650: 50 4b 47 53 7d 20 22 20 7c 20 67 72 65 70 20 27  PKGS} " | grep '
0660: 20 74 6b 20 27 20 3e 2f 64 65 76 2f 6e 75 6c 6c   tk ' >/dev/null
0670: 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 3b 20 74 68   2>/dev/null; th
0680: 65 6e 0a 09 09 69 66 20 5b 20 22 24 7b 53 54 41  en...if [ "${STA
0690: 54 49 43 54 4b 7d 22 20 21 3d 20 22 31 22 20 2d  TICTK}" != "1" -
06a0: 61 20 22 24 7b 53 54 41 54 49 43 54 4b 7d 22 20  a "${STATICTK}" 
06b0: 21 3d 20 22 2d 31 22 20 5d 3b 20 74 68 65 6e 0a  != "-1" ]; then.
06c0: 09 09 09 65 63 68 6f 20 27 57 61 72 6e 69 6e 67  ...echo 'Warning
06d0: 3a 20 4c 69 6e 6b 69 6e 67 20 54 6b 20 73 74 61  : Linking Tk sta
06e0: 74 69 63 61 6c 6c 79 20 62 65 63 61 75 73 65 20  tically because 
06f0: 79 6f 75 20 61 72 65 20 62 75 69 6c 64 69 6e 67  you are building
0700: 20 4b 69 74 44 4c 4c 27 20 32 3e 26 31 0a 09 09   KitDLL' 2>&1...
0710: 09 65 63 68 6f 20 27 20 20 20 20 20 20 20 20 20  .echo '         
0720: 53 65 74 20 53 54 41 54 49 43 54 4b 20 74 6f 20  Set STATICTK to 
0730: 2d 31 20 69 66 20 79 6f 75 20 72 65 61 6c 6c 79  -1 if you really
0740: 20 77 61 6e 74 20 74 6f 20 6c 69 6e 6b 20 54 6b   want to link Tk
0750: 20 64 79 6e 61 6d 69 63 61 6c 6c 79 2e 27 20 3e   dynamically.' >
0760: 26 32 0a 0a 09 09 09 53 54 41 54 49 43 54 4b 3d  &2.....STATICTK=
0770: 22 31 22 0a 09 09 09 65 78 70 6f 72 74 20 53 54  "1"....export ST
0780: 41 54 49 43 54 4b 0a 09 09 66 69 0a 0a 09 09 69  ATICTK...fi....i
0790: 66 20 5b 20 2d 7a 20 22 24 7b 53 54 41 54 49 43  f [ -z "${STATIC
07a0: 4d 4b 34 7d 22 20 5d 3b 20 74 68 65 6e 0a 09 09  MK4}" ]; then...
07b0: 09 65 63 68 6f 20 27 57 61 72 6e 69 6e 67 3a 20  .echo 'Warning: 
07c0: 4c 69 6e 6b 69 6e 67 20 4d 6b 34 74 63 6c 20 64  Linking Mk4tcl d
07d0: 79 6e 61 6d 69 63 61 6c 6c 79 20 62 65 63 61 75  ynamically becau
07e0: 73 65 20 79 6f 75 20 61 72 65 20 62 75 69 6c 64  se you are build
07f0: 69 6e 67 20 4b 69 74 44 4c 4c 27 20 32 3e 26 31  ing KitDLL' 2>&1
0800: 0a 09 09 09 65 63 68 6f 20 27 20 20 20 20 20 20  ....echo '      
0810: 20 20 20 53 65 74 20 53 54 41 54 49 43 4d 4b 34     Set STATICMK4
0820: 20 74 6f 20 31 20 69 66 20 79 6f 75 20 72 65 61   to 1 if you rea
0830: 6c 6c 79 20 77 61 6e 74 20 74 6f 20 6c 69 6e 6b  lly want to link
0840: 20 4d 6b 34 74 63 6c 20 73 74 61 74 69 63 61 6c   Mk4tcl statical
0850: 6c 79 2e 27 20 3e 26 32 0a 0a 09 09 09 53 54 41  ly.' >&2.....STA
0860: 54 49 43 4d 4b 34 3d 22 30 22 0a 09 09 09 65 78  TICMK4="0"....ex
0870: 70 6f 72 74 20 53 54 41 54 49 43 4d 4b 34 0a 09  port STATICMK4..
0880: 09 66 69 0a 09 66 69 0a 66 69 0a 0a 66 61 69 6c  .fi..fi.fi..fail
0890: 65 64 70 6b 67 73 3d 22 22 0a 62 75 69 6c 64 66  edpkgs="".buildf
08a0: 61 69 6c 65 64 3d 22 30 22 0a 66 6f 72 20 70 6b  ailed="0".for pk
08b0: 67 20 69 6e 20 74 63 6c 20 74 63 6c 76 66 73 20  g in tcl tclvfs 
08c0: 7a 6c 69 62 20 24 7b 4b 49 54 43 52 45 41 54 4f  zlib ${KITCREATO
08d0: 52 5f 50 4b 47 53 7d 20 22 24 7b 4b 49 54 54 41  R_PKGS} "${KITTA
08e0: 52 47 45 54 7d 22 3b 20 64 6f 0a 09 65 63 68 6f  RGET}"; do..echo
08f0: 20 2d 6e 20 22 42 75 69 6c 64 69 6e 67 20 24 7b   -n "Building ${
0900: 70 6b 67 7d 20 2e 2e 2e 22 0a 0a 09 66 61 69 6c  pkg} ..."...fail
0910: 65 64 3d 22 30 22 0a 09 28 0a 09 09 63 64 20 22  ed="0"..(...cd "
0920: 24 7b 70 6b 67 7d 22 20 3e 2f 64 65 76 2f 6e 75  ${pkg}" >/dev/nu
0930: 6c 6c 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 20 7c  ll 2>/dev/null |
0940: 7c 20 65 78 69 74 20 31 0a 0a 09 09 2e 2f 62 75  | exit 1...../bu
0950: 69 6c 64 2e 73 68 20 3e 20 62 75 69 6c 64 2e 6c  ild.sh > build.l
0960: 6f 67 20 32 3e 26 31 20 7c 7c 20 65 78 69 74 20  og 2>&1 || exit 
0970: 31 0a 09 29 20 7c 7c 20 66 61 69 6c 65 64 3d 22  1..) || failed="
0980: 31 22 0a 0a 09 69 66 20 5b 20 22 24 7b 66 61 69  1"...if [ "${fai
0990: 6c 65 64 7d 22 20 3d 20 22 31 22 20 5d 3b 20 74  led}" = "1" ]; t
09a0: 68 65 6e 0a 09 09 65 63 68 6f 20 22 20 66 61 69  hen...echo " fai
09b0: 6c 65 64 2e 22 0a 09 09 66 61 69 6c 65 64 70 6b  led."...failedpk
09c0: 67 73 3d 22 24 7b 66 61 69 6c 65 64 70 6b 67 73  gs="${failedpkgs
09d0: 7d 20 24 7b 70 6b 67 7d 22 0a 09 65 6c 73 65 0a  } ${pkg}"..else.
09e0: 09 09 65 63 68 6f 20 22 20 64 6f 6e 65 2e 22 0a  ..echo " done.".
09f0: 09 66 69 0a 0a 09 63 61 73 65 20 22 24 7b 70 6b  .fi...case "${pk
0a00: 67 7d 22 20 69 6e 0a 09 09 74 63 6c 29 0a 09 09  g}" in...tcl)...
0a10: 09 54 43 4c 43 4f 4e 46 49 47 44 49 52 3d 24 28  .TCLCONFIGDIR=$(
0a20: 66 69 6e 64 20 22 24 28 70 77 64 29 2f 74 63 6c  find "$(pwd)/tcl
0a30: 2f 62 75 69 6c 64 22 20 2d 6e 61 6d 65 20 74 63  /build" -name tc
0a40: 6c 43 6f 6e 66 69 67 2e 73 68 20 7c 20 68 65 61  lConfig.sh | hea
0a50: 64 20 2d 31 20 7c 20 73 65 64 20 27 73 40 2f 5b  d -1 | sed 's@/[
0a60: 5e 2f 5d 2a 24 40 40 27 29 0a 09 09 09 65 78 70  ^/]*$@@')....exp
0a70: 6f 72 74 20 54 43 4c 43 4f 4e 46 49 47 44 49 52  ort TCLCONFIGDIR
0a80: 0a 09 09 09 3b 3b 0a 09 65 73 61 63 0a 0a 09 69  ....;;..esac...i
0a90: 66 20 5b 20 22 24 7b 66 61 69 6c 65 64 7d 22 20  f [ "${failed}" 
0aa0: 3d 20 22 31 22 20 5d 3b 20 74 68 65 6e 0a 09 09  = "1" ]; then...
0ab0: 62 75 69 6c 64 66 61 69 6c 65 64 3d 22 31 22 0a  buildfailed="1".
0ac0: 09 66 69 0a 64 6f 6e 65 0a 0a 69 66 20 5b 20 2d  .fi.done..if [ -
0ad0: 6e 20 22 24 7b 66 61 69 6c 65 64 70 6b 67 73 7d  n "${failedpkgs}
0ae0: 22 20 5d 3b 20 74 68 65 6e 0a 09 65 63 68 6f 20  " ]; then..echo 
0af0: 22 46 61 69 6c 65 64 20 74 6f 20 62 75 69 6c 64  "Failed to build
0b00: 3a 24 7b 66 61 69 6c 65 64 70 6b 67 73 7d 22 0a  :${failedpkgs}".
0b10: 66 69 0a 0a 69 66 20 5b 20 22 24 7b 62 75 69 6c  fi..if [ "${buil
0b20: 64 66 61 69 6c 65 64 7d 22 20 21 3d 20 22 30 22  dfailed}" != "0"
0b30: 20 5d 3b 20 74 68 65 6e 0a 09 65 63 68 6f 20 27   ]; then..echo '
0b40: 57 41 52 4e 49 4e 47 3a 20 42 75 69 6c 64 20 69  WARNING: Build i
0b50: 73 20 6c 69 6b 65 6c 79 20 69 6e 63 6f 6d 70 6c  s likely incompl
0b60: 65 74 65 20 6f 72 20 66 61 69 6c 65 64 2e 27 20  ete or failed.' 
0b70: 3e 26 32 0a 66 69 0a 0a 63 70 20 27 6b 69 74 64  >&2.fi..cp 'kitd
0b80: 6c 6c 2f 62 75 69 6c 64 27 2f 6b 69 74 64 6c 6c  ll/build'/kitdll
0b90: 2d 2a 2f 6c 69 62 74 63 6c 6b 69 74 2a 20 2e 20  -*/libtclkit* . 
0ba0: 3e 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e 2f 64 65  >/dev/null 2>/de
0bb0: 76 2f 6e 75 6c 6c 0a 63 70 20 27 6b 69 74 73 68  v/null.cp 'kitsh
0bc0: 2f 62 75 69 6c 64 27 2f 6b 69 74 73 68 2d 2a 2f  /build'/kitsh-*/
0bd0: 6b 69 74 20 22 74 63 6c 6b 69 74 2d 24 7b 54 43  kit "tclkit-${TC
0be0: 4c 56 45 52 53 7d 22 20 3e 2f 64 65 76 2f 6e 75  LVERS}" >/dev/nu
0bf0: 6c 6c 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 0a 0a  ll 2>/dev/null..
0c00: 65 78 69 74 20 22 24 7b 62 75 69 6c 64 66 61 69  exit "${buildfai
0c10: 6c 65 64 7d 22 0a                                led}".