ADDED .fossil-settings/crnl-glob Index: .fossil-settings/crnl-glob ================================================================== --- /dev/null +++ .fossil-settings/crnl-glob @@ -0,0 +1,2 @@ +tcc/patches/all/tcltcc-0.4-fixloading.diff +tcc/patches/all/tcltcc-0.4-setincpath.diff ADDED .fossil-settings/ignore-glob Index: .fossil-settings/ignore-glob ================================================================== --- /dev/null +++ .fossil-settings/ignore-glob @@ -0,0 +1,122 @@ +build/test/kits +build/test/kits/* +build/web/queue +build/web/kitcreator.cgi +build/web/kitcreator.kit +itcl/build +itcl/build/* +itcl/build.log +itcl/inst +itcl/inst/* +itcl/out +itcl/out/* +itcl/src +itcl/src/* +kitsh/build +kitsh/build/* +kitsh/build.log +kitsh/buildsrc/kitsh-0.0/Makefile +kitsh/buildsrc/kitsh-0.0/autom4te.cache +kitsh/buildsrc/kitsh-0.0/autom4te.cache/* +kitsh/buildsrc/kitsh-0.0/boot.tcl.h +kitsh/buildsrc/kitsh-0.0/config.h +kitsh/buildsrc/kitsh-0.0/config.h.in +kitsh/buildsrc/kitsh-0.0/config.log +kitsh/buildsrc/kitsh-0.0/config.status +kitsh/buildsrc/kitsh-0.0/configure +kitsh/buildsrc/kitsh-0.0/kit +kitsh/buildsrc/kitsh-0.0/zipvfs.tcl.h +kitsh/buildsrc/kitsh-0.0/cvfs.tcl.h +kitsh/inst +kitsh/inst/* +kitsh/out +kitsh/out/* +mk4tcl/build +mk4tcl/build/* +mk4tcl/build.log +mk4tcl/inst +mk4tcl/inst/* +mk4tcl/out +mk4tcl/out/* +mk4tcl/src +mk4tcl/src/* +tcl/build +tcl/build/* +tcl/build.log +tcl/inst +tcl/inst/* +tcl/out +tcl/out/* +tcl/src +tcl/src/* +tclkit-* +tclkit-*/* +tclvfs/build +tclvfs/build/* +tclvfs/build.log +tclvfs/inst +tclvfs/inst/* +tclvfs/out +tclvfs/out/* +tclvfs/src +tclvfs/src/* +thread/build +thread/build/* +thread/build.log +thread/inst +thread/inst/* +thread/out +thread/out/* +thread/src +thread/src/* +tk/build +tk/build/* +tk/build.log +tk/inst +tk/inst/* +tk/out +tk/out/* +tk/src +tk/src/* +zlib/build +zlib/build/* +zlib/build.log +zlib/inst +zlib/inst/* +zlib/out +zlib/out/* +zlib/src +zlib/src/* +tcc4tcl/build +tcc4tcl/build/* +tcc4tcl/build.log +tcc4tcl/inst +tcc4tcl/inst/* +tcc4tcl/out +tcc4tcl/out/* +tcc4tcl/src +tcc4tcl/src/* +tls/build +tls/build/* +tls/build.log +tls/inst +tls/inst/* +tls/out +tls/out/* +tls/src +tls/src/* +kitdll/buildsrc/kitdll-0.0/starpack.vfs +kitdll/buildsrc/kitdll-0.0/starpack.vfs/* +kitdll/buildsrc/kitdll-0.0/test +kitdll/buildsrc/kitdll-0.0/configure +kitdll/buildsrc/kitdll-0.0/libtcl*.so +kitdll/buildsrc/kitdll-0.0/Makefile +kitdll/buildsrc/kitdll-0.0/*.o +kitdll/buildsrc/kitdll-0.0/config.log +kitdll/buildsrc/kitdll-0.0/config.status +kitdll/buildsrc/kitdll-0.0/vfs_kitdll_data_tcl.c +kitdll/buildsrc/kitdll-0.0/vfs_kitdll.tcl.h +kitdll/build/kitdll-* +kitdll/build/kitdll-*/* +kitdll/build.log +libtclkit-*.* Index: README ================================================================== --- README +++ README @@ -139,10 +139,40 @@ Additionally, any bundled packages (in the "pkgs" directory) are excluded. This typically includes (as of Tcl 8.6): itcl thread +Cross compiling Environment Variables: + + 1. CC + C compiler e.g. i686-pc-mingw32-gcc + + 2. CXX + C++ compiler. Required if you want to use mk4tcl. e.g. i686-pc-mingw32-g++ + If not required, you can set it to the string "false" + + 3. AR + Library creator e.g. i686-pc-mingw32-ar + + 4. RANLIB + Library post processing executable e.g. i686-pc-mingw32-ranlib + + 5. STRIP + Executable name to strip binaries e.g. i686-pc-mingw32-strip + + 6. NM + Executable used to dump names from the objects e.g. i686-pc-mingw32-nm + + 7. CC_FOR_BUILD, HOST_CC + Set this to the name of compiler on the host on which + the cross compilation is being run. + +On Windows we also need this: + + 1. RC + Resource compiler : e.g. i686-pc-mingw32-windres + Kitsh Configure Options: 1. --enable-kit-storage={zip|mk4|auto} Specify which type of storage to use with the Tclkit. The default is to auto-detect. Auto-detection uses Mk4 if available and built statically, otherwise it falls back to Zip. DELETED build/fake-bin/uname Index: build/fake-bin/uname ================================================================== --- build/fake-bin/uname +++ /dev/null @@ -1,113 +0,0 @@ -#! /usr/bin/env bash - -if [ "$1" == "--fake" ]; then - echo "true" - - exit 0 -fi - -# Some systems do not compile well with this fake uname in place -# provide the real uname for them. -case "${CROSS}" in - mipsel-unknown-linux-uclibc) - unset CROSS - ;; -esac - -if [ -z "${CROSS}" ]; then - # If not cross compiling, revert to system uname - while [ "$(uname --fake 2>/dev/null)" == "true" -a -n "${PATH}" ]; do - PATH="$(echo "${PATH}" | /usr/bin/sed 's@^[^:]*$@@;s@^[^:]*:@@')" - - export PATH - done - - if [ -z "${PATH}" ]; then - exit 1 - fi - - exec uname "$@" -fi - -CROSS="$(echo "${CROSS}" | sed 's@-*$@@')" - -# Determine release information -case "${CROSS}" in - *-hpux11*) - sysname="HP-UX" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-hpux@@')" - ;; - *-solaris2*) - sysname="SunOS" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-solaris@@;s@^2@5@')" - ;; - *-linux*) - sysname="Linux" - sysrelease="2.6.5" - ;; - *-netbsd*) - sysname="NetBSD" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-netbsd@@;s@$@.0@')" - ;; - *-freebsd*) - sysname="FreeBSD" - sysrelease="$(echo "${CROSS}" | sed 's@^.*-freebsd@@;s@$@.0-RELEASE@')" - ;; -esac - -# Determine machine information -case "${CROSS}" in - hppa64-*-hpux*) - sysmachine="9000/859" - ;; - i386-*-solaris*) - sysmachine="i86pc" - ;; - sparc-*-solaris*) - sysmachine="sun4u" - ;; - x86_64-*) - sysmachine="x86_64" - ;; - i?86-*) - sysmachine="i686" - ;; - ia64-*) - sysmachine="ia64" - ;; - arm-*|armel-*|armeb-*) - sysmachine="armv7l" - ;; - mipsel-*|mipseb-*) - sysmachine="mips" - ;; -esac - -for arg in $(echo "$@" | sed 's@.@ & @g'); do - case "${arg}" in - -) - continue - ;; - r) - retval="${retval} ${sysrelease}" - ;; - s) - retval="${retval} ${sysname}" - ;; - m) - retval="${retval} ${sysmachine}" - ;; - p) - # XXX - retval="${retval} ${syscpu}" - ;; - n) - retval="${retval} $(hostname)" - ;; - a) - retval="${sysname} $(hostname) ${sysrelease} ${sysversion} ${sysmachine} ${syscpu}" - ;; - esac -done - -echo "${retval}" | sed 's@^ *@@;s@ *$@@' Index: build/make-kit-android-arm ================================================================== --- build/make-kit-android-arm +++ build/make-kit-android-arm @@ -1,6 +1,6 @@ #! /bin/sh CROSS="arm-android9-linux-androideabi" export CROSS -./build/make-kit-crosscompile "$@" +./build/make-kit-crosscompile "$@" LDFLAGS=-static-libgcc Index: build/make-kit-crosscompile ================================================================== --- build/make-kit-crosscompile +++ build/make-kit-crosscompile @@ -7,11 +7,11 @@ fi CCROOT="${HOME}/root/cross-compilers/${CROSS}" CCROOTBIN="${CCROOT}/bin" -PATH="$(pwd)/build/fake-bin:${PATH}:${CCROOTBIN}" +PATH="${PATH}:${CCROOTBIN}" AR="${CCROOTBIN}/${CROSS}-ar" CC="${CCROOTBIN}/${CROSS}-gcc ${CC_ADD}" CXX="${CCROOTBIN}/${CROSS}-g++ ${CC_ADD}" RANLIB="${CCROOTBIN}/${CROSS}-ranlib" if [ -z "${STRIP}" ]; then Index: build/make-kit-linux-amd64 ================================================================== --- build/make-kit-linux-amd64 +++ build/make-kit-linux-amd64 @@ -1,7 +1,7 @@ #! /bin/sh -CROSS="x86_64-slackware-linux" +CROSS="x86_64-redhat5-linux" CC_ADD="-m64" export CROSS CC_ADD ./build/make-kit-crosscompile "$@" --enable-64bit ADDED build/make-kit-linux-arm Index: build/make-kit-linux-arm ================================================================== --- /dev/null +++ build/make-kit-linux-arm @@ -0,0 +1,6 @@ +#! /bin/sh + +CROSS="arm-slackware-linux-gnueabi" +export CROSS + +./build/make-kit-crosscompile "$@" Index: build/make-kit-linux-i386 ================================================================== --- build/make-kit-linux-i386 +++ build/make-kit-linux-i386 @@ -1,6 +1,7 @@ #! /bin/sh -CROSS="i486-slackware-linux" -export CROSS +CROSS="x86_64-redhat5-linux" +CC_ADD='-m32' +export CROSS CC_ADD ./build/make-kit-crosscompile "$@" Index: build/make-kit-linux-mipsel ================================================================== --- build/make-kit-linux-mipsel +++ build/make-kit-linux-mipsel @@ -1,6 +1,9 @@ #! /bin/sh -CROSS="mipsel-unknown-linux-uclibc" -export CROSS +CROSS="mips-unknown-linux-musl" +if ! echo " ${KITCREATOR_PKGS} " | grep ' kitdll ' >/dev/null; then + KC_KITSH_LDFLAGS="${KC_KITSH_FLAGS} -static" +fi +export CROSS KC_KITSH_LDFLAGS ./build/make-kit-crosscompile "$@" Index: build/make-minkit-static ================================================================== --- build/make-minkit-static +++ build/make-minkit-static @@ -1,16 +1,9 @@ #! /bin/sh # Set C compiler to diet libc -CC='diet gcc' +CC='x86_64-slackware-linux-musl-gcc' export CC -cat << \__EOF__ > tcl/patchscripts/dietlibc.sh -sed 's@^# *include *$@&@;T s;p;s@string.h@strings.h@;:s' generic/tclInt.h > generic/tclInt.h.new && cat generic/tclInt.h.new > generic/tclInt.h -rm -f generic/tclInt.h.new -__EOF__ - ./build/make-minkit "$@" --disable-load --disable-threads -rm -f tcl/patchscripts/dietlibc.sh - exit 0 Index: build/makearch.info ================================================================== --- build/makearch.info +++ build/makearch.info @@ -14,11 +14,11 @@ # each time a "makearch" is done. # # If @@SVNLCR@@ is used anywhere in this version number, it will be # replaced with the highest last-changed-rev from the output of # svn info -R (or 0) -VERS="0.7.0" +VERS="0.9.0" # Space sperated list of documents, if they exist, they will be # prefixed with the contents of the DOC_HDR file and substitution # will occur: # @@UTIL@@ becomes the utility name ${UTIL} Index: build/test/test ================================================================== --- build/test/test +++ build/test/test @@ -1,8 +1,8 @@ #! /bin/bash -VERSIONS="8.5.15 8.6.1 cvs_HEAD" +VERSIONS="8.5.15 8.6.2 cvs_HEAD" # Find the base directory for x in 1 2 3 4 __fail__; do if [ "${x}" = "__fail__" ]; then echo 'Unable to find KitCreator, aborting.' >&2 @@ -67,14 +67,14 @@ echo "$!" )" DISPLAY=:31 export DISPLAY -if [ "${BIGBUILD}" = "1" ]; then - kits="$(echo normal{,-zip,-nomk4}{,-threaded}{,-statictk,-notk} normal{,-threaded}{,-notk}{,-nomk4}{,-debug}-kitdll win32-i586{,-zip,-nomk4}{,-threaded}{,-notk} win32-i586{,-threaded}{,-notk}{,-nomk4}-kitdll min{,-static} {linux-mipsel-min}{,-debug}{,-kitdll} {linux-i386,solaris-i386,solaris-amd64,solaris-sparc,solaris-sparc64,freebsd-amd64,netbsd-amd64}{,-zip,-nomk4}{,-threaded}{,-statictk,-notk}{,debug} {solaris-i386,solaris-amd64,solaris-sparc,solaris-sparc64,freebsd-amd64,netbsd-amd64}{,-threaded}{,-notk}{,-nomk4}{,debug}-kitdll netbsd-i386{,-zip,-nomk4}{,-threaded}{,debug}-notk netbsd-i386{,-threaded}{,-nomk4}{,debug}-notk-kitdll android-arm-notk{,-debug} andoid-arm-notk{,-debug}-kitdll)" +if [ -z "${KC_TEST_KITS}" ]; then + kits="linux-amd64 linux-amd64-zip linux-amd64-threaded linux-amd64-threaded-zip linux-amd64-statictk linux-amd64-notk linux-amd64-threaded-notk linux-amd64-threaded-zip-notk linux-amd64-nomk4 linux-amd64-debug min min-static linux-amd64-kitdll linux-amd64-threaded-kitdll linux-amd64-notk-kitdll linux-amd64-nomk4-kitdll linux-amd64-nomk4-notk-kitdll linux-amd64-threaded-nomk4-kitdll linux-amd64-threaded-notk-nomk4-kitdll linux-amd64-debug-kitdll min-kitdll win32-i586 win32-i586-zip win32-i586-threaded win32-i586-threaded-zip win32-i586-notk win32-i586-threaded-notk win32-i586-nomk4 win32-i586-kitdll win32-i586-threaded-kitdll win32-i586-notk-kitdll win32-i586-nomk4-kitdll win32-i586-nomk4-notk-kitdll win32-i586-threaded-nomk4-kitdll win32-i586-threaded-notk-nomk4-kitdll win64-amd64 win64-amd64-zip win64-amd64-threaded win64-amd64-threaded-zip win64-amd64-notk win64-amd64-threaded-notk win64-amd64-nomk4 win64-amd64-kitdll win64-amd64-threaded-kitdll win64-amd64-notk-kitdll win64-amd64-nomk4-kitdll win64-amd64-nomk4-notk-kitdll win64-amd64-threaded-nomk4-kitdll win64-amd64-threaded-notk-nomk4-kitdll linux-mipsel-notk linux-mipsel-notk-kitdll linux-i386 linux-i386-debug linux-i386-kitdll linux-i386-debug-kitdll linux-i386-notk linux-i386-notk-debug linux-i386-notk-kitdll linux-i386-notk-debug-kitdll solaris-i386 solaris-i386-debug solaris-i386-kitdll solaris-i386-debug-kitdll solaris-amd64 solaris-amd64-debug solaris-amd64-kitdll solaris-amd64-debug-kitdll solaris-sparc solaris-sparc-debug solaris-sparc-kitdll solaris-sparc-debug-kitdll solaris-sparc64 solaris-sparc64-debug solaris-sparc64-kitdll solaris-sparc64-debug-kitdll freebsd-amd64 freebsd-amd64-debug freebsd-amd64-kitdll freebsd-amd64-debug-kitdll netbsd-i386-notk netbsd-i386-notk-debug netbsd-i386-notk-kitdll netbsd-i386-notk-debug-kitdll netbsd-amd64 netbsd-amd64-debug netbsd-amd64-kitdll netbsd-amd64-debug-kitdll android-arm-notk android-arm-notk-debug android-arm-notk-kitdll android-arm-notk-debug-kitdll" else - kits="normal normal-zip normal-threaded normal-threaded-zip normal-statictk normal-notk normal-threaded-notk normal-threaded-zip-notk normal-nomk4 normal-debug min min-static normal-kitdll normal-threaded-kitdll normal-notk-kitdll normal-nomk4-kitdll normal-nomk4-notk-kitdll normal-threaded-nomk4-kitdll normal-threaded-notk-nomk4-kitdll normal-debug-kitdll min-kitdll win32-i586 win32-i586-zip win32-i586-threaded win32-i586-threaded-zip win32-i586-notk win32-i586-threaded-notk win32-i586-nomk4 win32-i586-kitdll win32-i586-threaded-kitdll win32-i586-notk-kitdll win32-i586-nomk4-kitdll win32-i586-nomk4-notk-kitdll win32-i586-threaded-nomk4-kitdll win32-i586-threaded-notk-nomk4-kitdll win64-amd64 win64-amd64-zip win64-amd64-threaded win64-amd64-threaded-zip win64-amd64-notk win64-amd64-threaded-notk win64-amd64-nomk4 win64-amd64-kitdll win64-amd64-threaded-kitdll win64-amd64-notk-kitdll win64-amd64-nomk4-kitdll win64-amd64-nomk4-notk-kitdll win64-amd64-threaded-nomk4-kitdll win64-amd64-threaded-notk-nomk4-kitdll linux-mipsel-notk linux-mipsel-notk-kitdll linux-i386 linux-i386-debug linux-i386-kitdll linux-i386-debug-kitdll linux-i386-notk linux-i386-notk-debug linux-i386-notk-kitdll linux-i386-notk-debug-kitdll solaris-i386 solaris-i386-debug solaris-i386-kitdll solaris-i386-debug-kitdll solaris-amd64 solaris-amd64-debug solaris-amd64-kitdll solaris-amd64-debug-kitdll solaris-sparc solaris-sparc-debug solaris-sparc-kitdll solaris-sparc-debug-kitdll solaris-sparc64 solaris-sparc64-debug solaris-sparc64-kitdll solaris-sparc64-debug-kitdll freebsd-amd64 freebsd-amd64-debug freebsd-amd64-kitdll freebsd-amd64-debug-kitdll netbsd-i386-notk netbsd-i386-notk-debug netbsd-i386-notk-kitdll netbsd-i386-notk-debug-kitdll netbsd-amd64 netbsd-amd64-debug netbsd-amd64-kitdll netbsd-amd64-debug-kitdll android-arm-notk android-arm-notk-debug android-arm-notk-kitdll android-arm-notk-debug-kitdll" + kits="${KC_TEST_KITS}" fi failed="" for kit in $kits; do kitcreator="./kitcreator" @@ -112,11 +112,11 @@ xcompile="1" runnable="1" kitruncmd="wine" ;; win64|win64-*) - kitcreator="./build/make-kit-win32" + kitcreator="./build/make-kit-win64" xcompile="1" runnable="1" kitruncmd="wine64" ;; linux-mipsel-min|linux-mipsel-min-kitdll) @@ -123,18 +123,23 @@ kitcreator="./build/make-kit-linux-mipsel" runnable="0" xcompile="1" notk="1" iszip="1" + ;; + linux-amd64|linux-amd64-*) + kitcreator="./build/make-kit-linux-amd64" + xcompile="0" + runnable="1" ;; linux-i386|linux-i386-*) kitcreator="./build/make-kit-linux-i386" xcompile="1" + runnable="0" ;; android-arm|android-arm-*|\ linux-mipsel|linux-mipsel-*|\ - linux-amd64|linux-amd64-*|\ solaris-i386|solaris-i386-*|\ solaris-amd64|solaris-amd64-*|\ solaris-sparc|solaris-sparc-*|\ solaris-sparc64|solaris-sparc64-*|\ freebsd-amd64|freebsd-amd64-*|\ @@ -219,14 +224,16 @@ iszip="0" fi for version in ${VERSIONS}; do # Work around changes in default behaviour - if [ "${version}" = "cvs_HEAD" ]; then - kit="$(echo "${kit}" | sed 's@-threaded@-unthreaded@')" - args="$(echo "${args}" | sed 's@ --enable-threads@ --disable-threads@')" - fi + case "${version}" in + 8.6.*|cvs_HEAD) + kit="$(echo "${kit}" | sed 's@-threaded@-unthreaded@')" + args="$(echo "${args}" | sed 's@ --enable-threads@ --disable-threads@')" + ;; + esac # Create Tclkit if [ "${kitdll}" = "1" ]; then createdkit="libtclkit*.dll libtclkit*.*" outputname="${TESTDIR}/kits/libtclkit-${version}-${kit}" Index: build/web/Makefile ================================================================== --- build/web/Makefile +++ build/web/Makefile @@ -1,15 +1,23 @@ STARKIT2EXE = ../../../starkit2exe/starkit2exe RIVET2STARKIT = ../../../rivet/bin/rivet2starkit +WEBDIR = /web/customers/kitcreator.rkeene.org +WEBKITSDIR = $(WEBDIR)/kits kitcreator.cgi: kitcreator.kit $(STARKIT2EXE) kitcreator.kit kitcreator.cgi kitcreator.kit: kitcreator.vfs kitcreator.vfs/index.rvt $(RIVET2STARKIT) tclkit kitcreator.kit kitcreator.vfs +install: kitcreator.cgi building.cgi + mkdir -p '$(WEBDIR)' '$(WEBKITSDIR)' + cp kitcreator.cgi '$(WEBDIR)/' + cp building.cgi '$(WEBKITSDIR)/' + echo -n > '${WEBKITSDIR}/index.html' + clean: rm -f kitcreator.kit kitcreator.cgi distclean: clean -.PHONY: clean distclean +.PHONY: clean distclean install ADDED build/web/building.cgi Index: build/web/building.cgi ================================================================== --- /dev/null +++ build/web/building.cgi @@ -0,0 +1,132 @@ +#! /usr/bin/env tclsh + +set outdir "/web/customers/kitcreator.rkeene.org/kits" +set key "" +if {[info exists ::env(PATH_INFO)]} { + set key [lindex [split $::env(PATH_INFO) "/"] 1] +} + +set status "Unknown" +set terminal 0 +if {![regexp {^[0-9a-f]+$} $key]} { + set status "Invalid Key" + + unset key +} + +if {[info exists key]} { + set workdir [file join $outdir $key] +} + +if {[info exists workdir]} { + if {[file exists $workdir]} { + set fd [open [file join $workdir buildinfo]] + set buildinfo_list [gets $fd] + close $fd + array set buildinfo $buildinfo_list + set filename $buildinfo(filename) + + set outfile [file join $workdir $filename] + set logfile "${outfile}.log" + } else { + set status "Queued" + } +} + +if {[info exists buildinfo]} { + set description "Tcl $buildinfo(tcl_version)" + append description ", KitCreator $buildinfo(kitcreator_version)" + append description ", Platform $buildinfo(platform)" + + foreach {option value} $buildinfo(options) { + switch -- $option { + "kitdll" { + if {$value} { + append description ", Built as a Library" + } + } + "threaded" { + if {$value} { + append description ", Threaded" + } else { + append description ", Unthreaded" + } + } + "debug" { + if {$value} { + append description ", With Symbols" + } + } + "storage" { + switch -- $value { + "mk4" { + append description ", Metakit-based" + } + "zip" { + append description ", Zip-kit" + } + "cvfs" { + append description ", Static Storage" + } + } + } + } + } + + if {[llength $buildinfo(packages)] > 0} { + append description ", Packages: [join $buildinfo(packages) {, }]" + } else { + append description ", No packages" + } +} + +if {[info exists outfile]} { + if {[file exists $outfile]} { + set status "Complete" + set terminal 1 + + set url "http://kitcreator.rkeene.org/kits/$key/$filename" + } elseif {[file exists "${outfile}.buildfail"]} { + set status "Failed" + set terminal 1 + } else { + set status "Building" + } +} + +puts "Content-Type: text/html" +if {[info exists url]} { + # Use a refresh here instead of a "Location" so that + # the client can see the page + puts "Refresh: 0;url=$url" +} else { + if {!$terminal} { + puts "Refresh: 30;url=." + } +} +puts "" +puts "" +puts "\t" +puts "\t\tKitCreator, Web Interface" +puts "\t" +puts "\t" +puts "\t\t

KitCreator Web Interface

" +puts "\t\t

Status: $status" +if {[info exists url]} { + puts "\t\t

URL: $url" +} +if {[info exists description]} { + puts "\t\t

Description: $description" +} +if {[info exists logfile]} { + catch { + set fd [open $logfile] + set logdata [read $fd] + close $fd + + + puts "\t\t

Log:

\n$logdata
" + } +} +puts "\t" +puts "" Index: build/web/kitcreator.vfs/index.rvt ================================================================== --- build/web/kitcreator.vfs/index.rvt +++ build/web/kitcreator.vfs/index.rvt @@ -1,52 +1,266 @@ vers set kitcreator_versions($vers) $vers } set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end] set kitcreator_versions(trunk) "Fossil Trunk Tip" - set tcl_versions(8.4.19) 8.4.19 - set tcl_versions(8.5.9) 8.5.9 - set tcl_versions(cvs_HEAD) "Fossil Trunk Tip" - - set platforms(linux-x86) "Linux on x86" - set platforms(linux-amd64) "Linux on amd64" - set platforms(linux-mipsel) "Linux on MIPSEL" - set platforms(windows-x86) "Windows on x86" + set tcl_versions(8.5.15) 8.5.15 + set tcl_versions(8.6.1) 8.6.1 + set tcl_versions(8.6.2) 8.6.2 + set tcl_versions(fossil_trunk) "Fossil Trunk Tip" + + set platforms(android-arm) "Android/ARM" + set platforms(freebsd-amd64) "FreeBSD/amd64" + set platforms(hpux-hppa64) "HP-UX/PA-RISC 2.0" + set platforms(linux-amd64) "Linux/amd64" + set platforms(linux-arm) "Linux/ARM" + set platforms(linux-i386) "Linux/i386" + set platforms(linux-mipsel) "Linux/MIPS" + set platforms(netbsd-amd64) "NetBSD/amd64" + set platforms(netbsd-i386) "NetBSD/i386" + set platforms(solaris-amd64) "Solaris/amd64" + set platforms(solaris-i386) "Solaris/i386" + set platforms(solaris-sparc) "Solaris/SPARC" + set platforms(solaris-sparc64) "Solaris/SPARC64" + set platforms(win32) "Windows/i386" + set platforms(win64) "Windows/amd64" + + set packages(tk) "Tk" + set packages(mk4tcl) "Metakit" + set packages(tcc4tcl) "tcc4tcl" + set packages(tls) TLS + set packages(dbus) D-BUS + set packages(tclx) TclX set disable { - platform linux-amd64 tk - platform linux-mipsel tk + platform linux-mipsel {tk tcc4tcl} + platform android-arm tk + platform netbsd-amd64 {tk tcc4tcl} + platform netbsd-i386 {tk tcc4tcl} + platform solaris-sparc tcc4tcl + platform solaris-sparc64 tcc4tcl + platform hpux-hppa64 tcc4tcl + platform linux-arm tk } set specific { - platform windows-x86 file icon {Kit Icon} - platform windows-x86 text description {Description} + platform win32 file icon {Kit Icon} + platform win32 text description {Description} + platform win64 file icon {Kit Icon} + platform win64 text description {Description} } + + if {[info exists args(platform)] && [info exists args(tcl_version)] && [info exist args(kitcreator_version)]} { + # Read in arguments + ## Mandatory arguments + set build_platform $args(platform) + set build_tcl_version $args(tcl_version) + set build_kitcreator_version $args(kitcreator_version) + + ## Optional Arguments + set build_packages [list] + set build_options(threaded) 0 + set build_options(kitdll) 0 + set build_options(debug) 0 + foreach arg [array names args] { + switch -glob -- $arg { + "option_package_*" { + set package [join [lrange [split $arg _] 2 end] _] + + lappend build_packages $package + } + "option_threaded" { + set build_options(threaded) 1 + } + "option_kitdll" { + set build_options(kitdll) 1 + } + "option_debug" { + set build_options(debug) 1 + } + "option_storage" { + switch -- $args($arg) { + "mk4" - "zip" - "cvfs" { + set build_options(storage) $args($arg) + } + } + } + } + } + set build_packages [lsort -dictionary $build_packages] + + # Validate arguments + if {![info exists platforms($build_platform)]} { + unset build_platform + } + + if {![info exists tcl_versions($build_tcl_version)]} { + unset build_tcl_version + } + + if {![info exists kitcreator_versions($build_kitcreator_version)]} { + unset build_kitcreator_version + } + + foreach package $build_packages { + if {![info exists packages($package)]} { + unset build_packages + + break + } + } + + # Resolve version numbers to checkin IDs + ## XXX: TODO + set cache_tcl_version $build_tcl_version + if {$build_tcl_version == "fossil_trunk"} { + set cache_tcl_version [clock format [clock seconds] -format {%Y%m%d}] + } + + set cache_kitcreator_version $build_kitcreator_version + if {$build_kitcreator_version == "trunk"} { + set cache_kitcreator_version [clock format [clock seconds] -format {%Y%m%d}] + } + + # Generate a serialized hash that represents the state of the build + ## Load a secret so keys cannot be pre-computed (but remain consistent) + set secretfd [open $secretfile "r"] + set secret [gets $secretfd] + close $secretfd + + ## Compute basic key + set key [list $secret $build_platform $cache_tcl_version $cache_kitcreator_version $build_packages] + + ## Update key with options in deterministic order + foreach option [lsort -dictionary [array names build_options]] { + switch -- $option { + "threaded" - "kitdll" - "debug" { + # For boolean options, skip them if they are not enabled + if {!$build_options($option)} { + continue + } + } + } + lappend key [list "option:$option" $build_options($option)] + } + + ## Convert key to a user-consumable string via hashing + set key [string tolower [sha1::sha1 -hex $key]] + + # Determine filename + if {$build_options(kitdll)} { + set extension "so" + switch -- $build_platform { + "win32" - "win64" { + set extension "dll" + } + "hpux-hppa64" { + set extension "sl" + } + } + + ## XXX: TODO: The version here needs to match what's in the SONAME + set filename "libtclkit[string map [list "." ""] ${cache_tcl_version}].${extension}" + } else { + set filename "tclkit" + + switch -- $build_platform { + "win32" - "win64" { + append filename ".exe" + } + } + } + + # Queue build up and wait for it to complete + set fd [open $queue a+] + puts $fd [list filename $filename key $key platform $build_platform tcl_version $build_tcl_version kitcreator_version $build_kitcreator_version packages $build_packages options [array get build_options]] + close $fd + + set url "http://kitcreator.rkeene.org/kits/building/$key/" + + headers redirect $url +?> + + KitCreator, Web Interface + + +

KitCreator Web Interface

+

Build in progress, see for build information

+ + + KitCreator, Web Interface - +

KitCreator Web Interface

@@ -95,29 +309,43 @@ + + + + +
KitCreator Version:
Kit Options: - Tk
- [incr Tcl]
- Metakit
- Threaded
- Build Library (KitDLL)
+ + Package:
+ + Kit: Threaded
+ Kit: Debugging Build
+ Kit: Build Library (KitDLL)
Kit Storage: + +
- + ADDED build/web/kitcreator.vfs/lib/.htaccess Index: build/web/kitcreator.vfs/lib/.htaccess ================================================================== --- /dev/null +++ build/web/kitcreator.vfs/lib/.htaccess @@ -0,0 +1,1 @@ +Deny from all ADDED build/web/kitcreator.vfs/lib/sha1-2.0.3/pkgIndex.tcl Index: build/web/kitcreator.vfs/lib/sha1-2.0.3/pkgIndex.tcl ================================================================== --- /dev/null +++ build/web/kitcreator.vfs/lib/sha1-2.0.3/pkgIndex.tcl @@ -0,0 +1,1 @@ +package ifneeded sha1 2.0.3 [list source [file join $dir sha1.tcl]] ADDED build/web/kitcreator.vfs/lib/sha1-2.0.3/sha1.tcl Index: build/web/kitcreator.vfs/lib/sha1-2.0.3/sha1.tcl ================================================================== --- /dev/null +++ build/web/kitcreator.vfs/lib/sha1-2.0.3/sha1.tcl @@ -0,0 +1,827 @@ +# sha1.tcl - + +# @@ Meta Begin +# Package sha1 2.0.3 +# Meta platform tcl +# Meta rsk::build::date 2011-03-30 +# Meta description Part of the Tclib sha1 module +# Meta require {Tcl 8.2} +# @@ Meta End + +# +# Copyright (C) 2001 Don Libes +# Copyright (C) 2003 Pat Thoyts +# +# SHA1 defined by FIPS 180-1, "The SHA1 Message-Digest Algorithm" +# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication" +# +# This is an implementation of SHA1 based upon the example code given in +# FIPS 180-1 and upon the tcllib MD4 implementation and taking some ideas +# and methods from the earlier tcllib sha1 version by Don Libes. +# +# This implementation permits incremental updating of the hash and +# provides support for external compiled implementations either using +# critcl (sha1c) or Trf. +# +# ref: http://www.itl.nist.gov/fipspubs/fip180-1.htm +# +# ------------------------------------------------------------------------- +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# ------------------------------------------------------------------------- +# +# $Id: sha1.tcl,v 1.22 2009/05/07 00:35:10 patthoyts Exp $ + +# @mdgen EXCLUDE: sha1c.tcl + +package require Tcl 8.2; # tcl minimum version + +namespace eval ::sha1 { + variable version 2.0.3 + variable rcsid {$Id: sha1.tcl,v 1.22 2009/05/07 00:35:10 patthoyts Exp $} + + variable accel + array set accel {tcl 0 critcl 0 cryptkit 0 trf 0} + variable loaded {} + variable active + array set active {tcl 0 critcl 0 cryptkit 0 trf 0} + + namespace export sha1 hmac SHA1Init SHA1Update SHA1Final + + variable uid + if {![info exists uid]} { + set uid 0 + } +} + +# ------------------------------------------------------------------------- +# Management of sha1 implementations. + +# LoadAccelerator -- +# +# This package can make use of a number of compiled extensions to +# accelerate the digest computation. This procedure manages the +# use of these extensions within the package. During normal usage +# this should not be called, but the test package manipulates the +# list of enabled accelerators. +# +proc ::sha1::LoadAccelerator {name} { + variable accel + set r 0 + switch -exact -- $name { + tcl { + # Already present (this file) + set r 1 + } + critcl { + if {![catch {package require tcllibc}] + || ![catch {package require sha1c}]} { + set r [expr {[info command ::sha1::sha1c] != {}}] + } + } + cryptkit { + if {![catch {package require cryptkit}]} { + set r [expr {![catch {cryptkit::cryptInit}]}] + } + } + trf { + if {![catch {package require Trf}]} { + set r [expr {![catch {::sha1 aa} msg]}] + } + } + default { + return -code error "invalid accelerator $key:\ + must be one of [join [KnownImplementations] {, }]" + } + } + set accel($name) $r + return $r +} + +# ::sha1::Implementations -- +# +# Determines which implementations are +# present, i.e. loaded. +# +# Arguments: +# None. +# +# Results: +# A list of implementation keys. + +proc ::sha1::Implementations {} { + variable accel + set res {} + foreach n [array names accel] { + if {!$accel($n)} continue + lappend res $n + } + return $res +} + +# ::sha1::KnownImplementations -- +# +# Determines which implementations are known +# as possible implementations. +# +# Arguments: +# None. +# +# Results: +# A list of implementation keys. In the order +# of preference, most prefered first. + +proc ::sha1::KnownImplementations {} { + return {critcl cryptkit trf tcl} +} + +proc ::sha1::Names {} { + return { + critcl {tcllibc based} + cryptkit {cryptkit based} + trf {Trf based} + tcl {pure Tcl} + } +} + +# ::sha1::SwitchTo -- +# +# Activates a loaded named implementation. +# +# Arguments: +# key Name of the implementation to activate. +# +# Results: +# None. + +proc ::sha1::SwitchTo {key} { + variable accel + variable active + variable loaded + + if {[string equal $key $loaded]} { + # No change, nothing to do. + return + } elseif {![string equal $key ""]} { + # Validate the target implementation of the switch. + + if {![info exists accel($key)]} { + return -code error "Unable to activate unknown implementation \"$key\"" + } elseif {![info exists accel($key)] || !$accel($key)} { + return -code error "Unable to activate missing implementation \"$key\"" + } + } + + if {![string equal $loaded ""]} { + set active($loaded) 0 + } + if {![string equal $key ""]} { + set active($key) 1 + } + + # Remember the active implementation, for deactivation by future + # switches. + + set loaded $key + return +} + +# ------------------------------------------------------------------------- + +# SHA1Init -- +# +# Create and initialize an SHA1 state variable. This will be +# cleaned up when we call SHA1Final +# + +proc ::sha1::SHA1Init {} { + variable active + variable uid + set token [namespace current]::[incr uid] + upvar #0 $token state + + # FIPS 180-1: 7 - Initialize the hash state + array set state \ + [list \ + A [expr {int(0x67452301)}] \ + B [expr {int(0xEFCDAB89)}] \ + C [expr {int(0x98BADCFE)}] \ + D [expr {int(0x10325476)}] \ + E [expr {int(0xC3D2E1F0)}] \ + n 0 i "" ] + if {$active(cryptkit)} { + cryptkit::cryptCreateContext state(ckctx) CRYPT_UNUSED CRYPT_ALGO_SHA + } elseif {$active(trf)} { + set s {} + switch -exact -- $::tcl_platform(platform) { + windows { set s [open NUL w] } + unix { set s [open /dev/null w] } + } + if {$s != {}} { + fconfigure $s -translation binary -buffering none + ::sha1 -attach $s -mode write \ + -read-type variable \ + -read-destination [subst $token](trfread) \ + -write-type variable \ + -write-destination [subst $token](trfwrite) + array set state [list trfread 0 trfwrite 0 trf $s] + } + } + return $token +} + +# SHA1Update -- +# +# This is called to add more data into the hash. You may call this +# as many times as you require. Note that passing in "ABC" is equivalent +# to passing these letters in as separate calls -- hence this proc +# permits hashing of chunked data +# +# If we have a C-based implementation available, then we will use +# it here in preference to the pure-Tcl implementation. +# +proc ::sha1::SHA1Update {token data} { + variable active + upvar #0 $token state + + if {$active(critcl)} { + if {[info exists state(sha1c)]} { + set state(sha1c) [sha1c $data $state(sha1c)] + } else { + set state(sha1c) [sha1c $data] + } + return + } elseif {[info exists state(ckctx)]} { + if {[string length $data] > 0} { + cryptkit::cryptEncrypt $state(ckctx) $data + } + return + } elseif {[info exists state(trf)]} { + puts -nonewline $state(trf) $data + return + } + + # Update the state values + incr state(n) [string length $data] + append state(i) $data + + # Calculate the hash for any complete blocks + set len [string length $state(i)] + for {set n 0} {($n + 64) <= $len} {} { + SHA1Transform $token [string range $state(i) $n [incr n 64]] + } + + # Adjust the state for the blocks completed. + set state(i) [string range $state(i) $n end] + return +} + +# SHA1Final -- +# +# This procedure is used to close the current hash and returns the +# hash data. Once this procedure has been called the hash context +# is freed and cannot be used again. +# +# Note that the output is 160 bits represented as binary data. +# +proc ::sha1::SHA1Final {token} { + upvar #0 $token state + + # Check for either of the C-compiled versions. + if {[info exists state(sha1c)]} { + set r $state(sha1c) + unset state + return $r + } elseif {[info exists state(ckctx)]} { + cryptkit::cryptEncrypt $state(ckctx) "" + cryptkit::cryptGetAttributeString $state(ckctx) \ + CRYPT_CTXINFO_HASHVALUE r 20 + cryptkit::cryptDestroyContext $state(ckctx) + # If nothing was hashed, we get no r variable set! + if {[info exists r]} { + unset state + return $r + } + } elseif {[info exists state(trf)]} { + close $state(trf) + set r $state(trfwrite) + unset state + return $r + } + + # Padding + # + set len [string length $state(i)] + set pad [expr {56 - ($len % 64)}] + if {$len % 64 > 56} { + incr pad 64 + } + if {$pad == 0} { + incr pad 64 + } + append state(i) [binary format a$pad \x80] + + # Append length in bits as big-endian wide int. + set dlen [expr {8 * $state(n)}] + append state(i) [binary format II 0 $dlen] + + # Calculate the hash for the remaining block. + set len [string length $state(i)] + for {set n 0} {($n + 64) <= $len} {} { + SHA1Transform $token [string range $state(i) $n [incr n 64]] + } + + # Output + set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)] + unset state + return $r +} + +# ------------------------------------------------------------------------- +# HMAC Hashed Message Authentication (RFC 2104) +# +# hmac = H(K xor opad, H(K xor ipad, text)) +# + +# HMACInit -- +# +# This is equivalent to the SHA1Init procedure except that a key is +# added into the algorithm +# +proc ::sha1::HMACInit {K} { + + # Key K is adjusted to be 64 bytes long. If K is larger, then use + # the SHA1 digest of K and pad this instead. + set len [string length $K] + if {$len > 64} { + set tok [SHA1Init] + SHA1Update $tok $K + set K [SHA1Final $tok] + set len [string length $K] + } + set pad [expr {64 - $len}] + append K [string repeat \0 $pad] + + # Cacluate the padding buffers. + set Ki {} + set Ko {} + binary scan $K i16 Ks + foreach k $Ks { + append Ki [binary format i [expr {$k ^ 0x36363636}]] + append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]] + } + + set tok [SHA1Init] + SHA1Update $tok $Ki; # initialize with the inner pad + + # preserve the Ko value for the final stage. + # FRINK: nocheck + set [subst $tok](Ko) $Ko + + return $tok +} + +# HMACUpdate -- +# +# Identical to calling SHA1Update +# +proc ::sha1::HMACUpdate {token data} { + SHA1Update $token $data + return +} + +# HMACFinal -- +# +# This is equivalent to the SHA1Final procedure. The hash context is +# closed and the binary representation of the hash result is returned. +# +proc ::sha1::HMACFinal {token} { + upvar #0 $token state + + set tok [SHA1Init]; # init the outer hashing function + SHA1Update $tok $state(Ko); # prepare with the outer pad. + SHA1Update $tok [SHA1Final $token]; # hash the inner result + return [SHA1Final $tok] +} + +# ------------------------------------------------------------------------- +# Description: +# This is the core SHA1 algorithm. It is a lot like the MD4 algorithm but +# includes an extra round and a set of constant modifiers throughout. +# +set ::sha1::SHA1Transform_body { + upvar #0 $token state + + # FIPS 180-1: 7a: Process Message in 16-Word Blocks + binary scan $msg I* blocks + set blockLen [llength $blocks] + for {set i 0} {$i < $blockLen} {incr i 16} { + set W [lrange $blocks $i [expr {$i+15}]] + + # FIPS 180-1: 7b: Expand the input into 80 words + # For t = 16 to 79 + # let Wt = (Wt-3 ^ Wt-8 ^ Wt-14 ^ Wt-16) <<< 1 + set t3 12 + set t8 7 + set t14 1 + set t16 -1 + for {set t 16} {$t < 80} {incr t} { + set x [expr {[lindex $W [incr t3]] ^ [lindex $W [incr t8]] ^ \ + [lindex $W [incr t14]] ^ [lindex $W [incr t16]]}] + lappend W [expr {int(($x << 1) | (($x >> 31) & 1))}] + } + + # FIPS 180-1: 7c: Copy hash state. + set A $state(A) + set B $state(B) + set C $state(C) + set D $state(D) + set E $state(E) + + # FIPS 180-1: 7d: Do permutation rounds + # For t = 0 to 79 do + # TEMP = (A<<<5) + ft(B,C,D) + E + Wt + Kt; + # E = D; D = C; C = S30(B); B = A; A = TEMP; + + # Round 1: ft(B,C,D) = (B & C) | (~B & D) ( 0 <= t <= 19) + for {set t 0} {$t < 20} {incr t} { + set TEMP [F1 $A $B $C $D $E [lindex $W $t]] + set E $D + set D $C + set C [rotl32 $B 30] + set B $A + set A $TEMP + } + + # Round 2: ft(B,C,D) = (B ^ C ^ D) ( 20 <= t <= 39) + for {} {$t < 40} {incr t} { + set TEMP [F2 $A $B $C $D $E [lindex $W $t]] + set E $D + set D $C + set C [rotl32 $B 30] + set B $A + set A $TEMP + } + + # Round 3: ft(B,C,D) = ((B & C) | (B & D) | (C & D)) ( 40 <= t <= 59) + for {} {$t < 60} {incr t} { + set TEMP [F3 $A $B $C $D $E [lindex $W $t]] + set E $D + set D $C + set C [rotl32 $B 30] + set B $A + set A $TEMP + } + + # Round 4: ft(B,C,D) = (B ^ C ^ D) ( 60 <= t <= 79) + for {} {$t < 80} {incr t} { + set TEMP [F4 $A $B $C $D $E [lindex $W $t]] + set E $D + set D $C + set C [rotl32 $B 30] + set B $A + set A $TEMP + } + + # Then perform the following additions. (That is, increment each + # of the four registers by the value it had before this block + # was started.) + incr state(A) $A + incr state(B) $B + incr state(C) $C + incr state(D) $D + incr state(E) $E + } + + return +} + +proc ::sha1::F1 {A B C D E W} { + expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \ + + ($D ^ ($B & ($C ^ $D))) + $E + $W + 0x5a827999) & 0xffffffff} +} + +proc ::sha1::F2 {A B C D E W} { + expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \ + + ($B ^ $C ^ $D) + $E + $W + 0x6ed9eba1) & 0xffffffff} +} + +proc ::sha1::F3 {A B C D E W} { + expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \ + + (($B & $C) | ($D & ($B | $C))) + $E + $W + 0x8f1bbcdc) & 0xffffffff} +} + +proc ::sha1::F4 {A B C D E W} { + expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \ + + ($B ^ $C ^ $D) + $E + $W + 0xca62c1d6) & 0xffffffff} +} + +proc ::sha1::rotl32 {v n} { + return [expr {((($v << $n) \ + | (($v >> (32 - $n)) \ + & (0x7FFFFFFF >> (31 - $n))))) \ + & 0xFFFFFFFF}] +} + + +# ------------------------------------------------------------------------- +# +# In order to get this code to go as fast as possible while leaving +# the main code readable we can substitute the above function bodies +# into the transform procedure. This inlines the code for us an avoids +# a procedure call overhead within the loops. +# +# We can do some minor tweaking to improve speed on Tcl < 8.5 where we +# know our arithmetic is limited to 64 bits. On > 8.5 we may have +# unconstrained integer arithmetic and must avoid letting it run away. +# + +regsub -all -line \ + {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body \ + {[expr {(rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999) \& 0xffffffff}]} \ + ::sha1::SHA1Transform_body_tmp + +regsub -all -line \ + {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body_tmp \ + {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1) \& 0xffffffff}]} \ + ::sha1::SHA1Transform_body_tmp + +regsub -all -line \ + {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body_tmp \ + {[expr {(rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc) \& 0xffffffff}]} \ + ::sha1::SHA1Transform_body_tmp + +regsub -all -line \ + {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body_tmp \ + {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6) \& 0xffffffff}]} \ + ::sha1::SHA1Transform_body_tmp + +regsub -all -line \ + {rotl32\(\$A,5\)} \ + $::sha1::SHA1Transform_body_tmp \ + {((($A << 5) \& 0xffffffff) | (($A >> 27) \& 0x1f))} \ + ::sha1::SHA1Transform_body_tmp + +regsub -all -line \ + {\[rotl32 \$B 30\]} \ + $::sha1::SHA1Transform_body_tmp \ + {[expr {int(($B << 30) | (($B >> 2) \& 0x3fffffff))}]} \ + ::sha1::SHA1Transform_body_tmp +# +# Version 2 avoids a few truncations to 32 bits in non-essential places. +# +regsub -all -line \ + {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body \ + {[expr {rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999}]} \ + ::sha1::SHA1Transform_body_tmp2 + +regsub -all -line \ + {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body_tmp2 \ + {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1}]} \ + ::sha1::SHA1Transform_body_tmp2 + +regsub -all -line \ + {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body_tmp2 \ + {[expr {rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc}]} \ + ::sha1::SHA1Transform_body_tmp2 + +regsub -all -line \ + {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \ + $::sha1::SHA1Transform_body_tmp2 \ + {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6}]} \ + ::sha1::SHA1Transform_body_tmp2 + +regsub -all -line \ + {rotl32\(\$A,5\)} \ + $::sha1::SHA1Transform_body_tmp2 \ + {(($A << 5) | (($A >> 27) \& 0x1f))} \ + ::sha1::SHA1Transform_body_tmp2 + +regsub -all -line \ + {\[rotl32 \$B 30\]} \ + $::sha1::SHA1Transform_body_tmp2 \ + {[expr {($B << 30) | (($B >> 2) \& 0x3fffffff)}]} \ + ::sha1::SHA1Transform_body_tmp2 + +if {[package vsatisfies [package provide Tcl] 8.5]} { + proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp +} else { + proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp2 +} + +unset ::sha1::SHA1Transform_body +unset ::sha1::SHA1Transform_body_tmp +unset ::sha1::SHA1Transform_body_tmp2 + +# ------------------------------------------------------------------------- + +proc ::sha1::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}} +proc ::sha1::bytes {v} { + #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v] + format %c%c%c%c \ + [expr {((0xFF000000 & $v) >> 24) & 0xFF}] \ + [expr {(0xFF0000 & $v) >> 16}] \ + [expr {(0xFF00 & $v) >> 8}] \ + [expr {0xFF & $v}] +} + +# ------------------------------------------------------------------------- + +proc ::sha1::Hex {data} { + binary scan $data H* result + return $result +} + +# ------------------------------------------------------------------------- + +# Description: +# Pop the nth element off a list. Used in options processing. +# +proc ::sha1::Pop {varname {nth 0}} { + upvar $varname args + set r [lindex $args $nth] + set args [lreplace $args $nth $nth] + return $r +} + +# ------------------------------------------------------------------------- + +# fileevent handler for chunked file hashing. +# +proc ::sha1::Chunk {token channel {chunksize 4096}} { + upvar #0 $token state + + if {[eof $channel]} { + fileevent $channel readable {} + set state(reading) 0 + } + + SHA1Update $token [read $channel $chunksize] +} + +# ------------------------------------------------------------------------- + +proc ::sha1::sha1 {args} { + array set opts {-hex 0 -filename {} -channel {} -chunksize 4096} + if {[llength $args] == 1} { + set opts(-hex) 1 + } else { + while {[string match -* [set option [lindex $args 0]]]} { + switch -glob -- $option { + -hex { set opts(-hex) 1 } + -bin { set opts(-hex) 0 } + -file* { set opts(-filename) [Pop args 1] } + -channel { set opts(-channel) [Pop args 1] } + -chunksize { set opts(-chunksize) [Pop args 1] } + default { + if {[llength $args] == 1} { break } + if {[string compare $option "--"] == 0} { Pop args; break } + set err [join [lsort [concat -bin [array names opts]]] ", "] + return -code error "bad option $option:\ + must be one of $err" + } + } + Pop args + } + } + + if {$opts(-filename) != {}} { + set opts(-channel) [open $opts(-filename) r] + fconfigure $opts(-channel) -translation binary + } + + if {$opts(-channel) == {}} { + + if {[llength $args] != 1} { + return -code error "wrong # args:\ + should be \"sha1 ?-hex? -filename file | string\"" + } + set tok [SHA1Init] + SHA1Update $tok [lindex $args 0] + set r [SHA1Final $tok] + + } else { + + set tok [SHA1Init] + # FRINK: nocheck + set [subst $tok](reading) 1 + fileevent $opts(-channel) readable \ + [list [namespace origin Chunk] \ + $tok $opts(-channel) $opts(-chunksize)] + # FRINK: nocheck + vwait [subst $tok](reading) + set r [SHA1Final $tok] + + # If we opened the channel - we should close it too. + if {$opts(-filename) != {}} { + close $opts(-channel) + } + } + + if {$opts(-hex)} { + set r [Hex $r] + } + return $r +} + +# ------------------------------------------------------------------------- + +proc ::sha1::hmac {args} { + array set opts {-hex 1 -filename {} -channel {} -chunksize 4096} + if {[llength $args] != 2} { + while {[string match -* [set option [lindex $args 0]]]} { + switch -glob -- $option { + -key { set opts(-key) [Pop args 1] } + -hex { set opts(-hex) 1 } + -bin { set opts(-hex) 0 } + -file* { set opts(-filename) [Pop args 1] } + -channel { set opts(-channel) [Pop args 1] } + -chunksize { set opts(-chunksize) [Pop args 1] } + default { + if {[llength $args] == 1} { break } + if {[string compare $option "--"] == 0} { Pop args; break } + set err [join [lsort [array names opts]] ", "] + return -code error "bad option $option:\ + must be one of $err" + } + } + Pop args + } + } + + if {[llength $args] == 2} { + set opts(-key) [Pop args] + } + + if {![info exists opts(-key)]} { + return -code error "wrong # args:\ + should be \"hmac ?-hex? -key key -filename file | string\"" + } + + if {$opts(-filename) != {}} { + set opts(-channel) [open $opts(-filename) r] + fconfigure $opts(-channel) -translation binary + } + + if {$opts(-channel) == {}} { + + if {[llength $args] != 1} { + return -code error "wrong # args:\ + should be \"hmac ?-hex? -key key -filename file | string\"" + } + set tok [HMACInit $opts(-key)] + HMACUpdate $tok [lindex $args 0] + set r [HMACFinal $tok] + + } else { + + set tok [HMACInit $opts(-key)] + # FRINK: nocheck + set [subst $tok](reading) 1 + fileevent $opts(-channel) readable \ + [list [namespace origin Chunk] \ + $tok $opts(-channel) $opts(-chunksize)] + # FRINK: nocheck + vwait [subst $tok](reading) + set r [HMACFinal $tok] + + # If we opened the channel - we should close it too. + if {$opts(-filename) != {}} { + close $opts(-channel) + } + } + + if {$opts(-hex)} { + set r [Hex $r] + } + return $r +} + +# ------------------------------------------------------------------------- + +# Try and load a compiled extension to help. +namespace eval ::sha1 { + variable e {} + foreach e [KnownImplementations] { + if {[LoadAccelerator $e]} { + SwitchTo $e + break + } + } + unset e +} + +package provide sha1 $::sha1::version + +# ------------------------------------------------------------------------- +# Local Variables: +# mode: tcl +# indent-tabs-mode: nil +# End: ADDED build/web/process_queue Index: build/web/process_queue ================================================================== --- /dev/null +++ build/web/process_queue @@ -0,0 +1,149 @@ +#! /usr/bin/env tclsh + +set queue "/home/rkeene/devel/kitcreator/build/web/queue" +set outdir "/web/customers/kitcreator.rkeene.org/kits" + +if {![file exists "${queue}.old"]} { + if {![file exists $queue]} { + exit 0 + } + + file rename "$queue" "${queue}.old" +} +set queue "${queue}.old" + +set fd [open $queue r] +set data [read $fd] +close $fd + +set ::env(TCLKIT) "/home/rkeene/bin/tclkit" + +foreach line [split $data "\n"] { + if {$line == ""} { + continue + } + + unset -nocomplain buildinfo + + array set buildinfo $line + + set outfile [file join $outdir $buildinfo(key) $buildinfo(filename)] + + # Skip if build completed + if {[file exists $outfile]} { + continue + } + + # Skip if build failed + if {[file exists $outfile.buildfail]} { + continue + } + + set workdir [file join $outdir $buildinfo(key) build] + file delete -force $workdir + file mkdir $workdir + cd $workdir + + set fd [open ../buildinfo w] + puts $fd [array get buildinfo] + close $fd + + set tarball kitcreator-${buildinfo(kitcreator_version)}.tar.gz + exec wget -q -O $tarball http://kitcreator.rkeene.org/fossil/tarball/${tarball}?uuid=${buildinfo(kitcreator_version)} + exec gzip -dc $tarball | tar -xf - + cd kitcreator-${buildinfo(kitcreator_version)} + + set script "./build/make-kit-${buildinfo(platform)}" + set args [list] + + set ::env(KITCREATOR_PKGS) " [join $buildinfo(packages) " "] " + + foreach {option value} $buildinfo(options) { + switch -- $option { + "kitdll" { + if {$value} { + set ::env(KITCREATOR_PKGS) "$::env(KITCREATOR_PKGS) kitdll" + } + } + "threaded" { + if {$value} { + lappend args "--enable-threads" + } else { + lappend args "--disable-threads" + } + } + "debug" { + if {$value} { + lappend args "--enable-symbols" + set ::env(STRIP) true + } + } + "storage" { + lappend args "--enable-kit-storage=$value" + } + "staticmk4" { + } + "statictk" { + } + } + } + + catch { + exec ./build/pre.sh + } + + catch { + file delete "${outfile}.log" + } + + catch { + set cmd [list $script $buildinfo(tcl_version) {*}$args] + set fd [open "${outfile}.log" w+] + puts $fd "Running: export KITCREATOR_PKGS=\"$::env(KITCREATOR_PKGS)\"" + + if {[info exists ::env(STRIP)]} { + puts $fd "Running: export STRIP=\"$::env(STRIP)\"" + } + + puts $fd "Running: $cmd" + close $fd + } + + catch { + exec {*}$cmd >> "${outfile}.log" 2>@1 + } + + catch { + exec grep ^ {*}[glob */build.log] >> "${outfile}.log" + } + + foreach file [list tclkit-$buildinfo(tcl_version) {*}[glob -nocomplain libtclkit*]] { + switch -glob -- $file { + "*.dylib" - "*.so" - "*.sl" - "*.dll" { } + "tclkit-*" {} + default { + continue + } + } + + if {[file exists $file]} { + file rename $file $outfile + + break + } + } + + if {![file exists $outfile]} { + set fd [open $outfile.buildfail "w+"] + puts $fd "$line" + close $fd + } + + cd $outdir + + file delete -force $workdir +} + +file delete $queue + +exit 0 Index: dbus/build.sh ================================================================== --- dbus/build.sh +++ dbus/build.sh @@ -25,14 +25,14 @@ OUTDIR="$(pwd)/out" INSTDIR="$(pwd)/inst" export DBUSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR # Set configure options for this sub-project -LDFLAGS="${KC_DBUS_LDFLAGS}" -CFLAGS="${KC_DBUS_CFLAGS}" -CPPFLAGS="${KC_DBUS_CPPFLAGS}" -LIBS="${KC_DBUS_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_DBUS_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_DBUS_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_DBUS_CPPFLAGS}" +LIBS="${LIBS} ${KC_DBUS_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS if [ ! -f "${SRC}" ]; then mkdir 'src' >/dev/null 2>/dev/null Index: itcl/build.sh ================================================================== --- itcl/build.sh +++ itcl/build.sh @@ -19,14 +19,14 @@ OUTDIR="$(pwd)/out" INSTDIR="$(pwd)/inst" export ITCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR # Set configure options for this sub-project -LDFLAGS="${KC_ITCL_LDFLAGS}" -CFLAGS="${KC_ITCL_CFLAGS}" -CPPFLAGS="${KC_ITCL_CPPFLAGS}" -LIBS="${KC_ITCL_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_ITCL_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_ITCL_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_ITCL_CPPFLAGS}" +LIBS="${LIBS} ${KC_ITCL_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 Index: kitcreator ================================================================== --- kitcreator +++ kitcreator @@ -1,6 +1,9 @@ #! /usr/bin/env bash + +# Clean variables which will interfere with the build +unset MAKEFLAGS DESTDIR # Determine appropriate mode mode="build" case "$1" in clean|distclean|build|retry) @@ -8,11 +11,11 @@ shift ;; esac # Determine which Tcl version to build -TCLVERS="8.6.1" +TCLVERS="8.6.2" if echo "$1" | grep '^[0-9][0-9]*\.' >/dev/null || echo "$1" | egrep '^(cvs|fossil)_' >/dev/null; then TCLVERS="$1" shift fi @@ -29,11 +32,12 @@ echo "Please remember to run 'build/pre.sh' if you expect this build to work." >&2 fi fi # Define the list of all packages, for cleaning purposes -KITCREATOR_ALLPKGS="kitsh tcl tclvfs zlib tk itcl mk4tcl thread dbus" +KITCREATOR_ALLPKGS="kitsh tcl tclvfs zlib tk itcl mk4tcl thread dbus tls tclx tcc4tcl" + # Always rebuild kitsh rm -f "kitsh/.success" for pkg in ${KITCREATOR_ALLPKGS}; do if [ "${mode}" != "retry" -o ! -f "${pkg}/.success" ]; then rm -f "${pkg}/build.log" "${pkg}/.success" @@ -65,10 +69,29 @@ if echo " ${CONFIGUREEXTRA} " | grep ' --enable-threads' >/dev/null 2>/dev/null; then KITCREATOR_PKGS="${KITCREATOR_PKGS} thread" fi +# Determine cross-compile status +host_os="$(echo " ${CONFIGUREEXTRA} " | sed 's@^.* --host=\([^ ]*\) .*$@\1@ +t x +d +:x')" +build_os="$(echo " ${CONFIGUREEXTRA} " | sed 's@^.* --build=\([^ ]*\) .*$@\1@ +t x +d +:x')" + +if [ "${host_os}" != "${build_os}" -a -n "${host_os}" ]; then + KC_CROSSCOMPILE='1' + KC_CROSSCOMPILE_HOST_OS="${host_os}" +else + KC_CROSSCOMPILE='0' + KC_CROSSCOMPILE_HOST_OS='' +fi +export KC_CROSSCOMPILE KC_CROSSCOMPILE_HOST_OS + # Set default target KITTARGET="kitsh" export KITTARGET # Fix up package list Index: kitsh/build.sh ================================================================== --- kitsh/build.sh +++ kitsh/build.sh @@ -23,14 +23,14 @@ OTHERPKGSDIR="$(pwd)/../" export KITSHVERS BUILDDIR OUTDIR INSTDIR OTHERPKGSDIR # Set configure options for this sub-project LDFLAGS_ADD="${KC_KITSH_LDFLAGS_ADD}" -LDFLAGS="${KC_KITSH_LDFLAGS}" -CFLAGS="${KC_KITSH_CFLAGS}" -CPPFLAGS="${KC_KITSH_CPPFLAGS}" -LIBS="${KC_KITSH_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_KITSH_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_KITSH_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_KITSH_CPPFLAGS}" +LIBS="${LIBS} ${KC_KITSH_LIBS}" export LDFLAGS_ADD LDFLAGS CFLAGS CPPFLAGS LIBS if [ -z "${ENABLECOMPRESSION}" ]; then ENABLECOMPRESSION="1" fi @@ -200,11 +200,11 @@ if echo 'exit 0' | "${TCLKIT}" >/dev/null 2>/dev/null; then ## Install using existing Tclkit ### Call installer echo "Running: \"${TCLKIT}\" installvfs.tcl \"${KITTARGET_NAME}\" starpack.vfs \"${ENABLECOMPRESSION}\"" "${TCLKIT}" installvfs.tcl "${KITTARGET_NAME}" starpack.vfs "${ENABLECOMPRESSION}" || exit 1 - else + elif echo 'exit 0' | ./kit >/dev/null 2>/dev/null; then ## Bootstrap (cannot cross-compile) ### Call installer cp kit runkit echo "set argv [list {${KITTARGET_NAME}} starpack.vfs {${ENABLECOMPRESSION}}]" > setup.tcl echo 'if {[catch { clock seconds }]} { proc clock args { return 0 } }' >> setup.tcl @@ -213,10 +213,16 @@ TCL_LIBRARY="$(pwd)/starpack.vfs/lib/tcl${TCLVERS2}" export TCL_LIBRARY echo 'Running: echo | ./runkit setup.tcl' echo | ./runkit setup.tcl || exit 1 + else + ## Install using Tclsh, which may work if we're not using Metakit + ### Call installer + echo "Running: \"${TCLSH_NATIVE}\" installvfs.tcl \"${KITTARGET_NAME}\" starpack.vfs \"${ENABLECOMPRESSION}\"" + "${TCLSH_NATIVE}" installvfs.tcl "${KITTARGET_NAME}" starpack.vfs "${ENABLECOMPRESSION}" || exit 1 + fi # Cleanup if [ "${KITTARGET}" = "kitdll" ]; then ## Remove built interpreters if we are building KitDLL -- Index: kitsh/buildsrc/kitsh-0.0/aclocal.m4 ================================================================== --- kitsh/buildsrc/kitsh-0.0/aclocal.m4 +++ kitsh/buildsrc/kitsh-0.0/aclocal.m4 @@ -169,18 +169,23 @@ echo '/* Dynamically generated. */' > kitInit-libs.h libs_init_funcs="" for projdir in ../../../*/; do proj="`basename "${projdir}"`" + subprojs="$proj" if test "${proj}" = "build"; then continue fi if test "${proj}" = "kitsh"; then continue fi + + if test "${proj}" = "common"; then + continue + fi projlibdir="../../../${proj}/inst" if test -d "${projlibdir}"; then true @@ -188,13 +193,28 @@ continue fi AC_MSG_CHECKING([for libraries required for ${proj}]) - projlibfiles="`find "${projlibdir}" -name '*.a' 2>/dev/null | sort | tr "\n" ' '`" - projlibfilesnostub="`find "${projlibdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`" + projlibfiles="`find "${projlibdir}" -name '*.a' 2>/dev/null | sort`" + projexcludefile="${projlibdir}/kitcreator-nolibs" + if test -e "${projexcludefile}"; then + projexclude="`cat "$projexcludefile"`" + projlibfiles="`echo "$projlibfiles" | egrep -v "$projexclude"`" + fi + + projlibfilesnostub="`echo "$projlibfiles" | grep -v 'stub' | tr "\n" ' '`" + projlibfiles="`echo "$projlibfiles" | tr "\n" ' '`" projlibextra="" + + if test "$projlibfilesnostub" = ' '; then + projlibfilesnostub='' + fi + + if test "$projlibfiles" = ' '; then + projlibfiles='' + fi for libfile in ${projlibfilesnostub}; do if test -f "${libfile}.linkadd"; then projlibextra="`cat "${libfile}.linkadd"`" fi @@ -201,11 +221,10 @@ done AC_MSG_RESULT([${projlibfilesnostub} ${projlibextra}]) hide_symbols="1" - initialize="1" if test "${proj}" = "tcl"; then DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfilesnostub], [ projlibfiles="${projlibfilesnostub}" ], [ @@ -213,11 +232,11 @@ projlibfiles="${projlibfiles}" ]) ]) hide_symbols="0" - initialize="0" + subprojs="`echo " $projlibfilesnostub " | sed 's@ [[^ ]]*/@ @g;s@ lib@ @g;s@[[0-9\.]]*\.a@ @g;s@ tdbc[[^ ]]*@ @g;s@ sqlite @ sqlite3 @;s@ tcldde[[0-9]][[0-9]]*s*g* @ @g;s@ tclreg[[0-9]][[0-9]]*s*g* @ @g;s@ tcl[[0-9]]*s*g* @ @g;s@^ *@@;s@ *[$]@@'`" fi if test "${proj}" = "mk4tcl"; then if test -n "${projlibfiles}"; then AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl]) @@ -225,11 +244,11 @@ kc_cv_feature_kit_includes_mk4tcl='1' DC_DO_STATIC_LINK_LIBCXX fi - initialize="0" + subprojs="" fi if test "${proj}" = "tk"; then if test "${projlibfilesnostub}" != ""; then DC_DO_TK @@ -252,15 +271,15 @@ ]) hide_symbols="0" fi - initialize="0" + subprojs="" fi if test "${proj}" = "tclvfs"; then - initialize="0" + subprojs="" fi if test "${hide_symbols}" = "1"; then STRIPLIBS="${STRIPLIBS} ${projlibfiles}" fi @@ -268,20 +287,22 @@ dnl Do not explicitly link to Zlib, that will happen elsewhere if test "${proj}" = "zlib"; then continue fi - if test "${initialize}" = "1"; then + if test -n "${subprojs}"; then if test -n "${projlibfilesnostub}"; then - projucase="`echo ${proj} | dd conv=ucase 2>/dev/null`" - projtcase="`echo ${projucase} | cut -c 1``echo ${proj} | cut -c 2-`" - lib_init_func="${projtcase}_Init" - - echo "#define KIT_INCLUDES_${projucase}" >> kitInit-libs.h - echo "Tcl_AppInitProc ${lib_init_func};" >> kitInit-libs.h - - libs_init_funcs="${libs_init_funcs} ${lib_init_func}" + for subproj in $subprojs; do + subprojucase="`echo ${subproj} | dd conv=ucase 2>/dev/null`" + subprojtcase="`echo ${subprojucase} | cut -c 1``echo ${subproj} | cut -c 2-`" + lib_init_func="${subprojtcase}_Init" + + echo "#define KIT_INCLUDES_${subprojucase}" >> kitInit-libs.h + echo "Tcl_AppInitProc ${lib_init_func};" >> kitInit-libs.h + + libs_init_funcs="${libs_init_funcs} ${lib_init_func}" + done fi fi ARCHS="${ARCHS} ${projlibfiles}" LIBS="${LIBS} ${projlibextra}" Index: kitsh/buildsrc/kitsh-0.0/config.sub ================================================================== --- kitsh/buildsrc/kitsh-0.0/config.sub +++ kitsh/buildsrc/kitsh-0.0/config.sub @@ -120,11 +120,11 @@ # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + nto-qnx* | linux-gnu* | linux-musl | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os Index: kitsh/buildsrc/kitsh-0.0/install-sh ================================================================== --- kitsh/buildsrc/kitsh-0.0/install-sh +++ kitsh/buildsrc/kitsh-0.0/install-sh @@ -1,9 +1,9 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2010-02-06.18; # UTC +scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # @@ -154,10 +154,14 @@ shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; @@ -184,10 +188,14 @@ set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then @@ -230,13 +238,13 @@ esac fi for src do - # Protect names starting with `-'. + # Protect names problematic for `test' and other utilities. case $src in - -*) src=./$src;; + -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst @@ -254,16 +262,11 @@ if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then @@ -387,11 +390,11 @@ # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; - -*) prefix='./';; + [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" @@ -405,11 +408,11 @@ prefixes= for d do - test -z "$d" && continue + test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else Index: kitsh/buildsrc/kitsh-0.0/kitInit.c ================================================================== --- kitsh/buildsrc/kitsh-0.0/kitInit.c +++ kitsh/buildsrc/kitsh-0.0/kitInit.c @@ -101,10 +101,16 @@ # endif /* _WIN32_WCE */ # endif /* KITSH_NEED_WINMAIN */ int main(int argc, char **argv); # endif /* HAVE_ACCEPTABLE_DLADDR */ #endif /* !TCLKIT_DLL */ + +#ifdef TCLKIT_DLL +void __attribute__((constructor)) _Tclkit_Init(void); +#else +static void _Tclkit_Init(void); +#endif #ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME char *tclExecutableName; #endif @@ -141,15 +147,13 @@ "catch { load {} zlib }\n" #endif #ifdef KIT_INCLUDES_MK4TCL "catch { load {} Mk4tcl }\n" #endif -#ifdef TCLKIT_DLL "load {} tclkit::init\n" "::tclkit::init::initInterp\n" "rename ::tclkit::init::initInterp {}\n" -#endif /* TCLKIT_DLL */ "set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n" "if {[file exists $bootfile]} {\n" "catch {\n" "set f [open $bootfile]\n" "set s [read $f]\n" @@ -394,10 +398,15 @@ /* Hack to get around Tcl bug 1224888. This must be run here and * in LibraryPathObjCmd because this information is needed both * before and after that command is run. */ FindAndSetExecName(interp); +#if defined(_WIN32) && defined(KIT_INCLUDES_TK) + /* Every interpreter needs this done */ + Tk_InitConsoleChannels(interp); +#endif /* _WIN32 and KIT_INCLUDES_TK */ + return; } #ifndef TCLKIT_DLL int TclKit_AppInit(Tcl_Interp *interp) { @@ -408,13 +417,11 @@ # endif /* !_WIN32_WCE */ # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ /* Perform common initialization */ - _Tclkit_Generic_Init(); - - _Tclkit_Interp_Init(interp); + _Tclkit_Init(); if (Tcl_Init(interp) == TCL_ERROR) { goto error; } @@ -512,10 +519,13 @@ } #endif /* _WIN32 */ return(NULL); } +#else +# define find_tclkit_dll_path() NULL +#endif /* * This function exists to allow C code to initialize a particular * interpreter. */ @@ -556,13 +566,16 @@ /* * Initialize the Tcl system when we are loaded, that way Tcl functions * are ready to be used when invoked. */ +#ifdef TCLKIT_DLL void __attribute__((constructor)) _Tclkit_Init(void) { +#else +static void _Tclkit_Init(void) { +#endif Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL); _Tclkit_Generic_Init(); return; } -#endif Index: mk4tcl/build.sh ================================================================== --- mk4tcl/build.sh +++ mk4tcl/build.sh @@ -19,14 +19,15 @@ INSTDIR="$(pwd)/inst" PATCHDIR="$(pwd)/patches" export MK4VERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR # Set configure options for this sub-project -LDFLAGS="${KC_MK4TCL_LDFLAGS}" -CFLAGS="${KC_MK4TCL_CFLAGS}" -CPPFLAGS="${KC_MK4TCL_CPPFLAGS}" -LIBS="${KC_MK4TCL_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_MK4TCL_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_MK4TCL_CFLAGS}" +CXXFLAGS="${CXXFLAGS} ${KC_MK4TCL_CXXFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_MK4TCL_CPPFLAGS}" +LIBS="${LIBS} ${KC_MK4TCL_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 ADDED mk4tcl/patches/all/metakit-2.4.9.7-fix3264.diff Index: mk4tcl/patches/all/metakit-2.4.9.7-fix3264.diff ================================================================== --- /dev/null +++ mk4tcl/patches/all/metakit-2.4.9.7-fix3264.diff @@ -0,0 +1,52 @@ +diff -uNr metakit-2.4.9.7.orig/include/mk4.h metakit-2.4.9.7-1fix3264/include/mk4.h +--- metakit-2.4.9.7.orig/include/mk4.h 2007-06-15 19:23:25.000000000 -0500 ++++ metakit-2.4.9.7-1fix3264/include/mk4.h 2014-05-20 19:45:24.000000000 -0500 +@@ -9,6 +9,8 @@ + #ifndef __MK4_H__ + #define __MK4_H__ + ++#include ++ + //--------------------------------------------------------------------------- + // + // TITLE +@@ -199,11 +201,7 @@ + + typedef unsigned char t4_byte; // create typedefs for t4_byte, etc. + +-#if q4_LONG64 +-typedef int t4_i32; // if longs are 64b, then int must be 32b +-#else +-typedef long t4_i32; // if longs aren't 64b, then they are 32b +-#endif ++typedef int32_t t4_i32; + + #if q4_LONG64 // choose a way to represent 64b integers + typedef long t4_i64; +diff -uNr metakit-2.4.9.7.orig/src/header.h metakit-2.4.9.7-1fix3264/src/header.h +--- metakit-2.4.9.7.orig/src/header.h 2007-03-09 09:58:53.000000000 -0600 ++++ metakit-2.4.9.7-1fix3264/src/header.h 2014-05-20 19:40:12.000000000 -0500 +@@ -13,6 +13,10 @@ + + #include "config.h" + ++#ifdef HAVE_STDINT_H ++# include ++#endif ++ + ///////////////////////////////////////////////////////////////////////////// + // A number of preprocessor options are used in the source code + // +@@ -139,11 +143,7 @@ + + typedef unsigned char t4_byte; // create typedefs for t4_byte, etc. + +-#if SIZEOF_LONG == 8 +-typedef int t4_i32; // longs are 64b, so int must be 32b +-#else +-typedef long t4_i32; // longs aren't 64b, so they are 32b +-#endif ++typedef int32_t t4_i32; + + ///////////////////////////////////////////////////////////////////////////// + // Include header files which contain additional os/cpu/ide/fw specifics ADDED mk4tcl/patches/all/metakit-2.4.9.7-unregisterchans.diff Index: mk4tcl/patches/all/metakit-2.4.9.7-unregisterchans.diff ================================================================== --- /dev/null +++ mk4tcl/patches/all/metakit-2.4.9.7-unregisterchans.diff @@ -0,0 +1,14 @@ +diff -uNr metakit-2.4.9.7.orig/tcl/mk4tcl.cpp metakit-2.4.9.7-1unregisterchans/tcl/mk4tcl.cpp +--- metakit-2.4.9.7.orig/tcl/mk4tcl.cpp 2007-06-18 16:05:24.000000000 -0500 ++++ metakit-2.4.9.7-1unregisterchans/tcl/mk4tcl.cpp 2014-05-20 00:55:56.857516999 -0500 +@@ -737,6 +737,10 @@ + MkWorkspace::~MkWorkspace() { + CleanupCommands(); + ++ for (MkChannel *chan = _chanList; chan; chan = chan->_next) { ++ Tcl_UnregisterChannel(_interp, chan->_chan); ++ } ++ + for (int i = _items.GetSize(); --i >= 0;) + delete Nth(i); + ADDED tcc4tcl/build.sh Index: tcc4tcl/build.sh ================================================================== --- /dev/null +++ tcc4tcl/build.sh @@ -0,0 +1,136 @@ +#! /usr/bin/env bash + +if [ ! -f 'build.sh' ]; then + echo 'ERROR: This script must be run from the directory it is in' >&2 + + exit 1 +fi +if [ -z "${TCLVERS}" ]; then + echo 'ERROR: The TCLVERS environment variable is not set' >&2 + + exit 1 +fi + +TCC4TCLVERS="0.22" +SRC="src/tcc4tcl-${TCC4TCLVERS}.tar.gz" +SRCURL="http://rkeene.org/devel/tcc4tcl/tcc4tcl-${TCC4TCLVERS}.tar.gz" +BUILDDIR="$(pwd)/build/tcc4tcl-${TCC4TCLVERS}" +OUTDIR="$(pwd)/out" +INSTDIR="$(pwd)/inst" +PATCHDIR="$(pwd)/patches" +export TCC4TCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR + +# Set configure options for this sub-project +LDFLAGS="${LDFLAGS} ${KC_TCC4TCL_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TCC4TCL_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TCC4TCL_CPPFLAGS}" +LIBS="${LIBS} ${KC_TCC4TCL_LIBS}" +export LDFLAGS CFLAGS CPPFLAGS LIBS + +rm -rf 'build' 'out' 'inst' +mkdir 'build' 'out' 'inst' || exit 1 + +TCL_VERSION="unknown" +if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then + source "${TCLCONFIGDIR}/tclConfig.sh" +fi +export TCL_VERSION + +if [ ! -f "${SRC}" ]; then + mkdir 'src' >/dev/null 2>/dev/null + + if [ ! -d 'buildsrc' ]; then + rm -f "${SRC}.tmp" + wget -O "${SRC}.tmp" "${SRCURL}" || exit 1 + mv "${SRC}.tmp" "${SRC}" + fi +fi + +( + cd 'build' || exit 1 + + if [ ! -d '../buildsrc' ]; then + gzip -dc "../${SRC}" | tar -xf - + else + cp -rp ../buildsrc/* './' + fi + + # Apply required patches + cd "${BUILDDIR}" || exit 1 + + for patch in "${PATCHDIR}/all"/tcc4tcl-${TCC4TCLVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tcc4tcl-${TCC4TCLVERS}-*.diff; do + if [ ! -f "${patch}" ]; then + continue + fi + + echo "Applying: ${patch}" + ${PATCH:-patch} -p1 < "${patch}" + done + + # Try to build as a shared object if requested + if [ "${STATICTCC4TCL}" = "0" ]; then + tryopts="--enable-shared --disable-shared" + elif [ "${STATICTCC4TCL}" = "-1" ]; then + # Require shared object if requested + tryopts="--enable-shared" + else + # Default to building statically + tryopts="--disable-shared" + fi + + if echo " ${CONFIGUREEXTRA} " | grep ' --disable-load ' >/dev/null; then + dlopen_flag="--with-dlopen" + else + dlopen_flag="--without-dlopen" + fi + + SAVE_CFLAGS="${CFLAGS}" + for tryopt in $tryopts __fail__; do + # Clean up, if needed + make distclean >/dev/null 2>/dev/null + rm -rf "${INSTDIR}" + mkdir "${INSTDIR}" + + if [ "${tryopt}" = "__fail__" ]; then + exit 1 + fi + + if [ "${tryopt}" == "--enable-shared" ]; then + isshared="1" + else + isshared="0" + fi + + # If build a static tcc4tcl for KitDLL, ensure that we use PIC + # so that it can be linked into the shared object + if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then + CFLAGS="${SAVE_CFLAGS} -fPIC" + else + CFLAGS="${SAVE_CFLAGS}" + fi + + ( + echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${dlopen_flag} ${CONFIGUREEXTRA}" + ./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${dlopen_flag} ${CONFIGUREEXTRA} + + echo "Running: ${MAKE:-make}" + ${MAKE:-make} || exit 1 + + echo "Running: ${MAKE:-make} install" + ${MAKE:-make} install || exit 1 + ) || continue + + break + done + + # Create VFS-insert + cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1 + find "${OUTDIR}" -name '*.a' -type f | grep -v '/libtcc1\.a$' | xargs rm -f + + # Tell Kitsh not to try to link against "libtcc1.a" + echo "/libtcc1\.a" > "${INSTDIR}/kitcreator-nolibs" + + exit 0 +) || exit 1 + +exit 0 Index: tcl/build.sh ================================================================== --- tcl/build.sh +++ tcl/build.sh @@ -19,14 +19,14 @@ PATCHSCRIPTDIR="$(pwd)/patchscripts" PATCHDIR="$(pwd)/patches" export SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR # Set configure options for this sub-project -LDFLAGS="${KC_TCL_LDFLAGS}" -CFLAGS="${KC_TCL_CFLAGS}" -CPPFLAGS="${KC_TCL_CPPFLAGS}" -LIBS="${KC_TCL_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_TCL_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TCL_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TCL_CPPFLAGS}" +LIBS="${LIBS} ${KC_TCL_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 @@ -199,14 +199,27 @@ ) fi done tryfirstdir='' - if [ "$(uname -s)" = "Darwin" ]; then - tryfirstdir='macosx' - fi - + case "${KC_CROSSCOMPILE_HOST_OS}" in + *-*-darwin*) + # Cross-compiling for Mac OS X -- try to build macosx directory first + tryfirstdir='macosx' + ;; + *-*-*) + # Cross-compiling, do not assume based on build platform + ;; + '') + # Not cross-compiling, assume based on build platform + if [ "$(uname -s)" = "Darwin" ]; then + # Compiling for Mac OS X, build in that directory first + tryfirstdir='macosx' + fi + ;; + esac + for dir in "${tryfirstdir}" unix win macosx __fail__; do if [ -z "${dir}" ]; then continue fi @@ -217,10 +230,11 @@ fi # Remove previous directory's "tclConfig.sh" if found rm -f 'tclConfig.sh' + echo "Working in: $dir" cd "${BUILDDIR}/${dir}" || exit 1 # Remove broken pre-generated Makfiles rm -f GNUmakefile Makefile makefile ADDED tcl/patchscripts/fix-crosscompile.sh Index: tcl/patchscripts/fix-crosscompile.sh ================================================================== --- /dev/null +++ tcl/patchscripts/fix-crosscompile.sh @@ -0,0 +1,143 @@ +#! /bin/bash + +if [ "${KC_CROSSCOMPILE}" != '1' ]; then + exit 0 +fi + +mkdir fake-bin + +cat << \_EOF_ > fake-bin/fake-uname +#! /bin/bash + +if [ "$1" == "--fake" ]; then + echo "true" + + exit 0 +fi + +if [ -z "${KC_CROSSCOMPILE_HOST_OS}" ]; then + # If not cross compiling, revert to system uname + while [ "$(uname --fake 2>/dev/null)" == "true" -a -n "${PATH}" ]; do + PATH="$(echo "${PATH}" | sed 's@^[^:]*$@@;s@^[^:]*:@@')" + + export PATH + done + + if [ -z "${PATH}" ]; then + exit 1 + fi + + exec uname "$@" +fi + +# Determine release information +case "${KC_CROSSCOMPILE_HOST_OS}" in + *-hpux11*) + sysname="HP-UX" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-hpux@@')" + ;; + *-solaris2*) + sysname="SunOS" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-solaris@@;s@^2@5@')" + ;; + *-linux*) + sysname="Linux" + sysrelease="2.6.5" + ;; + *-netbsd*) + sysname="NetBSD" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-netbsd@@;s@$@.0@')" + ;; + *-freebsd*) + sysname="FreeBSD" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-freebsd@@;s@$@.0-RELEASE@')" + ;; + *-aix[0-9].*) + sysname="AIX" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@.*-aix\([0-9]\..*\)@\1@')" + ;; + *-*-darwin*) + sysname="Darwin" + sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@.*-darwin\([0-9]*\)@\1@')" + ;; +esac + +# Determine machine information +case "${KC_CROSSCOMPILE_HOST_OS}" in + x86_64-*-darwin*) + sysmachine="Intel" + syscpu="x86_64" + ;; + powerpc-*-darwin*) + sysmachine="Power Macintosh" + syscpu="powerpc" + ;; + hppa64-*-hpux*) + sysmachine="9000/859" + ;; + i386-*-solaris*) + sysmachine="i86pc" + ;; + sparc-*-solaris*) + sysmachine="sun4u" + ;; + x86_64-*) + sysmachine="x86_64" + ;; + i?86-*) + sysmachine="i686" + ;; + ia64-*) + sysmachine="ia64" + ;; + arm-*|armel-*|armeb-*) + sysmachine="armv7l" + ;; + mipsel-*|mipseb-*) + sysmachine="mips" + ;; + powerpc-*) + sysmachine="ppc" + ;; +esac + +for arg in $(echo "$@" | sed 's@.@ & @g'); do + case "${arg}" in + -) + continue + ;; + v) + retval="${retval} unknown" + ;; + r) + retval="${retval} ${sysrelease}" + ;; + s) + retval="${retval} ${sysname}" + ;; + m) + retval="${retval} ${sysmachine}" + ;; + p) + # XXX + retval="${retval} ${syscpu}" + ;; + n) + retval="${retval} $(hostname)" + ;; + a) + retval="${sysname} $(hostname) ${sysrelease} ${sysversion} ${sysmachine} ${syscpu}" + ;; + esac +done + +echo "${retval}" | sed 's@^ *@@;s@ *$@@' +_EOF_ + +chmod +x fake-bin/fake-uname + +sed 's|`uname |`'"$(pwd)"'/fake-bin/fake-uname |g' unix/configure > unix/configure.new +cat unix/configure.new > unix/configure +rm -f unix/configure.new + +exit 0 Index: tcl/patchscripts/win32-32bit-timet.sh ================================================================== --- tcl/patchscripts/win32-32bit-timet.sh +++ tcl/patchscripts/win32-32bit-timet.sh @@ -1,9 +1,9 @@ #! /usr/bin/env bash # Do not run on Win32 -if echo '_WIN64' | ${CC:-cc} -E - | grep '^_WIN64$'; then +if echo '_WIN64' | ${CC:-cc} -E - | grep '^_WIN64$' >/dev/null; then ( echo '#ifndef _USE_32BIT_TIME_T' echo '#define _USE_32BIT_TIME_T 1' echo '#endif' cat generic/tcl.h Index: tclvfs/build.sh ================================================================== --- tclvfs/build.sh +++ tclvfs/build.sh @@ -19,14 +19,14 @@ INSTDIR="$(pwd)/inst" PATCHDIR="$(pwd)/patches" export TCLVFSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR # Set configure options for this sub-project -LDFLAGS="${KC_TCLVFS_LDFLAGS}" -CFLAGS="${KC_TCLVFS_CFLAGS}" -CPPFLAGS="${KC_TCLVFS_CPPFLAGS}" -LIBS="${KC_TCLVFS_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_TCLVFS_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TCLVFS_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TCLVFS_CPPFLAGS}" +LIBS="${LIBS} ${KC_TCLVFS_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 ADDED tclx/build.sh Index: tclx/build.sh ================================================================== --- /dev/null +++ tclx/build.sh @@ -0,0 +1,141 @@ +#! /usr/bin/env bash + +if [ ! -f 'build.sh' ]; then + echo 'ERROR: This script must be run from the directory it is in' >&2 + + exit 1 +fi +if [ -z "${TCLVERS}" ]; then + echo 'ERROR: The TCLVERS environment variable is not set' >&2 + + exit 1 +fi + +TCLXVERS="8.4.1" +SRC="src/tclx${TCLXVERS}.tar.bz2" +SRCURL="http://sourceforge.net/projects/tclx/files/TclX/${TCLXVERS}/tclx${TCLXVERS}.tar.bz2/download" +BUILDDIR="$(pwd)/build/tclx8.4" +OUTDIR="$(pwd)/out" +INSTDIR="$(pwd)/inst" +PATCHDIR="$(pwd)/patches" +export TCLXVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR + +# Set configure options for this sub-project +LDFLAGS="${LDFLAGS} ${KC_TCLX_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TCLX_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TCLX_CPPFLAGS}" +LIBS="${LIBS} ${KC_TCLX_LIBS}" +export LDFLAGS CFLAGS CPPFLAGS LIBS + +rm -rf 'build' 'out' 'inst' +mkdir 'build' 'out' 'inst' || exit 1 + +TCL_VERSION="unknown" +if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then + source "${TCLCONFIGDIR}/tclConfig.sh" +fi +export TCL_VERSION + +if [ ! -f "${SRC}" ]; then + mkdir 'src' >/dev/null 2>/dev/null + + if [ ! -d 'buildsrc' ]; then + rm -f "${SRC}.tmp" + wget -O "${SRC}.tmp" "${SRCURL}" || exit 1 + mv "${SRC}.tmp" "${SRC}" + fi +fi + +( + cd 'build' || exit 1 + + if [ ! -d '../buildsrc' ]; then + bzip2 -dc "../${SRC}" | tar -xf - + else + cp -rp ../buildsrc/* './' + fi + + # Apply required patches + cd "${BUILDDIR}" || exit 1 + for patch in "${PATCHDIR}/all"/tclx-${TCLXVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tclx-${TCLXVERS}-*.diff; do + if [ ! -f "${patch}" ]; then + continue + fi + + echo "Applying: ${patch}" + ${PATCH:-patch} -p1 < "${patch}" + done + + cd "${BUILDDIR}" || exit 1 + + # Try to build as a shared object if requested + if [ "${STATICTCLX}" = "0" ]; then + tryopts="--enable-shared --disable-shared" + elif [ "${STATICTCLX}" = "-1" ]; then + tryopts="--enable-shared" + else + tryopts="--disable-shared" + fi + + SAVE_CFLAGS="${CFLAGS}" + for tryopt in $tryopts __fail__; do + # Clean up, if needed + make distclean >/dev/null 2>/dev/null + rm -rf "${INSTDIR}" + mkdir "${INSTDIR}" + + if [ "${tryopt}" = "__fail__" ]; then + exit 1 + fi + + if [ "${tryopt}" == "--enable-shared" ]; then + isshared="1" + else + isshared="0" + fi + + # If build a static TclX for KitDLL, ensure that we use PIC + # so that it can be linked into the shared object + if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then + CFLAGS="${SAVE_CFLAGS} -fPIC" + else + CFLAGS="${SAVE_CFLAGS}" + fi + export CFLAGS + + if [ "${isshared}" = '0' ]; then + sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new + else + sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new + fi + cat configure.new > configure + rm -f configure.new + + ( + echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" + ./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} + + echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\"" + ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1 + + echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install" + ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1 + ) || continue + + break + done + + if [ ! -e "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl" ]; then + cat << _EOF_ > "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl" +package ifneeded Tclx 8.4 [list load {} Tclx] +_EOF_ + fi + + # Install files needed by installation + cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1 + find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f -- + + exit 0 +) || exit 1 + +exit 0 Index: thread/build.sh ================================================================== --- thread/build.sh +++ thread/build.sh @@ -18,14 +18,14 @@ OUTDIR="$(pwd)/out" INSTDIR="$(pwd)/inst" export THREADVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR # Set configure options for this sub-project -LDFLAGS="${KC_THREAD_LDFLAGS}" -CFLAGS="${KC_THREAD_CFLAGS}" -CPPFLAGS="${KC_THREAD_CPPFLAGS}" -LIBS="${KC_THREAD_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_THREAD_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_THREAD_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_THREAD_CPPFLAGS}" +LIBS="${LIBS} ${KC_THREAD_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 Index: tk/build.sh ================================================================== --- tk/build.sh +++ tk/build.sh @@ -19,14 +19,14 @@ INSTDIR="$(pwd)/inst" PATCHSCRIPTDIR="$(pwd)/patchscripts" export SRC SRCURL BUILDDIR PATCHDIR OUTDIR INSTDIR PATCHSCRIPTDIR # Set configure options for this sub-project -LDFLAGS="${KC_TK_LDFLAGS}" -CFLAGS="${KC_TK_CFLAGS}" -CPPFLAGS="${KC_TK_CPPFLAGS}" -LIBS="${KC_TK_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_TK_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TK_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TK_CPPFLAGS}" +LIBS="${LIBS} ${KC_TK_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS # Must be kept in-sync with "../tcl/build.sh" TCLFOSSILDATE="../tcl/src/tcl${TCLVERS}.tar.gz.date" export TCLFOSSILDATE @@ -147,10 +147,16 @@ ( . "${patchscript}" ) fi done + + # Allow wrapper programs to supplant real programs + if [ -d 'fake-bin' ]; then + PATH="$(pwd)/fake-bin:${PATH}" + export PATH + fi for dir in "${TCLCONFIGDIRTAIL}" unix win macosx win64 __fail__; do if [ -z "${dir}" ]; then continue fi @@ -174,12 +180,14 @@ # Remove broken pre-generated Makfiles rm -f GNUmakefile Makefile makefile if [ "${dir}" = "win" ]; then # Statically link Tk to Tclkit if we are compiling for - # Windows - STATICTK="1" + # Windows unless otherwise requested + if [ -z "${STATICTK}" ]; then + STATICTK="1" + fi if [ "${win64}" = "1" ]; then # Mingw32 for AMD64 requires this, apparently CPPFLAGS="${CPPFLAGS} -D_WIN32_IE=0x0501" CFLAGS="${CFLAGS} -D_WIN32_IE=0x0501" @@ -234,25 +242,31 @@ rm -f "${INSTDIR}"/lib/tk*/pkgIndex.tcl else # Update pkgIndex to load libtk from the local directory rather # than the parent directory for pkgIndex in "${INSTDIR}"/lib/tk*/pkgIndex.tcl; do - sed 's@ \.\. @ @g' "${pkgIndex}" > "${pkgIndex}.new" + sed 's@ \.\. bin @ @g;s@ \.\. @ @;s@ lib\(tk.*\.dll\)@ \1@' "${pkgIndex}" > "${pkgIndex}.new" mv "${pkgIndex}.new" "${pkgIndex}" done fi mkdir "${OUTDIR}/lib" || exit 1 cp -r "${INSTDIR}/lib"/tk* "${OUTDIR}/lib/" + cp -r "${INSTDIR}/bin"/tk*.dll "${OUTDIR}/lib/"/tk*/ cp -r "${INSTDIR}/lib"/libtk* "${OUTDIR}/lib"/tk*/ rm -rf "${OUTDIR}/lib"/tk*/demos - "${STRIP:-strip}" -g "${OUTDIR}"/lib/tk*/*.so >/dev/null 2>/dev/null + "${STRIP:-strip}" -g "${OUTDIR}"/lib/tk*/*.{so,dll,dylib,shlib} >/dev/null 2>/dev/null find "${OUTDIR}" -type f -name '*.a' | xargs rm -f >/dev/null 2>/dev/null + + # If we have a shared object, delete static libraries + if find "${INSTDIR}" -type f '(' -name '*.dll' -o -name '*.so' -o -name '*.dylib' -o -name '*.shlib' ')' 2>/dev/null | grep '^' >/dev/null; then + find "${INSTDIR}" -type f -name '*.a' | grep -v 'stub' | xargs rm -f + fi break done exit 0 ) || exit 1 exit 0 ADDED tk/patchscripts/fixfixstrtod.sh Index: tk/patchscripts/fixfixstrtod.sh ================================================================== --- /dev/null +++ tk/patchscripts/fixfixstrtod.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +# The "fix" for strtod: +# 1. Only applies to Solaris 2.4 (which noone should use) +# 2. Does not actually link against the file (which is +# not even in Tk 8.6.1) that would supply such a symbol + +grep -v '#define strtod fixstrtod' unix/configure > unix/configure.new +cat unix/configure.new > unix/configure +rm -f unix/configure.new + +grep -v '#define strtod fixstrtod' macosx/configure > macosx/configure.new +cat macosx/configure.new > macosx/configure +rm -f macosx/configure.new + ADDED tk/patchscripts/xmkmf-donotuse.sh Index: tk/patchscripts/xmkmf-donotuse.sh ================================================================== --- /dev/null +++ tk/patchscripts/xmkmf-donotuse.sh @@ -0,0 +1,34 @@ +#! /bin/bash + +# If we are not cross-compiling then don't worry about replacing "xmkmf" with a wrapper +if [ -z "${KC_CROSSCOMPILE}" ]; then + ## If KC_CROSSCOMPILE was unspecified, try to autodetect + if [ -z "${CC}" ]; then + exit 0 + fi + + case "$(basename "${CC}")" in + *-*-*) + ;; + *) + exit 0 + esac +else + ## If KC_CROSSCOMPILE was specified as 0, we are not cross-compiling + if [ "${KC_CROSSCOMPILE}" = '0' ]; then + exit 0 + fi + + ## Otherwise, we are cross-compiling +fi + +# Create an "xmkmf" wrapper which exits in failure so that autoconf will try +# to locate headers/libraries normally +mkdir fake-bin >/dev/null 2>/dev/null + +cat << \_EOF_ > fake-bin/xmkmf +#! /bin/bash +exit 1 +_EOF_ + +chmod +x fake-bin/xmkmf Index: tls/build.sh ================================================================== --- tls/build.sh +++ tls/build.sh @@ -19,14 +19,14 @@ INSTDIR="$(pwd)/inst" PATCHDIR="$(pwd)/patches" export TLSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR # Set configure options for this sub-project -LDFLAGS="${KC_TLS_LDFLAGS}" -CFLAGS="${KC_TLS_CFLAGS}" -CPPFLAGS="${KC_TLS_CPPFLAGS}" -LIBS="${KC_TLS_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_TLS_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_TLS_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_TLS_CPPFLAGS}" +LIBS="${LIBS} ${KC_TLS_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 @@ -53,10 +53,16 @@ gzip -dc "../${SRC}" | tar -xf - else cp -rp ../buildsrc/* './' fi + # Determine SSL directory + if [ -z "${CPP}" ]; then + CPP="${CC} -E" + fi + SSLDIR="$(echo '#include ' 2>/dev/null | ${CPP} - | awk '/# 1 "\/.*\/ssl\.h/{ print $3; exit }' | sed 's@^"@@;s@"$@@;s@/include/openssl/ssl\.h$@@')" + # Apply required patches cd "${BUILDDIR}" || exit 1 for patch in "${PATCHDIR}/all"/tls-${TLSVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tls-${TLSVERS}-*.diff; do if [ ! -f "${patch}" ]; then continue @@ -110,12 +116,12 @@ fi cat configure.new > configure rm -f configure.new ( - echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" - ./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA} + echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" --with-ssl-dir=\"${SSLDIR}\" ${CONFIGUREEXTRA}" + ./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}" ${CONFIGUREEXTRA} echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\"" ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1 echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install" ADDED tls/patches/all/tls-1.6-eoffix.diff Index: tls/patches/all/tls-1.6-eoffix.diff ================================================================== --- /dev/null +++ tls/patches/all/tls-1.6-eoffix.diff @@ -0,0 +1,33 @@ +diff -uNr tls1.6/tlsIO.c tls1.6-eof-1dgp/tlsIO.c +--- tls1.6/tlsIO.c 2008-03-17 19:59:02.000000000 -0500 ++++ tls1.6-eof-1dgp/tlsIO.c 2014-07-07 22:41:14.017514735 -0500 +@@ -729,6 +729,19 @@ + statePtr->timer = (Tcl_TimerToken) NULL; + } + ++ if (statePtr->flags & TLS_TCL_CALLBACK) { ++ return 0; ++ } ++ ++ if (statePtr->flags & TLS_TCL_INIT ++ && !SSL_is_init_finished(statePtr->ssl)) { ++ int errorCode; ++ if (Tls_WaitForConnect(statePtr, &errorCode) <= 0 ++ && errorCode == EAGAIN) { ++ return 0; ++ } ++ } ++ + return mask; + } + +@@ -900,6 +913,9 @@ + continue; + } + } else if (err == 0) { ++ if (Tcl_Eof(statePtr->self)) { ++ return 0; ++ } + dprintf(stderr,"CR! "); + *errorCodePtr = ECONNRESET; + return -1; Index: zlib/build.sh ================================================================== --- zlib/build.sh +++ zlib/build.sh @@ -20,14 +20,14 @@ PATCHSCRIPTDIR="$(pwd)/patchscripts" PATCHDIR="$(pwd)/patches" export ZLIBVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR # Set configure options for this sub-project -LDFLAGS="${KC_ZLIB_LDFLAGS}" -CFLAGS="${KC_ZLIB_CFLAGS}" -CPPFLAGS="${KC_ZLIB_CPPFLAGS}" -LIBS="${KC_ZLIB_LIBS}" +LDFLAGS="${LDFLAGS} ${KC_ZLIB_LDFLAGS}" +CFLAGS="${CFLAGS} ${KC_ZLIB_CFLAGS}" +CPPFLAGS="${CPPFLAGS} ${KC_ZLIB_CPPFLAGS}" +LIBS="${LIBS} ${KC_ZLIB_LIBS}" export LDFLAGS CFLAGS CPPFLAGS LIBS rm -rf 'build' 'out' 'inst' mkdir 'build' 'out' 'inst' || exit 1 @@ -50,42 +50,20 @@ cp -rp ../buildsrc/* './' fi cd "${BUILDDIR}" || exit 1 - # Apply patches if needed - for patch in "${PATCHDIR}/all"/zlib-${ZLIBVERS}-*.diff "${PATCHDIR}/all"/zlib-all-*.diff "${PATCHDIR}/${ZLIBVERS}"/zlib-${ZLIBVERS}-*.diff; do - if [ ! -f "${patch}" ]; then - continue - fi - - echo "Applying: ${patch}" - ${PATCH:-patch} -p1 < "${patch}" - done - - - # Apply patch scripts if needed - for patchscript in "${PATCHSCRIPTDIR}"/*.sh; do - if [ -f "${patchscript}" ]; then - echo "Running patch script: ${patchscript}" - - ( - . "${patchscript}" - ) - fi - done - # If we are building for KitDLL, compile with '-fPIC' if [ "${KITTARGET}" = "kitdll" ]; then CFLAGS="${CFLAGS} -fPIC" export CFLAGS fi # We don't pass CONFIGUREEXTRA here, since this isn't a GNU autoconf # script and will puke - echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\"" - ./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" + echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --static" + ./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --static echo "Running: ${MAKE:-make}" ${MAKE:-make} || exit 1 echo "Running: ${MAKE:-make} install"