From b2fe4cd61080ecd5bd51c730794cb6d03ab1151b Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Tue, 6 Dec 2022 11:41:17 -0600 Subject: scripts/setup-abuild: work under qemu user properly. --- scripts/setup-abuild | 123 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 90 insertions(+), 33 deletions(-) diff --git a/scripts/setup-abuild b/scripts/setup-abuild index a0f8fb9d0..4333113a8 100755 --- a/scripts/setup-abuild +++ b/scripts/setup-abuild @@ -36,6 +36,33 @@ touch ._${nprl}-${vprl}; rm -fr ${nprl}-${vprl}; fi +## +# musl +# +# This provides the dynamic loader for the foreign (target) arch +# so that we do not have to force building static musl binaries. +# +nmus=musl; +vmus=1.2.3; +test ! -f ._${nmus}-${vmus} && \ +( + test ! -d ${nmus}-${vmus} \ + && curl -s https://musl.libc.org/releases/${nmus}-${vmus}.tar.gz \ + | tar -xzf - \ + ; + cd ${nmus}-${vmus}; + rm -fr x; mkdir x; cd x; + ../configure \ + --prefix="${DEST}" \ + --enable-static \ + --enable-shared \ + ; + make -j$(nproc); + make install; +) +touch ._${nmus}-${vmus}; +rm -fr ${nmus}-${vmus}; + ## # OpenSSL @@ -62,6 +89,30 @@ touch ._${nssl}-${vssl}; rm -fr ${nssl}-${vssl}; +## +# zlib +# +nzlb=zlib; +vzlb=1.2.13; +test ! -f ._${nzlb}-${vzlb} && \ +( + test ! -d ${nzlb}-${vzlb} \ + && curl -s https://www.zlib.net/${nzlb}-${vzlb}.tar.gz \ + | tar -xzf - \ + ; + cd ${nzlb}-${vzlb}; + rm -fr x; mkdir x; cd x; + ../configure \ + --prefix="${DEST}" \ + --static \ + ; + make -j$(nproc); + make install; +) +touch ._${nzlb}-${vzlb}; +rm -fr ${nzlb}-${vzlb}; + + ## # abuild # @@ -78,11 +129,12 @@ test ! -f ._${nbld}-${vbld} && \ # patch -p1 --forward < "${HERE}/patches/0001-etc-apk-keys.diff" || true; # FIXME # patch -p1 --forward < "${HERE}/patches/0001-extra-lib-paths.diff" || true; # FIXME rm -fr x; mkdir x; cd x; - export SSL_CFLAGS="-I${DEST}/include -I${MCMTOOLS}/sys/include"; - export SSL_LDFLAGS="-L${DEST}/lib -L${MCMTOOLS}/sys/lib"; + export SSL_CFLAGS="-I${DEST}/include"; + export SSL_LDFLAGS="-L${DEST}/lib"; export SSL_LIBS="-lssl -lcrypto"; # not in mcmtools - export ZLIB_LIBS="-lz"; # from mcmtools - export CFLAGS="-DABUILD_GROUP=\\\"$(id -gn)\\\""; # default 'abuild' if undefined + export ZLIB_LIBS="-lz"; # do not use from mcmtools + export LDFLAGS="-L${DEST}/lib -lssl -lcrypto"; + export CFLAGS="-DABUILD_GROUP=\\\"$(id -gn)\\\" -static -I${DEST}/include"; # default 'abuild' if undefined sed -i "${DEST}/abuild-${vbld}/abuild-sudo.c" \ -e "s@/sbin/apk@${DEST}/bin/apk@" \ ; # hardcoded @@ -96,26 +148,27 @@ test ! -f ._${nbld}-${vbld} && \ ; # hardcoded ) touch ._${nbld}-${vbld}; -#rm -fr ${nbld}-${vbld}; +rm -fr ${nbld}-${vbld}; ## # util-linux (for 'getopt' used by 'abuild-keygen') # nutl=util-linux; -vutl=2.37.4; +vutl=08431acdf5b3accd0887ab550bfa4efabed751d6; test ! -f ._${nutl}-${vutl} && \ ( test ! -d ${nutl}-${vutl} \ && mkdir ${nutl}-${vutl} \ - && curl -sL https://github.com/karelzak/${nutl}/archive/refs/tags/v${vutl}.tar.gz \ - | tar -C ${nutl}-${vutl} --strip-components=1 -xzf - \ + && git clone https://github.com/karelzak/${nutl}.git ${nutl}-${vutl} \ ; cd ${nutl}-${vutl}; + git checkout ${vutl}; test -f configure || ./autogen.sh; rm -fr x; mkdir x; cd x; ../configure \ --prefix="${DEST}" \ + --host="$(${CC} -dumpmachine)" \ --enable-static \ --disable-shared \ ; @@ -134,16 +187,18 @@ rm -fr ${nutl}-${vutl}; # pkgconf (pkg-config replacement) # npkg=pkgconf; -vpkg=1044bb57ca8a6e6679de63105ffabf6b8e8acfd7; +vpkg=623b8f7851648a5c476de904a8ffed7b7b679aab; # until autoconf 2.71 test ! -f ._${npkg}-${vpkg} && ( test ! -d ${npkg}-${vpkg} \ && git clone https://github.com/${npkg}/${npkg}.git ${npkg}-${vpkg} \ ; cd ${npkg}-${vpkg}; + git checkout ${vpkg}; ./autogen.sh; ./configure \ --prefix="${DEST}" \ + --host="$(${CC} -dumpmachine)" \ --enable-static \ --disable-shared \ --with-system-libdir=/lib:/usr/lib \ @@ -166,7 +221,6 @@ test ! -f ._${nsam}-${vsam} && && git clone https://github.com/michaelforney/${nsam}.git ${nsam}-${vsam} \ ; cd ${nsam}-${vsam}; - CC=gcc \ make -j$(nproc) install \ PREFIX="" \ DESTDIR="${DEST}" \ @@ -181,7 +235,7 @@ rm -fr ${nsam}-${vsam}; # muon (meson replacement) # nmun=muon; -vmun=df7ee57e6d48aa159015e639588f51ab0e35ed03; +vmun=62ce4561b4444e5020dc39aad0381655afeda0d6; test ! -f ._${nmun}-${vmun} && ( test ! -d ${nmun}-${vmun} \ @@ -191,7 +245,6 @@ test ! -f ._${nmun}-${vmun} && sed -i bootstrap.sh \ -e 's/if.*then/if false; then/g' \ ; - CC=gcc \ ./bootstrap.sh \ bootstrap \ ; @@ -199,6 +252,9 @@ test ! -f ._${nmun}-${vmun} && -Dstatic=true \ build \ ; + sed -i build/build.ninja \ + -e "s@\bar\b@${AR}@g" \ + ; samu -C build; cp build/muon "${DEST}/bin"; ) @@ -210,6 +266,7 @@ rm -fr ${nmun}-${vmun}; # apk-tools # # Ariadne says use meson, and 'muon' doesn't work so... kludges! +# Also, '-j' will break the build. # natl=apk-tools; vatl=be4ce40797af9056c79be4dc74ff978f1f4957e4; @@ -234,8 +291,8 @@ test ! -f ._${natl}-${vatl} && \ make clean; make \ INSTALLDIR="${DEST}" \ - CFLAGS="-I${DEST}/include -I${MCMTOOLS}/sys/include -DNEED_STRLCPY" \ - LDFLAGS="-L${DEST}/lib -L${MCMTOOLS}/sys/lib -L${DEST}/${natl}-${vatl}/libfetch" \ + CFLAGS="-I${DEST}/include -DNEED_STRLCPY -Wno-error" \ + LDFLAGS="-L${DEST}/lib -L${DEST}/${natl}-${vatl}/libfetch" \ LIBS="-lapk -lfetch -lssl -lcrypto -lz" \ ; cp src/apk "${DEST}/bin"; @@ -248,23 +305,15 @@ rm -fr ${natl}-${vatl}; # pax-utils # npax=pax-utils; -vpax=1.3.3; +vpax=974b9359c2f89d57e69598572aafcd8f920d79e2; test ! -f ._${npax}-${vpax} && \ ( test ! -d ${npax}-${vpax} \ - && curl -s https://gitweb.gentoo.org/proj/${npax}.git/snapshot/${npax}-${vpax}.tar.gz \ - | tar -xzf - \ + && git clone https://anongit.gentoo.org/git/proj/${npax}.git ${npax}-${vpax} \ ; cd ${npax}-${vpax}; - sed -i Makefile \ - -e '/$(MPAGES)/d' \ - ; - rm -fr x; mkdir x; cd x; - make -j$(nproc) -C .. install \ - PREFIX="${DEST}" \ - MANDIR="${DEST}/man" \ - USE_PYTHON=no \ - ; + git checkout ${vpax}; + muon setup build; ) touch ._${npax}-${vpax}; rm -fr ${npax}-${vpax}; @@ -274,20 +323,28 @@ rm -fr ${npax}-${vpax}; # fakeroot # nfrt=fakeroot; -vfrt=20220118T114129Z:1.27; # look on snapshot.d.o for this +vfrt=8c0260009e85264fd1ea282fbb22063fc694c552; # until autoconf 2.71 test ! -f ._${nfrt}-${vfrt#*:} && \ ( - test ! -d ${nfrt}-${vfrt#*:} \ - && curl -s https://snapshot.debian.org/archive/debian/${vfrt%:*}/pool/main/f/${nfrt}/${nfrt}_${vfrt#*:}.orig.tar.gz \ - | tar -xzf - \ + test ! -d ${nfrt}-${vfrt} \ + && git clone https://salsa.debian.org/clint/${nfrt}.git ${nfrt}-${vfrt} \ ; - cd ${nfrt}-${vfrt#*:}; - f=$(mktemp); + cd ${nfrt}-${vfrt}; + git checkout ${vfrt}; + ./bootstrap; + f=$(mktemp); # needed due to "error: unknown type name 'cap_user_header_t'" echo > ${f} "#include "; cat libfakeroot.c >> ${f}; mv ${f} libfakeroot.c; rm -fr x; mkdir x; cd x; - ../configure --prefix="${DEST}"; + # -D_ID_T is for "error: conflicting types for 'id_t'; have 'int'" + CFLAGS="-D_ID_T" \ + ../configure \ + --prefix="${DEST}" \ + ; + sed -i Makefile \ + -e '/^SUBDIRS =/ s/doc//g' \ + ; make -j$(nproc) install; ) touch ._${nfrt}-${vfrt#*:}; -- cgit v1.2.3-70-g09d2