diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-11-18 10:05:27 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-11-18 10:05:27 -0500 |
commit | aa7e99e130b47caebaacd24e6d9e4f89f42cd213 (patch) | |
tree | 5b599c731389e0b259b840710f8db1ffe9913181 | |
parent | 79a4dcec2e34c5d58ab0661146ee9727452d672b (diff) | |
download | spm-aa7e99e130b47caebaacd24e6d9e4f89f42cd213.tar.gz |
Next chunk
-rw-r--r-- | Dockerfile | 2 | ||||
-rw-r--r-- | include/build.order | 9 | ||||
-rwxr-xr-x | run-image.sh | 11 | ||||
-rw-r--r-- | scripts/autoconf/build.sh | 1 | ||||
-rw-r--r-- | scripts/base/build.sh | 4 | ||||
-rw-r--r-- | scripts/git/build.sh | 16 | ||||
-rw-r--r-- | scripts/glib/build.sh | 34 | ||||
-rw-r--r-- | scripts/icu/build.sh | 9 | ||||
-rw-r--r-- | scripts/libexpat/build.sh | 1 | ||||
-rw-r--r-- | scripts/libxml2/build.sh | 8 | ||||
-rw-r--r-- | scripts/patchelf/build.sh | 5 | ||||
-rw-r--r-- | scripts/pcre/build.sh | 2 | ||||
-rw-r--r-- | scripts/pkg-config/build.sh | 28 | ||||
-rw-r--r-- | scripts/python-pip/build.sh | 1 | ||||
-rw-r--r-- | scripts/readline/build.sh | 1 | ||||
-rw-r--r-- | scripts/reloc/build.sh | 27 | ||||
-rw-r--r-- | scripts/sed/build.sh | 7 | ||||
-rw-r--r-- | scripts/sqlite/build.sh | 7 | ||||
-rw-r--r-- | scripts/util-linux/build.sh | 29 | ||||
-rwxr-xr-x | spm | 57 |
20 files changed, 232 insertions, 27 deletions
@@ -21,7 +21,7 @@ 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 \ + && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ && make \ && make install \ && cd /build diff --git a/include/build.order b/include/build.order index 8494460..b04f3c7 100644 --- a/include/build.order +++ b/include/build.order @@ -5,9 +5,11 @@ scripts/zlib scripts/gzip scripts/bzip2 scripts/patch +scripts/m4 scripts/autoconf scripts/automake -scripts/m4 +scripts/libtool +scripts/patchelf scripts/tar scripts/base scripts/grep @@ -19,12 +21,17 @@ scripts/diffutils scripts/findutils scripts/bison scripts/gdbm +scripts/cmake +scripts/reloc scripts/libffi scripts/openssl scripts/curl scripts/sqlite scripts/tcl scripts/tk +scripts/gettext +scripts/libexpat +scripts/git scripts/python scripts/python-setuptools scripts/python-pip diff --git a/run-image.sh b/run-image.sh new file mode 100755 index 0000000..872b08e --- /dev/null +++ b/run-image.sh @@ -0,0 +1,11 @@ +#!/bin/bash +d="$(pwd)" +image=spm + +docker build -t ${image} . +docker run \ + --rm -it \ + -v $d/../pkgs:/build/pkgs \ + -v $d/../sources:/build/sources \ + -v $d/scripts:/build/scripts \ + ${image} diff --git a/scripts/autoconf/build.sh b/scripts/autoconf/build.sh index 4eef9a6..b2191db 100644 --- a/scripts/autoconf/build.sh +++ b/scripts/autoconf/build.sh @@ -9,6 +9,7 @@ depends=( "m4" "xz" ) +build_depends=("${depends[@]}") function prepare() { diff --git a/scripts/base/build.sh b/scripts/base/build.sh index 8ecae46..5435ddd 100644 --- a/scripts/base/build.sh +++ b/scripts/base/build.sh @@ -3,12 +3,11 @@ name=base version=1.0.0 revision=0 sources=() -build_depends=() depends=( # development tools #"autoconf" #"automake" - #"binutils" + "binutils" "gcc" #"m4" # file manipulation @@ -17,6 +16,7 @@ depends=( #"grep" #"sed" #"patch" + "patchelf" # archivers #"tar" # compression diff --git a/scripts/git/build.sh b/scripts/git/build.sh index 62a058c..fa1ce98 100644 --- a/scripts/git/build.sh +++ b/scripts/git/build.sh @@ -6,12 +6,21 @@ sources=( "https://github.com/${name}/${name}/archive/v${version}.tar.gz" ) build_depends=( + "autoconf" "automake" + "curl" "gettext" "libtool" + "openssl" + "pcre" + "tk" + "zlib" ) depends=( "curl" + "openssl" + "pcre" + "tk" "zlib" ) @@ -22,8 +31,13 @@ function prepare() { } function build() { + export LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/lib" make configure - ./configure --prefix=$prefix + ./configure --prefix=$prefix \ + --libdir=$prefix/lib \ + --with-curl \ + --with-expat \ + --with-tcltk make -j${maxjobs} } diff --git a/scripts/glib/build.sh b/scripts/glib/build.sh new file mode 100644 index 0000000..fecdbd7 --- /dev/null +++ b/scripts/glib/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash +name=glib +version=2.63.1 +revision=0 +sources=( + "https://download.gnome.org/sources/${name}/2.63/${name}-${version}.tar.xz" +) +build_depends=( + "automake" + "autoconf" + "gettext" + "xz" +) +depends=( + "cmake" + "gettext" + "python-pip" +) + +function prepare() { + tar xf ${name}-${version}.tar.xz + cd ${name}-${version} +} + +function build() { + pip install meson + meson --prefix="${prefix}" _build + ninja -C _build + make -j${maxjobs} +} + +function package() { + DESTDIR="${destroot}" ninja -C _build install +} diff --git a/scripts/icu/build.sh b/scripts/icu/build.sh index 812c4c4..55b80aa 100644 --- a/scripts/icu/build.sh +++ b/scripts/icu/build.sh @@ -9,16 +9,15 @@ build_depends=( "automake" "autoconf" "patch" + "python" ) -depends=( - "base" -) +depends=() + 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 + #patch -p0 -i "${build_script_root}/0001-disable-tests.patch" } function build() { diff --git a/scripts/libexpat/build.sh b/scripts/libexpat/build.sh index 769150d..6a70b38 100644 --- a/scripts/libexpat/build.sh +++ b/scripts/libexpat/build.sh @@ -6,6 +6,7 @@ sources=( "https://github.com/${name}/${name}/archive/R_${version//./_}.tar.gz" ) build_depends=( + "autoconf" "automake" "libtool" ) diff --git a/scripts/libxml2/build.sh b/scripts/libxml2/build.sh index 7f3eee8..d1759d1 100644 --- a/scripts/libxml2/build.sh +++ b/scripts/libxml2/build.sh @@ -8,8 +8,11 @@ sources=( build_depends=( "automake" "autoconf" + "libtool" +) +depends=( + "icu" ) -depends=() function prepare() { tar xf v${version}.tar.gz @@ -17,7 +20,8 @@ function prepare() { } function build() { - ./autogen.sh --prefix="${prefix}" + sh autogen.sh + ./configure --prefix="${prefix}" make -j${maxjobs} } diff --git a/scripts/patchelf/build.sh b/scripts/patchelf/build.sh index fb51cfc..694ae09 100644 --- a/scripts/patchelf/build.sh +++ b/scripts/patchelf/build.sh @@ -1,11 +1,14 @@ #!/bin/bash +disable_base=1 name=patchelf version=0.10 revision=0 sources=("https://github.com/NixOS/${name}/archive/${version}.tar.gz") build_depends=( - "automake" "autoconf" + "automake" + "gcc" + "binutils" ) depends=() diff --git a/scripts/pcre/build.sh b/scripts/pcre/build.sh index e9364f2..7df7eb9 100644 --- a/scripts/pcre/build.sh +++ b/scripts/pcre/build.sh @@ -8,6 +8,8 @@ sources=( build_depends=( "automake" "autoconf" + "readline" + "zlib" ) depends=( "bzip2" diff --git a/scripts/pkg-config/build.sh b/scripts/pkg-config/build.sh new file mode 100644 index 0000000..42a97b0 --- /dev/null +++ b/scripts/pkg-config/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash +name=pkg-config +version=0.29.2 +revision=0 +sources=( + "https://pkg-config.freedesktop.org/releases/${name}-${version}.tar.gz" +) +build_depends=( + "automake" + "autoconf" +) +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/python-pip/build.sh b/scripts/python-pip/build.sh index e2ba34c..b379c3f 100644 --- a/scripts/python-pip/build.sh +++ b/scripts/python-pip/build.sh @@ -4,6 +4,7 @@ version=19.2.3 revision=0 sources=(https://github.com/pypa/${name/python-/}/archive/${version}.tar.gz) depends=( + 'git' 'python-3' 'python-setuptools' ) diff --git a/scripts/readline/build.sh b/scripts/readline/build.sh index 48c8468..bc1b6b9 100644 --- a/scripts/readline/build.sh +++ b/scripts/readline/build.sh @@ -8,6 +8,7 @@ sources=( build_depends=( "automake" "autoconf" + "ncurses" ) depends=( "ncurses" diff --git a/scripts/reloc/build.sh b/scripts/reloc/build.sh new file mode 100644 index 0000000..6f0c159 --- /dev/null +++ b/scripts/reloc/build.sh @@ -0,0 +1,27 @@ +#!/bin/bash +name=reloc +version=1.0.0 +revision=0 +sources=( + "https://github.com/jhunkeler/${name}/archive/${version}.tar.gz" +) +build_depends=( + "cmake" +) +depends=() + +function prepare() { + tar xf ${version}.tar.gz + cd ${name}-${version} + mkdir -p build + cd build +} + +function build() { + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${prefix}" + make -j${maxjobs} +} + +function package() { + make install DESTDIR="${destdir}" +} diff --git a/scripts/sed/build.sh b/scripts/sed/build.sh index 5042713..ad0090f 100644 --- a/scripts/sed/build.sh +++ b/scripts/sed/build.sh @@ -5,7 +5,12 @@ revision=0 sources=( "http://mirror.rit.edu/gnu/${name}/${name}-${version}.tar.xz" ) -depends=("grep-3.3-0.tar.gz") +build_depends=( + "xz" +) +depends=( + "grep" +) function prepare() { diff --git a/scripts/sqlite/build.sh b/scripts/sqlite/build.sh index 2b00088..4c2f1d4 100644 --- a/scripts/sqlite/build.sh +++ b/scripts/sqlite/build.sh @@ -9,8 +9,13 @@ sources=( build_depends=( "automake" "autoconf" + "readline" + "zlib" +) +depends=( + "readline" + "zlib" ) -depends=() function prepare() { diff --git a/scripts/util-linux/build.sh b/scripts/util-linux/build.sh new file mode 100644 index 0000000..8a9b65c --- /dev/null +++ b/scripts/util-linux/build.sh @@ -0,0 +1,29 @@ +#!/bin/bash +name=util-linux +version=2.34 +revision=0 +sources=( + "https://mirrors.edge.kernel.org/pub/linux/utils/${name}/v${version}/${name}-${version}.tar.gz" +) +depends=( + "autoconf" + "automake" + "libtool" +) + + +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}" +} + + @@ -46,6 +46,17 @@ function spm_rpath_nearest() { local cwd="$(pwd)" local start=$(dirname $(spm_abspath ${1})) local result= + local lib_forced=0 + local install_root="${destdir}/${prefix_placeholder}" + + # Determine if package produced its own "lib" directory. If not, generate a symlink + # pointing back to the build's runtime environment. + if [[ ! -d ${install_root}/lib ]] && [[ ! -L ${install_root}/lib ]]; then + pushd "${install_root}" &>/dev/null + ln -sf "${build_runtime}"/lib + popd &>/dev/null + lib_forced=1 + fi # Jump to location of file cd "$(dirname ${start})" @@ -58,19 +69,25 @@ function spm_rpath_nearest() { while [[ $(pwd) != / ]] do result+="../" - if [[ -d lib ]] || [[ $(pwd) == ${SPM_ENV} ]] || [[ $(pwd) == *${prefix} ]]; then - 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; + if [[ -d $(pwd)/lib/ ]]; then + # There are edge cases when the lib directory one level above an executable + # doesn't contain any shared libraries (i.e. binutils) + if (( ! $(find . -type f -name "*.so" 2>/dev/null | wc -l) )); then + cd .. + continue fi + result+="lib" + break fi cd .. done + # If we created a symlink to the runtime environment, remove it + if (( $lib_forced > 0)); then + rm -f "${install_root}/lib" + lib_forced=0 + fi + # Sanitize: removing double-slashes (if any) result=${result/\/\//\/} @@ -85,14 +102,17 @@ function spm_gen_package_rpath() { local rpath_new # Assimilate all file paths that contain an RPATH - for path in $(find . -type f -not -name '.SPM-*') + for path in $(find . -type f -not -name '.SPM_*') do - readelf -d "${path}" 2>/dev/null | grep RPATH &>/dev/null + readelf -d "${path}" 2>/dev/null | grep 'R.\?.\?PATH' &>/dev/null if (( $? )); then continue fi - rpath_orig="$(readelf -d "${path}" | grep RPATH | awk -F'[][]' '{ print $2 }')" + rpath_orig="$(readelf -d "${path}" | grep 'R.\?.\?PATH' | awk -F'[][]' '{ print $2 }')" rpath_new='$ORIGIN/'"$(spm_rpath_nearest ${path})" + if [[ ${rpath_origin} == ${rpath_new} ]]; then + continue + fi echo "${path}: ${rpath_orig} -> ${rpath_new}" patchelf --set-rpath "${rpath_new}" "${path}" done @@ -256,7 +276,7 @@ function spm_install() { for dep in "${_spm_install_depends[@]}"; do # Track dependencies we have already processed to avoid infinite recursion - if [[ "${_spm_install_seen[@]}" =~ "$dep" ]]; then + if [[ ${_spm_install_seen[@]} =~ $dep ]]; then # Pop dependency and do nothing _spm_install_depends=("${_spm_install_depends[@]:1}") continue @@ -267,12 +287,23 @@ function spm_install() { # Stop processing when the array is totally empty if (( ${#_spm_install_depends[@]} < 0 )); then + _spm_install_depends=() + #_spm_install_seen=() break fi _spm_install_seen+=("${dep}") spm_install "${dep}" "${destroot}" done + + #FIXME + #local prev + #for rec in "${_spm_install_depends[@]}"; do prev="$rec $prev"; done + #_spm_install_depends=($x) + + #for dep in "${_spm_install_depends[@]}"; do + # spm_install "${dep}" "${destroot}" + #done rm -f "${SPM_DEPENDS}" fi @@ -372,6 +403,8 @@ function builder() { if [[ -z $disable_base ]]; then base_package=$(pkg_match "base") if [[ -n ${base_package} ]]; then + # pkg_match returns a path, so just use "base" instead if its there + base_package="base" build_depends+=(${base_package}) depends+=(${base_package}) fi |