Index: .fossil-settings/ignore-glob ================================================================== --- .fossil-settings/ignore-glob +++ .fossil-settings/ignore-glob @@ -10,10 +10,12 @@ server/buildpkgs/dict/build/* server/buildpkgs/dict/out server/buildpkgs/dict/out/* server/buildpkgs/dict/src server/buildpkgs/dict/src/* +server/buildpkgs/platform.magic.* +server/buildpkgs/platform.magic.*/* server/buildpkgs/tcl server/buildpkgs/tcl/* server/buildpkgs/tclpkgs-*.tar.* server/buildpkgs/tclpkgs-*.tar.*/* server/buildpkgs/tls/build Index: server/buildpkgs/Tclx/build.sh ================================================================== --- server/buildpkgs/Tclx/build.sh +++ server/buildpkgs/Tclx/build.sh @@ -9,14 +9,13 @@ VERS=8.4 SRC="src/tclx${VERS}.tar.bz2" SRCURL="http://sourceforge.net/projects/tclx/files/TclX/${VERS}.0/tclx${VERS}.tar.bz2/download" BUILDDIR="tclx${VERS}" WORKDIR="${TMPDIR:-/tmp}/tclx-$$${RANDOM}${RANDOM}${RANDOM}" -PLATFORM="$(../platform)" PLATDIR="$(pwd)/out/${PLATFORM}" -export VERS SRC SRCURL BUILDDIR WORKDIR PLATFORM PLATDIR +export VERS SRC SRCURL BUILDDIR WORKDIR PLATDIR ( rm -rf build mkdir build ) || exit 1 @@ -79,11 +78,11 @@ if ((objc < 2) || (objc > 3)) { return TclX_WrongArgs (interp, objv [0], __EOF__ - bash ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --libdir="${PLATDIR}" + bash ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --libdir="${PLATDIR}" ${CONFIGUREEXTRA} ${MAKE:-make} || exit 1 mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null ${MAKE:-make} install-lib-binaries PKG_DIR='' || exit 1 Index: server/buildpkgs/build_all.sh ================================================================== --- server/buildpkgs/build_all.sh +++ server/buildpkgs/build_all.sh @@ -7,27 +7,35 @@ fi CLEANONLY=0 DISTCLEAN=0 if [ "$1" = "clean" ]; then + shift CLEANONLY=1 fi if [ "$1" = "distclean" ]; then + shift CLEANONLY=1 DISTCLEAN=1 fi export CLEANONLY DISTCLEAN +CONFIGUREEXTRA="$@" +export CONFIGUREEXTRA + # Determine path to "tclConfig.sh" rm -rf tcl/build +rm -f platform.magic.* if [ "${DISTCLEAN}" = "1" ]; then rm -rf tcl fi if [ "${CLEANONLY}" = "0" ]; then TCLVERS="8.4.19" TCLPRIVATE="$(pwd)/tcl/build/tcl${TCLVERS}" + PROJROOTDIR="$(pwd)" + export TCLVERS TCLPRIVATE PROJROOTDIR mkdir tcl tcl/build >/dev/null 2>/dev/null if [ ! -f "tcl/src/tcl${TCLVERS}.tar.gz" ]; then mkdir tcl/src >/dev/null 2>/dev/null @@ -38,19 +46,43 @@ ( mkdir tcl/build >/dev/null 2>/dev/null cd tcl/build || exit 1 gzip -dc "../src/tcl${TCLVERS}.tar.gz" | tar -xf - - cd "${TCLPRIVATE}/unix" || exit 1 - - ./configure --enable-shared - - ${MAKE:-make} - ) > "tcl/build/build.log" 2>&1 - - if [ -d "${TCLPRIVATE}" -a -f "${TCLPRIVATE}/unix/tclConfig.sh" ]; then - TCLCONFIGDIR="${TCLPRIVATE}/unix" + for dir in unix win macosx; do + cd "${TCLPRIVATE}/${dir}" || exit 1 + + echo " Executing: ./configure ${CONFIGUREEXTRA}" + ./configure --disable-threads ${CONFIGUREEXTRA} + + ${MAKE:-make} || continue + + LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}" + LD_RUN_PATH=".:${LD_RUN_PATH}" + export LD_LIBRARY_PATH LD_RUN_PATH + + file tclsh tclsh*.exe 2>/dev/null | grep -iv 'No such file' > "${PROJROOTDIR}/platform.magic.file" + if [ -f tclsh*.exe ]; then + echo 'puts "$::tcl_platform(os)"' | ./tclsh*.exe > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null + else + echo 'puts "$::tcl_platform(os)"' | ./tclsh > "${PROJROOTDIR}/platform.magic.os" 2>/dev/null + fi + echo "${dir}" > "${PROJROOTDIR}/platform.magic.platform" + pwd > "${PROJROOTDIR}/platform.magic.dir" + + break + done + ) > "tcl/build/build.log" 2>&1 || ( + echo 'Failed to build Tcl. See "./tcl/build/build.log"' + echo 'Proceeding with system Tcl. Building might fail.' + ) + + TCLBUILDDIR="$(cat "${PROJROOTDIR}/platform.magic.dir")" + export TCLBUILDDIR + + if [ -d "${TCLBUILDDIR}" -a -f "${TCLBUILDDIR}/tclConfig.sh" ]; then + TCLCONFIGDIR="${TCLBUILDDIR}" else unset TCLPRIVATE TCLCONFIGDIR=$( ( @@ -66,19 +98,20 @@ ) if [ -z "${TCLCONFIGDIR}" ]; then TCLCONFIGDIR="/usr/lib" fi - TCLPRIVATE="${TCLCONFIGDIR}/../include/tcl-private" + TCLPRIVATE="$(dirname "${TCLCONFIGDIR}")/include/tcl-private" fi - ADDFLAGS="-I${TCLPRIVATE} -I${TCLPRIVATE}/generic -I${TCLPRIVATE}/unix" + ADDFLAGS="-I${TCLPRIVATE} -I${TCLPRIVATE}/generic -I${TCLBUILDDIR}" CFLAGS="${ADDFLAGS} ${CFLAGS}" CPPFLAGS="${ADDFLAGS} ${CPPFLAGS}" unset TCLVERS unset ADDFLAGS + unset TCLBUILDDIR export TCLCONFIGDIR TCLPRIVATE CFLAGS CPPFLAGS fi # Determine platform PLATFORM="$(./platform)" Index: server/buildpkgs/dict/build.sh ================================================================== --- server/buildpkgs/dict/build.sh +++ server/buildpkgs/dict/build.sh @@ -9,23 +9,22 @@ VERS=8.5.2 SRC="src/tclDict-${VERS}.tar.gz" SRCURL="http://pascal.scheffers.net/software/tclDict-${VERS}.tar.gz" BUILDDIR="tclDict-${VERS}" WORKDIR="${TMPDIR:-/tmp}/dict-$$${RANDOM}${RANDOM}${RANDOM}" -PLATFORM="$(../platform)" PLATDIR="$(pwd)/out/${PLATFORM}" -export VERS SRC SRCURL BUILDDIR WORKDIR PLATFORM PLATDIR +export VERS SRC SRCURL BUILDDIR WORKDIR PLATDIR if [ ! -f "${SRC}" ]; then mkdir src >/dev/null 2>/dev/null wget -O "${SRC}" "${SRCURL}" || exit 1 fi ( - rm -rf build out + rm -rf build mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null mkdir build cd build/ || exit 1 @@ -36,11 +35,11 @@ # configure scripts sed "s@ /etc/\\.relid'@ '/etc/.relid'@" configure > configure.new cat configure.new > configure rm -f configure.new - ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --prefix="${PLATDIR}" --libdir="${PLATDIR}" --bindir="${PLATDIR}" + bash ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --prefix="${PLATDIR}" --libdir="${PLATDIR}" --bindir="${PLATDIR}" ${CONFIGUREEXTRA} ${MAKE:-make} || exit 1 ${MAKE:-make} install-binaries PKG_DIR='' || exit 1 Index: server/buildpkgs/platform ================================================================== --- server/buildpkgs/platform +++ server/buildpkgs/platform @@ -1,21 +1,69 @@ #! /bin/bash -case "`uname -s`" in +MAGICFILEFILE="$0.magic.file" +MAGICOSFILE="$0.magic.os" +MAGICPLATFILE="$0.magic.platform" + +OSNAME="`uname -s`" +CPUPLAT="`uname -m`" + +if [ -f "${MAGICFILEFILE}" -a -f "${MAGICOSFILE}" -a -f "${MAGICPLATFILE}" ]; then + MAGICPLAT="$(cat "${MAGICPLATFILE}")" + MAGICOS="$(cat "${MAGICOSFILE}")" + MAGICFILE="$(cat "${MAGICFILEFILE}" | dd conv=lcase 2>/dev/null)" + + case "${MAGICPLAT}" in + unix) + case "${MAGICFILE}" in + *elf*x86-64*) + CPUPLAT="x86_64" + ;; + *elf*intel\ 80386*) + CPUPLAT="ix86" + ;; + *parisc*) + CPUPLAT="parisc" + ;; + *elf*32-bit*sparc*) + CPUPLAT="sparc" + ;; + *elf*64-bit*sparc*) + CPUPLAT="sparc64" + ;; + esac + + if [ "${MAGICOS}" != "`uname -s`" ]; then + # Cross compiling, try to determine OS ... + true + fi + ;; + win) + if grep "64-bit" "${MAGICFILEFILE}" >/dev/null; then + echo "win32-x86_64" + else + echo "win32-ix86" + fi + + exit 0 + ;; + macosx) + ;; + esac +fi + +case "${OSNAME}" in Linux) GLIBCVERS=$(strings /lib/libc.so.6 | grep '^GLIBC_[0-9][0-9]*\.[0-9]*' | cut -f 2- -d _ | cut -f 1-2 -d . | sed 's@\.@ @g' | sort -n +0 +1 | tail -1 | sed 's@ @\.@g') - case "`uname -m`" in + case "${CPUPLAT}" in i?86) CPUPLAT="ix86" ;; sun4?) CPUPLAT="sparc" ;; - *) - CPUPLAT="`uname -m`" - ;; esac echo "linux-glibc${GLIBCVERS}-${CPUPLAT}" ;; SunOS) Index: server/buildpkgs/tls/build.sh ================================================================== --- server/buildpkgs/tls/build.sh +++ server/buildpkgs/tls/build.sh @@ -9,14 +9,13 @@ VERS=1.6 SRC="src/tls${VERS}-src.tar.gz" SRCURL="http://sourceforge.net/projects/tls/files/tls/${VERS}/tls${VERS}-src.tar.gz/download" BUILDDIR="tls${VERS}" WORKDIR="${TMPDIR:-/tmp}/tls-$$${RANDOM}${RANDOM}${RANDOM}" -PLATFORM="$(../platform)" PLATDIR="$(pwd)/out/${PLATFORM}" -export VERS SRC SRCURL BUILDDIR WORKDIR PLATFORM PLATDIR +export VERS SRC SRCURL BUILDDIR WORKDIR PLATDIR if [ ! -f "${SRC}" ]; then mkdir src >/dev/null 2>/dev/null wget -O "${SRC}" "${SRCURL}" || exit 1 @@ -37,11 +36,11 @@ done if [ -z "${SSLDIR}" ]; then SSLDIR="/usr" fi - ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}" + bash ./configure --enable-shared --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}" ${CONFIGUREEXTRA} ${MAKE:-make} || exit 1 ) || exit 1 ( mkdir -p "${PLATDIR}" >/dev/null 2>/dev/null