diff options
41 files changed, 776 insertions, 96 deletions
@@ -1,4 +1,5 @@ pkgs/ +sources/ tmp/ */*/buildroot */*/root diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ca4cb62 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM centos:6 +RUN yum install -y epel-release && yum clean -y all +RUN yum install -y \ + autoconf \ + automake \ + cmake \ + gcc \ + gcc-c++ \ + gcc-gfortran \ + help2man \ + libX11-devel \ + libxml2-devel \ + patchelf \ + perl \ + rsync \ + && yum clean -y all +WORKDIR /build +COPY spm ./ +COPY include ./include +RUN curl -L https://github.com/jhunkeler/reloc/archive/master.tar.gz | tar zxf - \ + && cd reloc-* \ + && mkdir -p build \ + && cd build \ + && cmake .. -DCMAKE_INSTALL_PREFIX=/usr \ + && make \ + && make install \ + && cd /build diff --git a/include/9999-template.sh b/include/9999-template.sh index 9577ee7..463ecd0 100644 --- a/include/9999-template.sh +++ b/include/9999-template.sh @@ -3,6 +3,7 @@ name= version= revision=0 sources=() +build_depends=() depends=() function prepare() { diff --git a/scripts/build.order b/include/build.order index caac298..8494460 100644 --- a/scripts/build.order +++ b/include/build.order @@ -1,13 +1,17 @@ -scripts/m4 -scripts/autoconf -scripts/automake -scripts/grep -scripts/sed -scripts/bzip2 +scripts/gcc +scripts/binutils scripts/xz scripts/zlib scripts/gzip +scripts/bzip2 +scripts/patch +scripts/autoconf +scripts/automake +scripts/m4 scripts/tar +scripts/base +scripts/grep +scripts/sed scripts/ncurses scripts/readline scripts/pcre diff --git a/scripts/autoconf/build.sh b/scripts/autoconf/build.sh index 09c4f72..4eef9a6 100644 --- a/scripts/autoconf/build.sh +++ b/scripts/autoconf/build.sh @@ -6,7 +6,8 @@ sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" ) depends=( - "m4-1.4.18-0.tar.gz" + "m4" + "xz" ) diff --git a/scripts/automake/build.sh b/scripts/automake/build.sh index 9fe23b7..ffac223 100644 --- a/scripts/automake/build.sh +++ b/scripts/automake/build.sh @@ -1,6 +1,6 @@ #!/bin/bash name=automake -version=1.16 +version=1.16.1 revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" diff --git a/scripts/base/build.sh b/scripts/base/build.sh index 02306da..8ecae46 100644 --- a/scripts/base/build.sh +++ b/scripts/base/build.sh @@ -3,28 +3,32 @@ name=base version=1.0.0 revision=0 sources=() +build_depends=() depends=( # development tools - "autoconf" - "automake" - "m4" + #"autoconf" + #"automake" + #"binutils" + "gcc" + #"m4" # file manipulation - "diffutils" - "findutils" - "grep" - "sed" + #"diffutils" + #"findutils" + #"grep" + #"sed" + #"patch" # archivers - "tar" + #"tar" # compression - "bzip2" - "gzip" - "xz" - "zlib" + #"bzip2" + #"gzip" + #"xz" + #"zlib" # terminal - "ncurses" - "readline" + #"ncurses" + #"readline" # web - "curl" + #"curl" ) function prepare() { @@ -42,6 +46,7 @@ function package() { etc lib libexec + opt sbin tmp var/cache @@ -62,6 +67,8 @@ function package() { mkdir -p "${d}" chmod 0755 "${d}" done + chmod 1777 tmp + chmod 1777 var/tmp ln -sf lib lib64 popd diff --git a/scripts/binutils/build.sh b/scripts/binutils/build.sh new file mode 100644 index 0000000..670efb2 --- /dev/null +++ b/scripts/binutils/build.sh @@ -0,0 +1,42 @@ +#!/bin/bash +disable_base=1 +name=binutils +version=2.31.1 +revision=0 +sources=( + "https://ftp.gnu.org/gnu/${name}/${name}-${version}.tar.gz" +) +depends=("gcc") + +srcdir=${name}-${version} +blddir=${srcdir}_build + + +function prepare() { + tar xf ${name}-${version}.tar.gz + mkdir -p ${blddir} + cd "${blddir}" +} + +function build() { + ../${srcdir}/configure \ + --prefix=${prefix} \ + --libdir=${prefix}/lib \ + --with-lib-path=${prefix}/lib:${build_runtime}/lib:/lib64:/usr/lib64:/usr/local/lib64 \ + --target=x86_64-pc-linux-gnu \ + --enable-shared \ + --enable-lto \ + --enable-ld=default \ + --enable-plugins \ + --enable-threads \ + --disable-static \ + --disable-multilib \ + --with-system-zlib \ + --with-sysroot=/ \ + --with-tune=generic + make -j${maxjobs} +} + +function package() { + make install-strip DESTDIR="${destdir}" +} diff --git a/scripts/bison/build.sh b/scripts/bison/build.sh index 115374e..8cb2636 100644 --- a/scripts/bison/build.sh +++ b/scripts/bison/build.sh @@ -5,8 +5,9 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" ) -depends=( +build_depends=( "m4" + "xz" ) function prepare() { diff --git a/scripts/cfitsio/build.sh b/scripts/cfitsio/build.sh new file mode 100644 index 0000000..1a8d08f --- /dev/null +++ b/scripts/cfitsio/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +name=cfitsio +version=3.47 +revision=0 +sources=( + "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/${name}-${version}.tar.gz" +) +depends=("curl") + + +function prepare() { + tar xf ${name}-${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./configure --prefix=$prefix + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} + + diff --git a/scripts/cmake/build.sh b/scripts/cmake/build.sh new file mode 100644 index 0000000..e2c22f0 --- /dev/null +++ b/scripts/cmake/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +name=cmake +version=3.15.5 +revision=0 +sources=( + "https://github.com/Kitware/CMake/releases/download/v${version}/${name}-${version}.tar.gz" +) +depends=() + + +function prepare() { + tar xf ${name}-${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./bootstrap --prefix="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} + + diff --git a/scripts/curl/build.sh b/scripts/curl/build.sh index 91ef02f..3852638 100644 --- a/scripts/curl/build.sh +++ b/scripts/curl/build.sh @@ -5,9 +5,15 @@ revision=0 sources=( "https://curl.haxx.se/download/${name}-${version}.tar.xz" ) +build_depends=( + "tar" + "xz" + "autoconf" + "automake" +) depends=( - "libffi-3.2.1-0.tar.gz" - "openssl-1.1.1d-0.tar.gz" + "libffi-3.2.1" + "openssl-1.1.1d" ) diff --git a/scripts/diffutils/build.sh b/scripts/diffutils/build.sh index de85ab9..38ead4d 100644 --- a/scripts/diffutils/build.sh +++ b/scripts/diffutils/build.sh @@ -5,7 +5,13 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" ) -depends=() +build_depends=( + "automake" + "autoconf" + "xz" +) +depends=( +) function prepare() { diff --git a/scripts/findutils/build.sh b/scripts/findutils/build.sh index 5429b88..c1f47bc 100644 --- a/scripts/findutils/build.sh +++ b/scripts/findutils/build.sh @@ -5,7 +5,13 @@ revision=0 sources=( "https://ftp.gnu.org/gnu/${name}/${name}-${version}.tar.xz" ) -depends=() +build_depends=( + "automake" + "autoconf" + "xz" +) +depends=( +) function prepare() { diff --git a/scripts/gcc/build.sh b/scripts/gcc/build.sh new file mode 100644 index 0000000..e18d640 --- /dev/null +++ b/scripts/gcc/build.sh @@ -0,0 +1,75 @@ +#!/bin/bash +disable_base=1 +name=gcc +version=8.2.0 +version_cloog=0.18.4 +revision=0 +sources=( + "http://mirrors.concertpass.com/${name}/releases/${name}-${version}/${name}-${version}.tar.gz" + "http://www.bastoul.net/cloog/pages/download/count.php3?url=./cloog-${version_cloog}.tar.gz" +) +depends=() + +srcdir=${name}-${version} +blddir=${src}_build + + +function prepare() { + tar xf ${name}-${version}.tar.gz + tar xf cloog-${version_cloog}.tar.gz -C ${srcdir} + pushd ${srcdir} + ln -s cloog-${version_cloog} cloog + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + ./contrib/download_prerequisites + popd + mkdir -p ${blddir} + cd "${blddir}" +} + +function build() { + ../${srcdir}/configure \ + --prefix=${prefix} \ + --libdir=${prefix}/lib \ + --disable-bootstrap \ + --disable-multilib \ + --disable-werror \ + --disable-libunwind-exceptions \ + --disable-libstdcxx-pch \ + --disable-libssp \ + --with-system-zlib \ + --with-isl \ + --with-linker-hash-style=gnu \ + --with-tune=generic \ + --enable-languages=c,c++,fortran,lto,go \ + --enable-shared \ + --enable-threads=posix \ + --enable-libmpx \ + --enable-__cxa_atexit \ + --enable-clocale=gnu \ + --enable-gnu-unique-object \ + --enable-linker-build-id \ + --enable-lto \ + --enable-plugin \ + --enable-install-libiberty \ + --enable-gnu-indirect-function \ + --enable-default-pie \ + --enable-default-ssp \ + --enable-cet=auto \ + --enable-checking=release + make -j${maxjobs} +} + +function package() { + mkdir -p ${destdir}${prefix}/lib + (cd ${destdir}${prefix} && ln -s lib lib64) + + make install-strip DESTDIR="${destdir}" + + pushd "${destdir}${prefix}"/bin + # support generic calls + ln -sf gcc cc + popd + + # Binutils build cannot use this static archive + rm -f "${destdir}${prefix}/lib/libiberty.a" +} diff --git a/scripts/gdbm/build.sh b/scripts/gdbm/build.sh index 30f65e4..639dcc4 100644 --- a/scripts/gdbm/build.sh +++ b/scripts/gdbm/build.sh @@ -5,7 +5,13 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.gz" ) -depends=() +build_depends=( + "automake" + "autoconf" +) +depends=( + "readline" +) function prepare() { diff --git a/scripts/gettext/build.sh b/scripts/gettext/build.sh new file mode 100644 index 0000000..f8cc174 --- /dev/null +++ b/scripts/gettext/build.sh @@ -0,0 +1,23 @@ +#!/bin/bash +name=gettext +version=0.20.1 +revision=0 +sources=( + "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.gz" +) +build_depends=() +depends=() + +function prepare() { + tar xf ${name}-${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./configure --prefix=$prefix + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} diff --git a/scripts/git/build.sh b/scripts/git/build.sh new file mode 100644 index 0000000..62a058c --- /dev/null +++ b/scripts/git/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash +name=git +version=2.24.0 +revision=0 +sources=( + "https://github.com/${name}/${name}/archive/v${version}.tar.gz" +) +build_depends=( + "automake" + "gettext" + "libtool" +) +depends=( + "curl" + "zlib" +) + + +function prepare() { + tar xf v${version}.tar.gz + cd ${name}-${version} +} + +function build() { + make configure + ./configure --prefix=$prefix + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} + + diff --git a/scripts/grep/build.sh b/scripts/grep/build.sh index 7d396d9..4b7ae47 100644 --- a/scripts/grep/build.sh +++ b/scripts/grep/build.sh @@ -5,6 +5,11 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" ) +build_depends=( + "automake" + "autoconf" + "xz" +) depends=() diff --git a/scripts/gzip/build.sh b/scripts/gzip/build.sh index 686ac5f..3c53f49 100644 --- a/scripts/gzip/build.sh +++ b/scripts/gzip/build.sh @@ -3,15 +3,13 @@ name=gzip version=1.10 revision=0 sources=( - "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" -) -depends=( - "grep-3.3-0.tar.gz" - "sed-4.7-0.tar.gz" + "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.gz" ) +build_depends=() +depends=() function prepare() { - tar xf ${name}-${version}.tar.xz + tar xf ${name}-${version}.tar.gz cd ${name}-${version} } diff --git a/scripts/hstcal/build.sh b/scripts/hstcal/build.sh new file mode 100644 index 0000000..5d59bd8 --- /dev/null +++ b/scripts/hstcal/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash +name=hstcal +version=2.3.1 +revision=0 +sources=() +build_depends=( + "git" + "python-3" +) +depends=( + "cfitsio" +) + + +function prepare() { + git clone https://github.com/spacetelescope/${name} + cd ${name} + git checkout ${version} + curl -L https://waf.io/waf-2.0.18 >../waf + chmod +x ../waf +} + +function build() { + ../waf configure --prefix=$prefix +} + +function package() { + ../waf install --destdir="${destdir}" +} + + diff --git a/scripts/icu/0001-disable-tests.patch b/scripts/icu/0001-disable-tests.patch new file mode 100644 index 0000000..e39989e --- /dev/null +++ b/scripts/icu/0001-disable-tests.patch @@ -0,0 +1,57 @@ +--- configure.ac.orig 2019-10-21 17:47:38.842427296 +0000 ++++ configure.ac 2019-10-21 17:49:33.787593270 +0000 +@@ -199,10 +199,6 @@ fi + #AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true) + #AC_CHECK_PROG(STRIP, strip, strip, true) + +-# TODO(ICU-20301): Remove fallback to Python 2. +-AC_CHECK_PROGS(PYTHON, python3 "py -3" python "py") +-AC_SUBST(PYTHON) +- + # Check for the platform make + AC_PATH_PROGS(U_MAKE, gmake gnumake, make) + AC_SUBST(U_MAKE) +@@ -1412,40 +1408,9 @@ AC_CONFIG_FILES([icudefs.mk \ + samples/cal/Makefile samples/layout/Makefile]) + AC_OUTPUT + +-if test -z "$PYTHON"; +-then +- echo "" > data/rules.mk +- echo "" > test/testdata/rules.mk +-else +- if test -f "$srcdir/data/locales/root.txt"; +- then +- echo "Spawning Python to generate data/rules.mk..." +- PYTHONPATH="$srcdir/python" \ +- $PYTHON -m icutools.databuilder \ +- --mode gnumake \ +- --seqmode parallel \ +- --src_dir "$srcdir/data" \ +- --filter_file "$ICU_DATA_FILTER_FILE" \ +- $ICU_DATA_BUILDTOOL_OPTS \ +- > data/rules.mk +- if test "$?" != "0"; then +- AC_MSG_ERROR(Python failed to run; see above error.) +- fi +- else +- echo "Not rebuilding data/rules.mk, assuming prebuilt data in data/in" +- touch data/rules.mk +- fi +- echo "Spawning Python to generate test/testdata/rules.mk..." +- PYTHONPATH="$srcdir/python" \ +- $PYTHON -m icutools.databuilder \ +- --mode gnumake \ +- --seqmode parallel \ +- --src_dir "$srcdir/test/testdata" \ +- > test/testdata/rules.mk +- if test "$?" != "0"; then +- AC_MSG_ERROR(Python failed to run; see above error.) +- fi +-fi ++# Disable tests ++echo "" > data/rules.mk ++echo "" > test/testdata/rules.mk + + echo + echo "ICU for C/C++ $VERSION is ready to be built." diff --git a/scripts/icu/build.sh b/scripts/icu/build.sh new file mode 100644 index 0000000..812c4c4 --- /dev/null +++ b/scripts/icu/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash +name=icu +version=65.1 +revision=0 +sources=( + "https://github.com/unicode-org/${name}/releases/download/release-${version//./-}/${name}4c-${version//./_}-src.tgz" +) +build_depends=( + "automake" + "autoconf" + "patch" +) +depends=( + "base" +) + +function prepare() { + tar xf ${name}4c-${version//./_}-src.tgz + cd ${name}/source + patch -p0 -i "${build_script_root}/0001-disable-tests.patch" + autoreconf -i -f +} + +function build() { + ./runConfigureICU Linux --prefix="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} diff --git a/scripts/libexpat/build.sh b/scripts/libexpat/build.sh new file mode 100644 index 0000000..769150d --- /dev/null +++ b/scripts/libexpat/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash +name=libexpat +version=2.2.9 +revision=0 +sources=( + "https://github.com/${name}/${name}/archive/R_${version//./_}.tar.gz" +) +build_depends=( + "automake" + "libtool" +) +depends=() + + +function prepare() { + tar xf R_${version//./_}.tar.gz + cd ${name}-R_${version//./_}/expat +} + +function build() { + ./buildconf.sh + ./configure --prefix="${prefix}" \ + --libdir="${prefix}/lib" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} + + diff --git a/scripts/libffi/build.sh b/scripts/libffi/build.sh index 7ac8bfa..9022bed 100644 --- a/scripts/libffi/build.sh +++ b/scripts/libffi/build.sh @@ -5,7 +5,14 @@ revision=0 sources=( ftp://sourceware.org/pub/libffi/${name}-${version}.tar.gz ) -depends=() +build_depends=( + "automake" + "autoconf" + "libtool" +) +depends=( + "base" +) function prepare() { @@ -14,10 +21,15 @@ function prepare() { } function build() { - ./configure --prefix=$prefix --enable-pax_emutramp + ./configure \ + --prefix=$prefix \ + --libdir=$prefix/lib \ + --enable-pax_emutramp make -j${maxjobs} } function package() { make install DESTDIR="${destdir}" + mv "${destdir}/${prefix}/lib64"/* "${destdir}/${prefix}/lib" + rm -rf "${destdir}/${prefix}/lib64" } diff --git a/scripts/libtool/build.sh b/scripts/libtool/build.sh new file mode 100644 index 0000000..db8b4be --- /dev/null +++ b/scripts/libtool/build.sh @@ -0,0 +1,23 @@ +#!/bin/bash +name=libtool +version=2.4.6 +revision=0 +sources=( + "http://ftp.gnu.org/gnu/${name}/${name}-${version}.tar.gz" +) +depends=() + + +function prepare() { + tar xf ${name}-${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./configure --prefix="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} diff --git a/scripts/libuuid/build.sh b/scripts/libuuid/build.sh index dea7aaf..686ab17 100644 --- a/scripts/libuuid/build.sh +++ b/scripts/libuuid/build.sh @@ -6,7 +6,14 @@ sources=( "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.34/util-linux-2.34.tar.xz" "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${version}/util-linux-${version}.tar.xz" ) -depends=() +build_depends=( + "automake" + "autoconf" + "xz" +) +depends=( + "base" +) function prepare() { diff --git a/scripts/libxml2/build.sh b/scripts/libxml2/build.sh new file mode 100644 index 0000000..7f3eee8 --- /dev/null +++ b/scripts/libxml2/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash +name=libxml2 +version=2.9.9 +revision=0 +sources=( + "https://github.com/GNOME/${name}/archive/v${version}.tar.gz" +) +build_depends=( + "automake" + "autoconf" +) +depends=() + +function prepare() { + tar xf v${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./autogen.sh --prefix="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} diff --git a/scripts/m4/build.sh b/scripts/m4/build.sh index c5a5388..d6cda4c 100644 --- a/scripts/m4/build.sh +++ b/scripts/m4/build.sh @@ -5,7 +5,11 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" ) +build_depends=( + "xz" +) depends=( + "patch" ) function prepare() { diff --git a/scripts/ncurses/build.sh b/scripts/ncurses/build.sh index e4b6a55..1f06173 100644 --- a/scripts/ncurses/build.sh +++ b/scripts/ncurses/build.sh @@ -5,7 +5,13 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.gz" ) -depends=() +build_depends=( + "automake" + "autoconf" +) +depends=( + "base" +) function prepare() { @@ -15,6 +21,7 @@ function prepare() { function build() { ./configure --prefix=$prefix \ + --without-static \ --with-shared \ --with-normal \ --without-debug \ @@ -23,10 +30,33 @@ function build() { --enable-pc-files \ --with-cxx-bindings \ --with-cxx-shared \ - --with-manpage-format=normal + --with-manpage-format=normal \ + --with-pkg-config-libdir="${prefix}/lib/pkgconfig" make -j${maxjobs} } function package() { make install DESTDIR="${destdir}" + + # Arch linux maintainers have the right idea here... + + # fool packages looking to link to non-wide-character ncurses libraries + for lib in ncurses ncurses++ form panel menu; do + echo "INPUT(-l${lib}w)" > "${destdir}/${prefix}/lib/lib${lib}.so" + ln -s ${lib}w.pc "${destdir}/${prefix}/lib/pkgconfig/${lib}.pc" + done + + for lib in tic tinfo; do + echo "INPUT(libncursesw.so.${version:0:1})" > "${destdir}/${prefix}/lib/lib${lib}.so" + ln -s libncursesw.so.${version:0:1} "${destdir}/${prefix}/lib/lib${lib}.so.${version:0:1}" + ln -s ncursesw.pc "${destdir}${prefix}/lib/pkgconfig/${lib}.pc" + done + + # some packages look for -lcurses during build + echo 'INPUT(-lncursesw)' > "${destdir}${prefix}/lib/libcursesw.so" + ln -s libncurses.so "${destdir}/${prefix}/lib/libcurses.so" + + # some packages include from ncurses/ + ln -s ncurses "${destdir}/${prefix}/include/ncursesw" + } diff --git a/scripts/patch/build.sh b/scripts/patch/build.sh new file mode 100644 index 0000000..8afc278 --- /dev/null +++ b/scripts/patch/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +name=patch +version=2.7.6 +revision=0 +sources=( + "https://ftp.gnu.org/gnu/${name}/${name}-${version}.tar.gz" +) +depends=() + +function prepare() { + tar xf ${name}-${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./configure --prefix="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} + + diff --git a/scripts/patchelf/build.sh b/scripts/patchelf/build.sh new file mode 100644 index 0000000..fb51cfc --- /dev/null +++ b/scripts/patchelf/build.sh @@ -0,0 +1,27 @@ +#!/bin/bash +name=patchelf +version=0.10 +revision=0 +sources=("https://github.com/NixOS/${name}/archive/${version}.tar.gz") +build_depends=( + "automake" + "autoconf" +) +depends=() + +function prepare() { + tar xf ${version}.tar.gz + cd ${name}-${version} +} + +function build() { + ./bootstrap.sh + ./configure --prefix="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} + + diff --git a/scripts/pcre/build.sh b/scripts/pcre/build.sh index 92f2a37..e9364f2 100644 --- a/scripts/pcre/build.sh +++ b/scripts/pcre/build.sh @@ -5,6 +5,10 @@ revision=0 sources=( "https://ftp.pcre.org/pub/${name}/${name}-${version}.tar.gz" ) +build_depends=( + "automake" + "autoconf" +) depends=( "bzip2" "readline" @@ -25,7 +29,7 @@ function build() { --enable-jit \ --enable-pcregrep-libz \ --enable-pcregrep-libbz2 \ - --enable-pcretest-readline + --enable-pcretest-libreadline make -j${maxjobs} } diff --git a/scripts/python/build.sh b/scripts/python/build.sh index b3d81ad..e286696 100644 --- a/scripts/python/build.sh +++ b/scripts/python/build.sh @@ -6,17 +6,25 @@ revision=0 sources=( "https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz" ) +build_depends=( + "sed-4.7" + "grep-3.3" + "automake" + "autoconf" + "xz" +) depends=( "bzip2-1.0" - "tar-1.32" - "openssl-1.1.1d" + "gdbm" + "libexpat" "libffi-3.2" - "grep-3.3" + "ncurses-6" + "openssl-1.1.1d" + "tar-1.32" "readline-8" - "sed-4.7" "sqlite-3.29" - "zlib-1.2" "tk-8.6" + "zlib-1.2" ) @@ -26,21 +34,19 @@ function prepare() { } function build() { + #zlib="zlib zlibmodule.c ${CFLAGS} ${LDFLAGS} -lz" + #echo "${zlib/=/ }" >> Modules/Setup - zlib="zlib zlibmodule.c ${CFLAGS} ${LDFLAGS} -lz" - echo "${zlib/=/ } >> Modules/Setup" - + export CFLAGS="${CFLAGS} -I${build_runtime}/include/ncursesw" ./configure \ --prefix="${prefix}" \ --enable-ipv6 \ --enable-loadable-sqlite-extensions \ --enable-shared \ --with-computed-gotos \ - --with-lto \ --with-dbmliborder=gdbm:ndbm \ --with-pymalloc \ --with-system-expat \ - --with-system-ffi \ --without-ensurepip make -j${maxjobs} } diff --git a/scripts/readline/build.sh b/scripts/readline/build.sh index e52ed5f..48c8468 100644 --- a/scripts/readline/build.sh +++ b/scripts/readline/build.sh @@ -5,6 +5,10 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.gz" ) +build_depends=( + "automake" + "autoconf" +) depends=( "ncurses" ) diff --git a/scripts/sqlite/build.sh b/scripts/sqlite/build.sh index 3683f0f..2b00088 100644 --- a/scripts/sqlite/build.sh +++ b/scripts/sqlite/build.sh @@ -6,6 +6,10 @@ revision=0 sources=( "https://sqlite.org/2019/${name}-autoconf-${_v}.tar.gz" ) +build_depends=( + "automake" + "autoconf" +) depends=() diff --git a/scripts/tar/build.sh b/scripts/tar/build.sh index 12cd3e6..f17073d 100644 --- a/scripts/tar/build.sh +++ b/scripts/tar/build.sh @@ -3,17 +3,27 @@ name=tar version=1.32 revision=0 sources=( - "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" + "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.gz" +) +build_depends=( + "automake" + "autoconf" +) +depends=( + "bzip2" + "gzip" + "xz" + "zlib" ) -depends=() function prepare() { - tar xf ${name}-${version}.tar.xz + tar xf ${name}-${version}.tar.gz cd ${name}-${version} } function build() { + export FORCE_UNSAFE_CONFIGURE=1 ./configure --prefix=$prefix make -j${maxjobs} } diff --git a/scripts/tcl/build.sh b/scripts/tcl/build.sh index 6fa40c2..6ace545 100644 --- a/scripts/tcl/build.sh +++ b/scripts/tcl/build.sh @@ -5,12 +5,12 @@ revision=0 sources=( "https://prdownloads.sourceforge.net/${name}/${name}${version}-src.tar.gz" ) +build_depends=( + "automake" + "autoconf" +) depends=( - "bzip2-1.0.8-0.tar.gz" - "grep-3.3-0.tar.gz" - "sed-4.7-0.tar.gz" "pcre-8.43-0.tar.gz" - "zlib-1.2.11-0.tar.gz" ) function prepare() { diff --git a/scripts/tk/build.sh b/scripts/tk/build.sh index 9515c27..bdc54f5 100644 --- a/scripts/tk/build.sh +++ b/scripts/tk/build.sh @@ -6,11 +6,12 @@ revision=0 sources=( "https://prdownloads.sourceforge.net/tcl/${name}${version_full}-src.tar.gz" ) +build_depends=( + "tar" + "automake" +) depends=( - "grep-3.3-0.tar.gz" - "sed-4.7-0.tar.gz" - "zlib-1.2.11-0.tar.gz" - "tcl-${version}-0.tar.gz" + "tcl-${version}" ) function prepare() { @@ -20,7 +21,7 @@ function prepare() { function build() { cd unix - ./configure --prefix=$prefix + ./configure --prefix=$prefix --with-tcl=${build_runtime}/lib make -j${maxjobs} } diff --git a/scripts/xz/build.sh b/scripts/xz/build.sh index ea31bdc..99c06de 100644 --- a/scripts/xz/build.sh +++ b/scripts/xz/build.sh @@ -5,10 +5,7 @@ revision=0 sources=( "https://tukaani.org/xz/${name}-${version}.tar.gz" ) -depends=( - "sed-4.7-0.tar.gz" - "grep-3.3-0.tar.gz" -) +depends=() function prepare() { @@ -1,4 +1,5 @@ #!/bin/bash +hash -r function spm_abspath() { local filename="${1}" @@ -17,14 +18,16 @@ function spm_abspath() { SPM_ORIGIN=$(dirname $(spm_abspath $0)) TMPDIR=${TMPDIR:-/tmp} +OLD_PATH="${PATH}" default_script=build.sh -build_order=${SPM_ORIGIN}/scripts/build.order +build_order=${SPM_ORIGIN}/include/build.order build_scripts=$(cat ${build_order}) # TODO: Make this part of MKTC -SPM_PROG_RELOC=$HOME/Documents/work/reloc/reloc +SPM_PROG_RELOC=reloc +SPM_RELOC_COUNT=0 SPM_PREFIX_BIN=.SPM_PREFIX_BIN SPM_PREFIX_TEXT=.SPM_PREFIX_TEXT SPM_DEPENDS=.SPM_DEPENDS @@ -32,7 +35,7 @@ SPM_VERBOSE=0 export prefix_placeholder=_0123456789_0123456789_0123456789_0123456789_0123456789_0123456789_0123456789_ export prefix="/${prefix_placeholder}" -export maxjobs=7 +export maxjobs=4 export pkgdir=${SPM_ORIGIN}/pkgs mkdir -p ${pkgdir} source ${SPM_ORIGIN}/include/9999-template.sh @@ -47,7 +50,7 @@ function spm_rpath_nearest() { # Jump to location of file cd "$(dirname ${start})" - # Scan upward until we find a "lib" directory + # Scan upward until we find a "lib" directory with shared libraries # OR when: # - Top of filesystem is reached (pretty much total failure [missing local dep]) # - Top of active environment is reached (post installation) @@ -56,8 +59,14 @@ function spm_rpath_nearest() { do result+="../" if [[ -d lib ]] || [[ $(pwd) == ${SPM_ENV} ]] || [[ $(pwd) == *${prefix} ]]; then - result+="lib" - break + lib_count=$(find . -type f \( -name '*.so' -o -name '*.dylib' \) | wc -l) + if (( lib_count )); then + result+="lib" + break + elif [[ $(pwd) == *${prefix} ]] && [[ ! -d lib ]]; then + result+="lib" + break; + fi fi cd .. done @@ -129,7 +138,7 @@ function spm_gen_package_prefixes() { (( count_bin++ )) fi - echo "#${prefix}" >> "${outfile}" + echo "#${pkg_prefix}" >> "${outfile}" echo "${path}" >> "${outfile}" done @@ -187,10 +196,7 @@ function spm_install() { while read path; do if [[ -z $path ]]; then continue - elif [[ $path =~ ^# ]]; then - if [[ -z $path ]]; then - continue; - fi + elif [[ $path =~ ^#.* ]]; then prefix_base="${path#\#}" continue fi @@ -200,14 +206,15 @@ function spm_install() { continue fi + if [[ $path =~ .pyc$ ]]; then + continue + fi + if (( $SPM_VERBOSE )); then - if [[ $path =~ .pyc$ ]]; then - continue - fi echo "Relocating binary paths: ${path}" fi - ${SPM_PROG_RELOC} "${prefix_base}" "${destroot}" "${path}" 1>/dev/null - done <<< $(cat "${SPM_PREFIX_BIN}") + ${SPM_PROG_RELOC} "${prefix_base}" "${destroot}" "${path}" "${path}" >/dev/null + done < "${SPM_PREFIX_BIN}" rm -f ${SPM_PREFIX_BIN} fi prefix_base="" @@ -218,9 +225,6 @@ function spm_install() { if [[ -z $path ]]; then continue elif [[ $path =~ ^# ]]; then - if [[ -z $path ]]; then - continue; - fi prefix_base="${path#\#}" continue fi @@ -229,14 +233,16 @@ function spm_install() { echo "WARNING: ${path} does not exist!" >&2 continue fi + + if [[ $path =~ .pyc$ ]]; then + continue + fi + if (( $SPM_VERBOSE )); then - if [[ $path =~ .pyc$ ]]; then - continue - fi echo "Relocating text paths: ${path}" fi sed -i -e "s|${prefix_base}|${destroot}|g" "${path}" - done <<< $(cat "${SPM_PREFIX_TEXT}") + done < "${SPM_PREFIX_TEXT}" rm -f ${SPM_PREFIX_TEXT} fi @@ -283,15 +289,21 @@ function spm_install() { function builder() { for build_script in ${build_scripts}; do + if [[ ${build_script} =~ ^#.* ]]; then + continue + fi if [[ ! -f ${build_script} ]]; then build_script=$(spm_abspath ${build_script}/build.sh) build_script_root=$(dirname ${build_script}) else build_script_root=$(spm_abspath ${build_script}) fi - export build_root="${build_script_root}/buildroot" - export build_runtime="${build_script_root}/runtime" - export destdir="${build_script_root}/root" + + local output_dir="${SPM_ORIGIN}/output/$(basename ${build_script_root})" + export build_sources="${SPM_ORIGIN}/sources/$(basename ${build_script_root})" + export build_root="${output_dir}/buildroot" + export build_runtime="${output_dir}/runtime" + export destdir="${output_dir}/root" export CC=gcc export CXX=g++ @@ -307,6 +319,10 @@ function builder() { exit 1 fi + if [[ ! -d ${build_sources} ]]; then + mkdir -p ${build_sources} + fi + if [[ -d ${build_root} ]]; then rm -rf ${build_root} fi @@ -322,19 +338,57 @@ function builder() { fi mkdir -p ${destdir} - export PATH="${build_runtime}/bin:${build_runtime}/sbin:$PATH" + export PATH="${build_runtime}/bin:${build_runtime}/sbin:$OLD_PATH" export PKG_CONFIG_PATH="${build_runtime}/lib/pkgconfig" pushd ${build_root} &>/dev/null + # Assimilate build script's contents source ${build_script} + + if [[ -f ${pkgdir}/${name}-${version}-${revision}.tar.gz ]]; then + echo "Skipping: Package exists" + popd &>/dev/null + continue + fi + + # Download source files for url in "${sources[@]}"; do - if [[ -f $(basename $url) ]]; then + archive_path="${build_sources}/$(basename $url)" + if [[ -f ${archive_path} ]]; then + echo "Cached source: ${archive_path}" continue fi echo "Downloading source: ${url}" - curl -LO $url + curl -L "$url" > "${archive_path}" done + # Copy source files to build root + for archive in "${build_sources}"/*; do + echo "Copying source to build root: ${archive}" + cp -a "${archive}" "${build_root}" + done + + # Make base package implicit + if [[ -z $disable_base ]]; then + base_package=$(pkg_match "base") + if [[ -n ${base_package} ]]; then + build_depends+=(${base_package}) + depends+=(${base_package}) + fi + fi + + # Install build dependencies + for dep in "${build_depends[@]}"; do + echo "Build depends on: ${dep}" + pkg=$(pkg_match "${dep}") + if [[ -z ${pkg} ]]; then + echo "Package not found" >&2 + exit 1 + fi + spm_install "${pkg}" "${build_runtime}" + done + + # Install package dependencies for dep in "${depends[@]}"; do echo "Depends on: ${dep}" pkg=$(pkg_match "${dep}") @@ -344,14 +398,18 @@ function builder() { fi spm_install "${pkg}" "${build_runtime}" done + + # Rehash the runtime environment hash -r + # No failures allowed in predefined build stages set -e prepare build package set +e + # Post-process the installation root (i.e. make install DESTDIR=${destdir}) if [[ -d ${destdir} ]]; then pushd ${destdir} &>/dev/null if [[ -d ${destdir}/${prefix} ]]; then |