From 6dee0885b727f7f8da484ce5eda5599024a671de Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 27 Jan 2020 14:42:06 +0100 Subject: initial commit of mewix --- COPYING | 4 +++ KEEP/s6-update-symlinks.static | Bin 0 -> 51912 bytes build-template | 13 ++++++++ def/bash | 6 ++++ def/binutils | 9 ++++++ def/bzip2 | 31 ++++++++++++++++++ def/chroot-util-linux | 15 +++++++++ def/coreutils | 6 ++++ def/curl | 4 +++ def/diffutils | 3 ++ def/file | 3 ++ def/findutils | 10 ++++++ def/gawk | 7 ++++ def/gcc | 16 ++++++++++ def/gmp | 3 ++ def/grep | 3 ++ def/gzip | 3 ++ def/libarchive | 3 ++ def/libressl | 3 ++ def/m4 | 3 ++ def/make | 3 ++ def/mpc | 3 ++ def/mpfr | 3 ++ def/musl | 13 ++++++++ def/patch | 5 +++ def/sed | 3 ++ def/xz | 3 ++ def/zlib | 7 ++++ enter-newroot | 11 +++++++ install-pkg | 9 ++++++ lib1.sh | 71 +++++++++++++++++++++++++++++++++++++++++ lib2.sh | 22 +++++++++++++ make-mewix-base | 16 ++++++++++ make-mewix-bootstrap | 9 ++++++ make-void-base-chroot | 1 + relink-newroot | 3 ++ 36 files changed, 327 insertions(+) create mode 100644 COPYING create mode 100755 KEEP/s6-update-symlinks.static create mode 100755 build-template create mode 100644 def/bash create mode 100644 def/binutils create mode 100644 def/bzip2 create mode 100644 def/chroot-util-linux create mode 100644 def/coreutils create mode 100644 def/curl create mode 100644 def/diffutils create mode 100644 def/file create mode 100644 def/findutils create mode 100644 def/gawk create mode 100644 def/gcc create mode 100644 def/gmp create mode 100644 def/grep create mode 100644 def/gzip create mode 100644 def/libarchive create mode 100644 def/libressl create mode 100644 def/m4 create mode 100644 def/make create mode 100644 def/mpc create mode 100644 def/mpfr create mode 100644 def/musl create mode 100644 def/patch create mode 100644 def/sed create mode 100644 def/xz create mode 100644 def/zlib create mode 100755 enter-newroot create mode 100755 install-pkg create mode 100644 lib1.sh create mode 100644 lib2.sh create mode 100755 make-mewix-base create mode 100755 make-mewix-bootstrap create mode 100755 make-void-base-chroot create mode 100755 relink-newroot diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..24bbce0 --- /dev/null +++ b/COPYING @@ -0,0 +1,4 @@ +To the extent possible under law, the creator of this work has waived +all copyright and related or neighboring rights to this work. + +http://creativecommons.org/publicdomain/zero/1.0/ diff --git a/KEEP/s6-update-symlinks.static b/KEEP/s6-update-symlinks.static new file mode 100755 index 0000000..859103d Binary files /dev/null and b/KEEP/s6-update-symlinks.static differ diff --git a/build-template b/build-template new file mode 100755 index 0000000..5fe652c --- /dev/null +++ b/build-template @@ -0,0 +1,13 @@ +#!/bin/sh + +rm -rf dst +mkdir dst + +cat lib1.sh $1 lib2.sh | ./enter-newroot + +for d in dst/*/*; do + [ -d "$d" ] || continue + + tar czvf pkg/$( echo "$d" | sed 's/^dst\///; s:/:@:g' ).tar.xz -C $d . --sort=name --mtime="@0" --owner=0 --group=0 --numeric-owner + echo $d +done diff --git a/def/bash b/def/bash new file mode 100644 index 0000000..0ab65a1 --- /dev/null +++ b/def/bash @@ -0,0 +1,6 @@ +pkgname=bash +version=5.0 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.gz" +# XXX add patches +configure_args="--without-bash-malloc --without-curses + --without-installed-readline --disable-nls bash_cv_termcap_lib=gnutermcap" diff --git a/def/binutils b/def/binutils new file mode 100644 index 0000000..1f97a66 --- /dev/null +++ b/def/binutils @@ -0,0 +1,9 @@ +pkgname=binutils +version=2.33.1 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" +configure_args="--build=x86_64-linux-musl --enable-threads + --enable-plugins --enable-secureplt --with-mmap + --disable-shared --enable-gold --disable-werror + --enable-deterministic-archives --enable-ld=default + --disable-nls" +make_install_args="tooldir=/usr" diff --git a/def/bzip2 b/def/bzip2 new file mode 100644 index 0000000..00c66db --- /dev/null +++ b/def/bzip2 @@ -0,0 +1,31 @@ +pkgname=bzip2 +version=1.0.8 +distfiles="https://sourceware.org/pub/${pkgname}/${pkgname}-${version}.tar.gz" + +do_build() { + make ${makejobs} CFLAGS="$CFLAGS -fPIC $LDFLAGS" LDFLAGS="$LDFLAGS" -f Makefile-libbz2_so + make ${makejobs} CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" bzip2recover libbz2.a +} + +do_install() { + # XXX ugly + + install -Dm755 bzip2-shared $DESTDIR/usr/bin/bzip2 + install -Dm755 bzip2recover $DESTDIR/usr/bin/ + ln -sf bzip2 ${DESTDIR}/usr/bin/bunzip2 + ln -sf bzip2 ${DESTDIR}/usr/bin/bzcat + install -m755 bzdiff bzgrep bzmore ${DESTDIR}/usr/bin + + install -Dm644 libbz2.so.${version} ${DESTDIR}/usr/lib/libbz2.so.${version} + ln -s libbz2.so.${version} ${DESTDIR}/usr/lib/libbz2.so + ln -s libbz2.so.${version} ${DESTDIR}/usr/lib/libbz2.so.1 + ln -s libbz2.so.${version} ${DESTDIR}/usr/lib/libbz2.so.1.0 + + install -Dm644 libbz2.a ${DESTDIR}/usr/lib/libbz2.a + install -Dm644 bzlib.h ${DESTDIR}/usr/include/bzlib.h + + install -Dm644 bzip2.1 ${DESTDIR}/usr/share/man/man1/bzip2.1 + ln -sf bzip2.1 ${DESTDIR}/usr/share/man/man1/bunzip2.1 + ln -sf bzip2.1 ${DESTDIR}/usr/share/man/man1/bzcat.1 + ln -sf bzip2.1 ${DESTDIR}/usr/share/man/man1/bzip2recover.1 +} diff --git a/def/chroot-util-linux b/def/chroot-util-linux new file mode 100644 index 0000000..61a5cb6 --- /dev/null +++ b/def/chroot-util-linux @@ -0,0 +1,15 @@ +pkgname=chroot-util-linux +version=2.32.1 +distfiles="https://www.kernel.org/pub/linux/utils/util-linux/v${version%.*}/util-linux-${version}.tar.xz" +configure_args=" + --without-ncurses --without-ncursesw --without-udev + --without-systemd --disable-libuuid --disable-libblkid --disable-libmount + --disable-mount --disable-losetup --disable-fsck --disable-partx --disable-uuidd + --disable-mountpoint --disable-fallocate --disable-unshare --disable-nls + --disable-wall --disable-chfn-chsh-password --disable-su --disable-sulogin + --disable-login --disable-runuser --disable-setpriv --disable-libsmartcols" + +post_install() { + rm -rf ${DESTDIR}/sbin + rm -rf ${DESTDIR}/usr/sbin +} diff --git a/def/coreutils b/def/coreutils new file mode 100644 index 0000000..8a9ef4e --- /dev/null +++ b/def/coreutils @@ -0,0 +1,6 @@ +pkgname=coreutils +version=8.31 +distfiles="http://ftp.gnu.org/gnu/coreutils/coreutils-8.31.tar.xz" +configure_args=" --enable-install-program=arch,hostname + --enable-no-install-program=kill,uptime + --disable-rpath" diff --git a/def/curl b/def/curl new file mode 100644 index 0000000..a780cc7 --- /dev/null +++ b/def/curl @@ -0,0 +1,4 @@ +pkgname=curl +version=7.68.0 +distfiles="https://curl.haxx.se/download/curl-7.67.0.tar.bz2" +configure_args="--with-ssl --with-zlib" diff --git a/def/diffutils b/def/diffutils new file mode 100644 index 0000000..1b1a8e5 --- /dev/null +++ b/def/diffutils @@ -0,0 +1,3 @@ +pkgname=diffutils +version=3.7 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" diff --git a/def/file b/def/file new file mode 100644 index 0000000..11b61f1 --- /dev/null +++ b/def/file @@ -0,0 +1,3 @@ +pkgname=file +version=5.37 +distfiles="ftp://ftp.astron.com/pub/${pkgname}/${pkgname}-${version}.tar.gz" diff --git a/def/findutils b/def/findutils new file mode 100644 index 0000000..7305e9d --- /dev/null +++ b/def/findutils @@ -0,0 +1,10 @@ +pkgname=findutils +version=4.7.0 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" + +post_extract() { + sed -i '/SUBDIRS/s/locate//' Makefile.in +} +pre_build() { + make -C locate dblocation.texi +} diff --git a/def/gawk b/def/gawk new file mode 100644 index 0000000..664bead --- /dev/null +++ b/def/gawk @@ -0,0 +1,7 @@ +pkgname=gawk +version=5.0.1 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" + +post_install() { + rm -rf ${DESTDIR}/usr/etc +} diff --git a/def/gcc b/def/gcc new file mode 100644 index 0000000..56d8d8e --- /dev/null +++ b/def/gcc @@ -0,0 +1,16 @@ +pkgname=gcc +version=9.2.0 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}/${pkgname}-${version}.tar.xz" + +configure_args="--enable-languages=c,c++,lto --disable-multilib --disable-libsanitizer --build=x86_64-linux-musl" + +post_extract() { + # disable fixinc crap + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + + # use lib not lib64 by default + sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 + sed -i 's/lib64/lib/' gcc/config/i386/linux64.h +} + +# XXX posix c89 wrappers diff --git a/def/gmp b/def/gmp new file mode 100644 index 0000000..dc00b4d --- /dev/null +++ b/def/gmp @@ -0,0 +1,3 @@ +pkgname=gmp +version=6.1.2 +distfiles="http://gmplib.org/download/${pkgname}/${pkgname}-${version}.tar.xz" diff --git a/def/grep b/def/grep new file mode 100644 index 0000000..5e7b10f --- /dev/null +++ b/def/grep @@ -0,0 +1,3 @@ +pkgname=grep +version=3.3 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" diff --git a/def/gzip b/def/gzip new file mode 100644 index 0000000..f9d008e --- /dev/null +++ b/def/gzip @@ -0,0 +1,3 @@ +pkgname=gzip +version=1.10 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" diff --git a/def/libarchive b/def/libarchive new file mode 100644 index 0000000..fd3eadf --- /dev/null +++ b/def/libarchive @@ -0,0 +1,3 @@ +pkgname=libarchive +version=3.4.0 +distfiles="https://github.com/libarchive/libarchive/releases/download/v${version}/libarchive-${version}.tar.gz" diff --git a/def/libressl b/def/libressl new file mode 100644 index 0000000..aea9f10 --- /dev/null +++ b/def/libressl @@ -0,0 +1,3 @@ +pkgname=libressl +version=3.0.2 +distfiles="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${pkgname}-${version}.tar.gz" diff --git a/def/m4 b/def/m4 new file mode 100644 index 0000000..d70b61f --- /dev/null +++ b/def/m4 @@ -0,0 +1,3 @@ +pkgname=m4 +version=1.4.18 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" diff --git a/def/make b/def/make new file mode 100644 index 0000000..824f7e9 --- /dev/null +++ b/def/make @@ -0,0 +1,3 @@ +pkgname=make +version=4.2.1 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.bz2" diff --git a/def/mpc b/def/mpc new file mode 100644 index 0000000..6a91e23 --- /dev/null +++ b/def/mpc @@ -0,0 +1,3 @@ +pkgname=mpc +version=1.1.0 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.gz" diff --git a/def/mpfr b/def/mpfr new file mode 100644 index 0000000..6be4b72 --- /dev/null +++ b/def/mpfr @@ -0,0 +1,3 @@ +pkgname=mpfr +version=4.0.2 +distfiles="http://www.mpfr.org/${pkgname}-${version}/${pkgname}-${version}.tar.xz" diff --git a/def/musl b/def/musl new file mode 100644 index 0000000..dfe73d4 --- /dev/null +++ b/def/musl @@ -0,0 +1,13 @@ +pkgname=musl +version=1.1.24 +configure_args="--prefix=/usr --disable-gcc-wrapper" +distfiles="http://www.musl-libc.org/releases/${pkgname}-${version}.tar.gz" + +do_install() { + mkdir -p $DESTDIR/usr/lib $DESTDIR/usr/bin + ln -sfr ${DESTDIR}/usr/lib ${DESTDIR}/lib + make DESTDIR=${DESTDIR} install + rm ${DESTDIR}/lib + ln -s /usr/lib/libc.so ${DESTDIR}/usr/bin/ldd + ln -s true ${DESTDIR}/usr/bin/ldconfig +} diff --git a/def/patch b/def/patch new file mode 100644 index 0000000..b99aea5 --- /dev/null +++ b/def/patch @@ -0,0 +1,5 @@ +pkgname=patch +version=2.7.6 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" +# XXX many CVE unpatched +# XXX ./usr/lib/charset.alias diff --git a/def/sed b/def/sed new file mode 100644 index 0000000..847ab9f --- /dev/null +++ b/def/sed @@ -0,0 +1,3 @@ +pkgname=sed +version=4.7 +distfiles="http://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${version}.tar.xz" diff --git a/def/xz b/def/xz new file mode 100644 index 0000000..c9e3802 --- /dev/null +++ b/def/xz @@ -0,0 +1,3 @@ +pkgname=xz +version=5.2.4 +distfiles="https://tukaani.org/${pkgname}/${pkgname}-${version}.tar.bz2" diff --git a/def/zlib b/def/zlib new file mode 100644 index 0000000..c7a4824 --- /dev/null +++ b/def/zlib @@ -0,0 +1,7 @@ +pkgname=zlib +version=1.2.11 +distfiles="http://www.zlib.net/${pkgname}-${version}.tar.gz" + +do_configure() { + LDFLAGS= LDSHAREDLIBC= ./configure --prefix=/usr --shared +} diff --git a/enter-newroot b/enter-newroot new file mode 100755 index 0000000..868bb0e --- /dev/null +++ b/enter-newroot @@ -0,0 +1,11 @@ +#!/bin/sh + +bwrap --hostname mewix --unshare-uts --unshare-user --share-net \ + --bind $PWD/newroot / \ + --bind $PWD/dst /dst \ + --bind $PWD/cache /cache \ + --bind $PWD/tmp /tmp \ + --proc /proc \ + --dev /dev \ + --setenv PATH /bin --setenv XBPS_ARCH x86_64-musl /bin/sh + # --tmpfs /tmp \ diff --git a/install-pkg b/install-pkg new file mode 100755 index 0000000..2201c96 --- /dev/null +++ b/install-pkg @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +for pkg; do + name=${pkg##*/} + name=${name%.tar.xz} + mkdir -p newroot/pkg/$(echo "$name" | sed 's:@:/:g') + tar xf $pkg -C newroot/pkg/$(echo "$name" | sed 's:@:/:g') +done diff --git a/lib1.sh b/lib1.sh new file mode 100644 index 0000000..a54f6d3 --- /dev/null +++ b/lib1.sh @@ -0,0 +1,71 @@ +set -e + +pre_fetch() { :; } +do_fetch() { + cd /cache + curl -L -f -C - -O $distfiles +} +post_fetch() { :; } + +pre_extract() { :; } +do_extract() { + for d in $distfiles; do + tar xf ${d##*/} -C /tmp + done + + cd /tmp + + for d in $distfiles; do + arch=${d##*/} + dir=${arch} + dir=${dir%.gz} + dir=${dir%.xz} + dir=${dir%.bz2} + dir=${dir%.tgz} + dir=${dir%.tbz} + dir=${dir%.txz} + dir=${dir%.tar} + cd $dir + break # first distfile only + done +} +post_extract() { :; } + +pre_patch() { :; } +do_patch() { + : XXX +} +post_patch() { :; } + +pre_configure() { :; } +do_configure() { + if [ -x ./configure ]; then + ./configure $configure_args + fi +} +post_configure() { :; } + +pre_build() { :; } +do_build() { + make \ + CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ + ${makejobs} ${make_default_target} ${make_default_args} +} +post_build() { :; } + +pre_check() { :; } +do_check() { + : XXX +} +post_check() { :; } + +pre_install() { :; } +do_install() { + make PREFIX=/usr DESTDIR=${DESTDIR} ${make_install_target} ${make_install_args} +} +post_install() { :; } + +verbose() { + printf "=> %s\n" "$*" + "$@" +} diff --git a/lib2.sh b/lib2.sh new file mode 100644 index 0000000..ea7cbe0 --- /dev/null +++ b/lib2.sh @@ -0,0 +1,22 @@ +[ -z "$pkgname" ] && error "pkgname unset" +[ -z "$version" ] && error "version unset" + +: ${distfiles:=""} +configure_args="--prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --bindir=/usr/bin --mandir=/usr/share/man --infodir=/usr/share/info --libexecdir=/usr/lib --localstatedir=/var ${configure_args}" +: ${makejobs:=-j16} +: ${make_default_target:=all} +: ${make_default_args:=} +: ${CC:=gcc} +: ${CXX:=g++} +: ${CFLAGS:=-O2 -pipe -fstack-protector-strong -fstack-clash-protection -D_FORTIFY_SOURCE=2} +: ${CXXFLAGS:=$CFLAGS} +: ${LDFLAGS:=-Wl,-z,relro -Wl,-z,now} +: ${make_install_target:=install} +: ${make_install_args:=} +: ${DESTDIR:=/dst/$pkgname/$version} + +for s in fetch extract configure build check install; do + verbose pre_$s + verbose do_$s + verbose post_$s +done diff --git a/make-mewix-base b/make-mewix-base new file mode 100755 index 0000000..e088a16 --- /dev/null +++ b/make-mewix-base @@ -0,0 +1,16 @@ +#!/bin/sh + +mkdir newroot + +mkdir -p newroot/pkg + +mkdir -p newroot/etc +echo 'nameserver 8.8.8.8' >newroot/etc/resolv.conf + +ln -s usr/bin newroot/bin +ln -s usr/lib newroot/lib +ln -s usr/lib newroot/lib64 + +mkdir -p newroot/pkg/s6-portable-utils/0/usr/bin +cp KEEP/s6-update-symlinks.static newroot/pkg/s6-portable-utils/0/usr/bin/s6-update-symlinks + diff --git a/make-mewix-bootstrap b/make-mewix-bootstrap new file mode 100755 index 0000000..b6390bc --- /dev/null +++ b/make-mewix-bootstrap @@ -0,0 +1,9 @@ +#!/bin/sh + + +mkdir -p newroot/pkg/zzz-void-base-chroot/0/ +cp -a void-base-chroot/usr newroot/pkg/zzz-void-base-chroot/0/ +ln -s bsdtar newroot/pkg/zzz-void-base-chroot/0/usr/bin/tar + +# XXX hack +cp -a void-base-chroot/etc/ssl newroot/etc diff --git a/make-void-base-chroot b/make-void-base-chroot new file mode 100755 index 0000000..1e1c781 --- /dev/null +++ b/make-void-base-chroot @@ -0,0 +1 @@ +XBPS_ARCH=x86_64-musl xbps-install -M -Sy -R https://alpha.de.repo.voidlinux.org/current/musl/ -r void-base-chroot base-chroot curl diff --git a/relink-newroot b/relink-newroot new file mode 100755 index 0000000..d607db9 --- /dev/null +++ b/relink-newroot @@ -0,0 +1,3 @@ +#!/bin/sh + +bwrap --unshare-user --share-net --bind $PWD/newroot / --setenv PATH /bin --setenv XBPS_ARCH x86_64-musl /pkg/s6-portable-utils/0/usr/bin/s6-update-symlinks /usr $(find newroot/pkg -name usr -type d | sed 's/^newroot//' |sort -r) -- cgit 1.4.1