From dd1526421202d8bf3a6ab9d41369671678ae3262 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:08:43 +0000 Subject: [PATCH 01/13] aarch64: update cross gcc to 14 --- build/aarch64/common.sh | 4 +--- build/aarch64/{gcc10 => gcc14}/build.sh | 12 +++++++----- build/aarch64/{gcc10 => gcc14}/local.mog | 6 +++++- build/meta/aarch64-build-tools.p5m | 2 +- build/obsolete/aarch64-gcc10.p5m | 4 ++++ doc/baseline | 3 ++- 6 files changed, 20 insertions(+), 11 deletions(-) rename build/aarch64/{gcc10 => gcc14}/build.sh (93%) rename build/aarch64/{gcc10 => gcc14}/local.mog (81%) create mode 100644 build/obsolete/aarch64-gcc10.p5m diff --git a/build/aarch64/common.sh b/build/aarch64/common.sh index 474cfbdd7..704585820 100644 --- a/build/aarch64/common.sh +++ b/build/aarch64/common.sh @@ -4,9 +4,7 @@ ARCH=aarch64 NATIVE_TRIPLET64=${TRIPLETS[$BUILD_ARCH]} TRIPLET64=${TRIPLETS[$ARCH]} -CROSSGCCVER=10 - -min_rel 151045 +CROSSGCCVER=14 PREFIX=/opt/cross/$ARCH SYSROOT=$PREFIX/sysroot diff --git a/build/aarch64/gcc10/build.sh b/build/aarch64/gcc14/build.sh similarity index 93% rename from build/aarch64/gcc10/build.sh rename to build/aarch64/gcc14/build.sh index 1a86c39ef..7cf6ee2df 100755 --- a/build/aarch64/gcc10/build.sh +++ b/build/aarch64/gcc14/build.sh @@ -13,13 +13,13 @@ # }}} # # Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved. -# Copyright 2022 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. . ../common.sh -PKG=ooce/developer/aarch64-gcc10 +PKG=ooce/developer/aarch64-gcc14 PROG=gcc -VER=10.4.0 +VER=14.2.0 ILVER=il-1 SUMMARY="gcc $VER-$ILVER ($ARCH)" DESC="The GNU Compiler Collection" @@ -50,7 +50,7 @@ set_ssp none # building and putting the 32/64 objects in the right places. We also want # to unset all of the flags that we usually pass for a 64-bit object so that # gcc can properly create the multilib targets. -CONFIGURE_OPTS[amd64]="$CONFIGURE_OPTS[i386]" +CONFIGURE_OPTS[amd64]="${CONFIGURE_OPTS[i386]}" clear_archflags # Use bash for all shells - some corruption occurs in libstdc++-v3/config.status @@ -74,7 +74,7 @@ export LD_FOR_TARGET=$PREFIX/bin/ld export AS_FOR_TARGET=$PREFIX/bin/$TRIPLET64-as export CFLAGS_FOR_TARGET="-mno-outline-atomics -mtls-dialect=trad" export CXXFLAGS_FOR_TARGET="-mno-outline-atomics -mtls-dialect=trad" -export STRIP="/usr/bin/strip -x" +export STRIP="$STRIP -x" export STRIP_FOR_TARGET="$STRIP" HARDLINK_TARGETS=" @@ -94,6 +94,8 @@ PKGDIFF_HELPER=" CONFIGURE_OPTS= CONFIGURE_OPTS[amd64]+=" --prefix=$PREFIX + --with-toolexeclibdir=$PREFIX/lib + --with-gxx-include-dir=$PREFIX/include/c++/$VER --host $NATIVE_TRIPLET64 --build $NATIVE_TRIPLET64 --target $TRIPLET64 diff --git a/build/aarch64/gcc10/local.mog b/build/aarch64/gcc14/local.mog similarity index 81% rename from build/aarch64/gcc10/local.mog rename to build/aarch64/gcc14/local.mog index c2d3ca502..6e3a16c12 100644 --- a/build/aarch64/gcc10/local.mog +++ b/build/aarch64/gcc14/local.mog @@ -27,5 +27,9 @@ license COPYING3.LIB license=LGPLv3 set pkg.depend.bypass-generate .*libm\.so\.0$> link path=$(PREFIX)/lib/gcc/$(TRIPLET64)/$(MAJOR) target=$(GCCVER) -link path=$(PREFIX)/$(TRIPLET64)/include/c++/$(MAJOR) target=$(GCCVER) +link path=$(PREFIX)/include/c++/$(MAJOR) target=$(GCCVER) + +# links for gcc as it looks under when cross-compiling +link path=$(PREFIX)/$(TRIPLET64)/lib target=../lib +link path=$(PREFIX)/$(TRIPLET64)/include target=../include diff --git a/build/meta/aarch64-build-tools.p5m b/build/meta/aarch64-build-tools.p5m index 88bbe4488..cd375c3cb 100644 --- a/build/meta/aarch64-build-tools.p5m +++ b/build/meta/aarch64-build-tools.p5m @@ -4,7 +4,7 @@ set name=pkg.description value="Tools required to cross build OmniOS for aarch64 depend fmri=ooce/omnios-build-tools type=require -depend fmri=ooce/developer/aarch64-gcc10 type=require +depend fmri=ooce/developer/aarch64-gcc14 type=require depend fmri=ooce/developer/aarch64-perl type=require depend fmri=ooce/util/dtc type=require depend fmri=ooce/util/u-boot type=require diff --git a/build/obsolete/aarch64-gcc10.p5m b/build/obsolete/aarch64-gcc10.p5m new file mode 100644 index 000000000..1b3a4fe2a --- /dev/null +++ b/build/obsolete/aarch64-gcc10.p5m @@ -0,0 +1,4 @@ +set name=pkg.fmri value=pkg://$(PKGPUBLISHER)/ooce/developer/aarch64-gcc10@10.4.0,$(SUNOSVER)-$(PVER) +set name=publisher value=$(PKGPUBEMAIL) +set name=pkg.obsolete value=true + diff --git a/doc/baseline b/doc/baseline index b523c95e3..edf204e28 100644 --- a/doc/baseline +++ b/doc/baseline @@ -70,7 +70,8 @@ extra.omnios ooce/database/postgresql-17/pg_repack extra.omnios ooce/database/postgresql-common extra.omnios ooce/database/rrdtool extra.omnios ooce/database/victoriametrics -extra.omnios ooce/developer/aarch64-gcc10 +extra.omnios ooce/developer/aarch64-gcc10 o +extra.omnios ooce/developer/aarch64-gcc14 extra.omnios ooce/developer/aarch64-gnu-binutils extra.omnios ooce/developer/aarch64-linker extra.omnios ooce/developer/aarch64-perl From ac4e1331abed84743dec9613447d928c144ef6db Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sun, 29 Dec 2024 22:26:45 +0000 Subject: [PATCH 02/13] aarch64-binutils: fix build with gcc14 --- build/aarch64/binutils/build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/aarch64/binutils/build.sh b/build/aarch64/binutils/build.sh index 49c670d99..56b149882 100755 --- a/build/aarch64/binutils/build.sh +++ b/build/aarch64/binutils/build.sh @@ -24,13 +24,13 @@ SUMMARY="GNU binary utilities ($ARCH target)" DESC="A set of programming tools for creating and managing binary programs, " DESC+="object files, libraries, etc." -# does not yet build with gcc 14 -((GCCVER > 13)) && set_gccver 13 - REPO=$GITHUB/richlowe/$PROG BRANCH=illumos-arm64-${VER/./-} set_arch 64 +# Needed for X/Open curses/termcap +set_standard -xcurses XPG6 CFLAGS + CTF_FLAGS+=" -s" XFORM_ARGS=" From 96e47aa577c4e7185d413655643602694eae54d5 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sun, 29 Dec 2024 23:21:35 +0000 Subject: [PATCH 03/13] aarch64-sysroot: build with gcc14 --- build/aarch64/sysroot/files/aarch64.env | 41 ++++++++++--------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/build/aarch64/sysroot/files/aarch64.env b/build/aarch64/sysroot/files/aarch64.env index 44e495eac..c9b3eb594 100755 --- a/build/aarch64/sysroot/files/aarch64.env +++ b/build/aarch64/sysroot/files/aarch64.env @@ -81,46 +81,37 @@ export CODEMGR_WS="`git rev-parse --show-toplevel`" # # OmniOS, etc. -if [[ -d /opt/gcc-7 ]]; then - export sparc_GNUC_ROOT=/opt/gcc-7 - export i386_GNUC_ROOT=/opt/gcc-7 +if [[ -d /opt/gcc-10 ]]; then + export i386_GNUC_ROOT=/opt/gcc-10 # OpenIndiana etc. -elif [[ -d /usr/gcc/7 ]]; then - export sparc_GNUC_ROOT=/usr/gcc/7 - export i386_GNUC_ROOT=/usr/gcc/7 +elif [[ -d /usr/gcc/10 ]]; then + export i386_GNUC_ROOT=/usr/gcc/10 else - print -u2 "I can't work out where your native GCC 7 is!" + print -u2 "I can't work out where your native GCC 10 is!" exit 2 fi # OmniOS, etc. -if [[ -d /opt/gcc-10 ]]; then - export sparc_GNUC_10_ROOT=/opt/gcc-10 - export i386_GNUC_10_ROOT=/opt/gcc-10 +if [[ -d /opt/gcc-14 ]]; then + export i386_GNUC_14_ROOT=/opt/gcc-14 # OpenIndiana etc. -elif [[ -d /usr/gcc/10 ]]; then - export sparc_GNUC_10_ROOT=/usr/gcc/10 - export i386_GNUC_10_ROOT=/usr/gcc/10 +elif [[ -d /usr/gcc/14 ]]; then + export i386_GNUC_10_ROOT=/usr/gcc/14 else - print -u2 "I can't work out where your native GCC 10 is!" + print -u2 "I can't work out where your native GCC 14 is!" exit 2 fi export CROSS_TRIPLET=aarch64-unknown-solaris2.11 -export sparc_PRIMARY_CC=gcc7,$sparc_GNUC_ROOT/bin/gcc,gnu -export sparc_PRIMARY_CCC=gcc7,$sparc_GNUC_ROOT/bin/g++,gnu -export sparc_SHADOW_CCS=gcc10,$sparc_GNUC_10_ROOT/bin/gcc,gnu -export sparc_SHADOW_CCCS=gcc10,$sparc_GNUC_10_ROOT/bin/g++,gnu - -export i386_PRIMARY_CC=gcc7,$i386_GNUC_ROOT/bin/gcc,gnu -export i386_PRIMARY_CCC=gcc7,$i386_GNUC_ROOT/bin/g++,gnu -export i386_SHADOW_CCS=gcc10,$i386_GNUC_10_ROOT/bin/gcc,gnu -export i386_SHADOW_CCCS=gcc10,$i386_GNUC_10_ROOT/bin/g++,gnu +export i386_PRIMARY_CC=gcc10,$i386_GNUC_ROOT/bin/gcc,gnu +export i386_PRIMARY_CCC=gcc10,$i386_GNUC_ROOT/bin/g++,gnu +export i386_SHADOW_CCS=gcc14,$i386_GNUC_14_ROOT/bin/gcc,gnu +export i386_SHADOW_CCCS=gcc14,$i386_GNUC_14_ROOT/bin/g++,gnu export aarch64_GNUC_ROOT=$PREFIX -export aarch64_PRIMARY_CC=gcc10,$aarch64_GNUC_ROOT/bin/gcc,gnu -export aarch64_PRIMARY_CCC=gcc10,$aarch64_GNUC_ROOT/bin/g++,gnu +export aarch64_PRIMARY_CC=gcc14,$aarch64_GNUC_ROOT/bin/gcc,gnu +export aarch64_PRIMARY_CCC=gcc14,$aarch64_GNUC_ROOT/bin/g++,gnu export AW_aarch64_AS_DIR=$PREFIX/bin export AW_aarch64_AS64_DIR=$PREFIX/bin From e9e502a143ce7d2492c58729f657de551e84e354 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:09:05 +0000 Subject: [PATCH 04/13] aarch64: fix apr cross-build --- build/apr/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/apr/build.sh b/build/apr/build.sh index 64ede4d6c..745b60458 100755 --- a/build/apr/build.sh +++ b/build/apr/build.sh @@ -43,6 +43,7 @@ CONFIGURE_OPTS[amd64]+=" CONFIGURE_OPTS[aarch64]+=" --with-installbuilddir=$PREFIX/share/apr/aarch64/build-1 ac_cv_file__dev_zero=yes + ac_cv_strerror_r_rc_int=yes apr_cv_process_shared_works=yes apr_cv_mutex_robust_shared=yes apr_cv_tcp_nodelay_with_cork=yes From e55c9c7e4e3c97d14eb77c48774fd8ae35ac579f Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:09:32 +0000 Subject: [PATCH 05/13] aarch64: fix bdb cross-build --- build/bdb/build.sh | 2 +- build/bdb/patches/aarch64.patch | 21 +++++++++++++++++++++ build/bdb/patches/series | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 build/bdb/patches/aarch64.patch create mode 100644 build/bdb/patches/series diff --git a/build/bdb/build.sh b/build/bdb/build.sh index 4d7622de8..3a26cd24f 100755 --- a/build/bdb/build.sh +++ b/build/bdb/build.sh @@ -66,7 +66,7 @@ pre_configure() { init download_source $PROG db $VER -patch_source +EXTRACTED_SRC=db-$VER patch_source prep_build build make_package diff --git a/build/bdb/patches/aarch64.patch b/build/bdb/patches/aarch64.patch new file mode 100644 index 000000000..6edc34d96 --- /dev/null +++ b/build/bdb/patches/aarch64.patch @@ -0,0 +1,21 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/dist/configure a/dist/configure +--- a~/dist/configure 1970-01-01 00:00:00 ++++ a/dist/configure 1970-01-01 00:00:00 +@@ -22485,6 +22485,7 @@ if test "$db_cv_atomic" = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#include + #include + int + main () +@@ -24192,6 +24193,9 @@ $as_echo_n "checking for 64-bit integral + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + ++#include ++#include ++ + int + main () + { diff --git a/build/bdb/patches/series b/build/bdb/patches/series new file mode 100644 index 000000000..b40a1c1ef --- /dev/null +++ b/build/bdb/patches/series @@ -0,0 +1 @@ +aarch64.patch From 838cb225d77718421b8aff4f134cb0b5ec40c320 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:10:08 +0000 Subject: [PATCH 06/13] aarch64: fix fontconfig cross-build --- build/fontconfig/build.sh | 39 ++++----- build/fontconfig/local.mog | 19 ++--- .../fontconfig/patches/04.bitmap-hacks.patch | 84 ------------------- build/fontconfig/patches/series | 1 - 4 files changed, 19 insertions(+), 124 deletions(-) delete mode 100644 build/fontconfig/patches/04.bitmap-hacks.patch delete mode 100644 build/fontconfig/patches/series diff --git a/build/fontconfig/build.sh b/build/fontconfig/build.sh index 15fe0021d..f9d3b8a77 100755 --- a/build/fontconfig/build.sh +++ b/build/fontconfig/build.sh @@ -22,9 +22,6 @@ PKG=ooce/library/fontconfig SUMMARY="$PROG" DESC="A library for configuring and customizing font access" -# does not yet build with gcc 14 -((GCCVER > 13)) && set_gccver 13 - SKIP_LICENCES=MIT SKIP_RTIME_CHECK=1 SKIP_SSP_CHECK=1 @@ -32,6 +29,8 @@ SKIP_SSP_CHECK=1 OPREFIX=$PREFIX PREFIX+="/$PROG" +forgo_isaexec + BUILD_DEPENDS_IPS=" library/expat ooce/developer/gperf @@ -44,6 +43,7 @@ XFORM_ARGS=" -DPREFIX=${PREFIX#/} -DOPREFIX=${OPREFIX#/} -DPROG=$PROG + -DPKGROOT=$PROG " CONFIGURE_OPTS=" @@ -53,41 +53,30 @@ CONFIGURE_OPTS=" --with-default-fonts=$OPREFIX/share/fonts --with-cache-dir=/var/$PREFIX/cache " -CONFIGURE_OPTS[i386]=" - --bindir=$PREFIX/bin/i386 - --sbindir=$PREFIX/sbin/i386 - --libdir=$OPREFIX/lib -" -CONFIGURE_OPTS[amd64]=" - --bindir=$PREFIX/bin - --sbindir=$PREFIX/sbin - --libdir=$OPREFIX/lib/amd64 -" -CONFIGURE_OPTS[aarch64]+=" - --bindir=$PREFIX/bin - --sbindir=$PREFIX/sbin - --libdir=$OPREFIX/lib -" pre_configure() { + typeset arch=$1 + # The build framework expects GNU tools export PATH="$GNUBIN:$PATH" + + CONFIGURE_OPTS[$arch]+=" + --libdir=$OPREFIX/${LIBDIRS[$arch]} + " + + LDFLAGS[$arch]+=" -L$OPREFIX/${LIBDIRS[$arch]}" + LDFLAGS[$arch]+=" -R$OPREFIX/${LIBDIRS[$arch]}" } post_install() { logmsg "--- removing absolute symlinks" - logcmd rm -f $DESTDIR/etc$PREFIX/fonts/conf.d/*.conf + logcmd $RM -f $DESTDIR/etc$PREFIX/fonts/conf.d/*.conf } -LDFLAGS[i386]+=" -L$OPREFIX/lib -R$OPREFIX/lib" -LDFLAGS[amd64]+=" -L$OPREFIX/lib/amd64 -R$OPREFIX/lib/amd64" -LDFLAGS[aarch64]+=" -L$OPREFIX/lib -R$OPREFIX/lib" - init download_source $PROG $PROG $VER -prep_build patch_source -run_autoreconf -fi +prep_build autoconf -autoreconf build make_package clean_up diff --git a/build/fontconfig/local.mog b/build/fontconfig/local.mog index 146acb713..884e56cf9 100644 --- a/build/fontconfig/local.mog +++ b/build/fontconfig/local.mog @@ -7,12 +7,11 @@ # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. -# Copyright 2020 OmniOS Community Edition (OmniOSce) Association. +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. - drop> +license COPYING license=MIT -# Drop 32bit binaries - drop> + drop> # Drop html documentation drop> @@ -22,14 +21,6 @@ link path=etc/$(PREFIX)/fonts/conf.d/%<1> \ target=../../../../../../$(PREFIX)/share/fontconfig/conf.avail/%<1> > -# Symlink binaries - emit \ - link path=$(OPREFIX)/%<1>/%<2> target=../$(PROG)/%<1>/%<2> > - -# Symlink man pages - emit \ - link path=$(OPREFIX)/share/man/%<1>/%<2> \ - target=../../../$(PROG)/share/man/%<1>/%<2> > - -license COPYING license=MIT + + diff --git a/build/fontconfig/patches/04.bitmap-hacks.patch b/build/fontconfig/patches/04.bitmap-hacks.patch deleted file mode 100644 index efe8ee4ae..000000000 --- a/build/fontconfig/patches/04.bitmap-hacks.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -wpruN --no-dereference '--exclude=*.orig' a~/src/fcmatch.c a/src/fcmatch.c ---- a~/src/fcmatch.c 1970-01-01 00:00:00 -+++ a/src/fcmatch.c 1970-01-01 00:00:00 -@@ -50,6 +50,15 @@ FcCompareNumber (const FcValue *value1, - return -1.0; - } - v = v2 - v1; -+ -+ /* -+ * Hack to allow bitmap fonts to equal requested font if it is close -+ */ -+ if ( v > -.5 && v <= .5 ) -+ { -+ v = 0; -+ } -+ - if (v < 0) - v = -v; - *bestValue = FcValueCanonicalize (value2); -@@ -857,6 +866,46 @@ FcFontRenderPrepare (FcConfig *confi - return new; - } - -+static void -+FcChangeFormat ( FcPattern *p ) -+{ -+ int i; -+ FcPatternElt *pe = FcPatternElts(p); -+ -+ /* -+ * Hack. If user want monochrome mode, then try to pick bitmaps over -+ * outlines. -+ */ -+ for ( i = 0; i < p->num; i++ ) -+ { -+ if ( !strcmp(&pe[i].object, "antialias" )) -+ { -+ int aa = (int) &pe[i].values->value.u.b; -+ int j; -+ int done = 0; -+ FcValue v; -+ -+ v.type = FcTypeBool; -+ v.u.b = aa; -+ -+ for ( j = 0; j < p->num; j++ ) -+ { -+ if ( !strcmp(&pe[j].object, "outline" )) -+ { -+ done = 1; -+ break; -+ } -+ } -+ if ( !done ) -+ { -+ FcPatternObjectAddWithBinding (p, "outline", v, -+ FcValueBindingStrong, 1); -+ } -+ break; -+ } -+ } -+} -+ - static FcPattern * - FcFontSetMatchInternal (FcFontSet **sets, - int nsets, -@@ -872,6 +921,8 @@ FcFontSetMatchInternal (FcFontSet **se - FcCompareData data; - const FcPatternElt *elt; - -+ FcChangeFormat ( p ); -+ - for (i = 0; i < PRI_END; i++) - bestscore[i] = 0; - best = 0; -@@ -1212,6 +1263,8 @@ FcFontSetSort (FcConfig *config FC_U - FcValue patternLang; - FcCompareData data; - -+ FcChangeFormat ( p ); -+ - assert (sets != NULL); - assert (p != NULL); - assert (result != NULL); diff --git a/build/fontconfig/patches/series b/build/fontconfig/patches/series deleted file mode 100644 index 017366bc0..000000000 --- a/build/fontconfig/patches/series +++ /dev/null @@ -1 +0,0 @@ -04.bitmap-hacks.patch From 2ea6ea13187ef1ad6aaed5aa5dd695c11274b8ec Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:10:23 +0000 Subject: [PATCH 07/13] libmcrypt: fix build with gcc14 --- build/libmcrypt/build.sh | 4 +--- build/libmcrypt/patches/gcc14.patch | 36 +++++++++++++++++++++++++++++ build/libmcrypt/patches/series | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 build/libmcrypt/patches/gcc14.patch create mode 100644 build/libmcrypt/patches/series diff --git a/build/libmcrypt/build.sh b/build/libmcrypt/build.sh index d217ca13d..af0ec4e2b 100755 --- a/build/libmcrypt/build.sh +++ b/build/libmcrypt/build.sh @@ -23,9 +23,6 @@ SUMMARY="Multi-cipher cryptographic library" DESC="libmcrypt is a cryptographic library that conveniently brings together \ a variety of ciphers for convenient use." -# does not yet build with gcc 14 -((GCCVER > 13)) && set_gccver 13 - XFORM_ARGS=" -DPREFIX=${PREFIX#/} " @@ -51,6 +48,7 @@ init download_source $PROG $PROG $VER patch_source prep_build +run_autoconf -f build run_testsuite check strip_install diff --git a/build/libmcrypt/patches/gcc14.patch b/build/libmcrypt/patches/gcc14.patch new file mode 100644 index 000000000..51886b61b --- /dev/null +++ b/build/libmcrypt/patches/gcc14.patch @@ -0,0 +1,36 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/configure.in a/configure.in +--- a~/configure.in 1970-01-01 00:00:00 ++++ a/configure.in 1970-01-01 00:00:00 +@@ -189,7 +189,7 @@ AC_SUBST(LT_REVISION) + AC_SUBST(LT_AGE) + + AC_HEADER_DIRENT +-AC_HEADER_STDC ++AC_HEADER_STDC([stdint.h]) + AC_C_INLINE + AC_C_CONST + +@@ -214,8 +214,7 @@ AC_CHECK_SIZEOF(unsigned int, 4) + AC_CHECK_SIZEOF(unsigned short int, 2) + AC_CHECK_SIZEOF(unsigned char, 1) + +-AC_LIBTOOL_DLOPEN +-AC_LIBTOOL_WIN32_DLL ++AC_PROG_LIBTOOL([dlopen win32-dll]) + + + +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Makefile.in a/lib/Makefile.in +--- a~/lib/Makefile.in 1970-01-01 00:00:00 ++++ a/lib/Makefile.in 1970-01-01 00:00:00 +@@ -561,8 +561,8 @@ mcrypt_symb.c: mcrypt_internal.h + @echo "/* This is automatically created. Don't touch... */" >> mcrypt_symb.c + @echo "" >> mcrypt_symb.c + -@for i in $(EXTRA_ALGOS); do \ +- if test -f ../modules/algorithms/$$i.c; then cat ../modules/algorithms/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ +- if test -f ../modules/modes/$$i.c; then cat ../modules/modes/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ ++ if test -f ../modules/algorithms/$$i.c; then cat ../modules/algorithms/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern int "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ ++ if test -f ../modules/modes/$$i.c; then cat ../modules/modes/$$i.c 2>/dev/null|grep define|grep LTX|awk '{print "extern int "$$3"();";}' >> mcrypt_symb.c 2>/dev/null; fi; \ + done + @echo "" >> mcrypt_symb.c + @echo "const mcrypt_preloaded mps[] = {" >> mcrypt_symb.c diff --git a/build/libmcrypt/patches/series b/build/libmcrypt/patches/series new file mode 100644 index 000000000..de00d609b --- /dev/null +++ b/build/libmcrypt/patches/series @@ -0,0 +1 @@ +gcc14.patch From 2ed788bb538745e93ccabf014b478e112c7384e7 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:10:52 +0000 Subject: [PATCH 08/13] minicom: fix build with gcc14 --- build/minicom/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/minicom/build.sh b/build/minicom/build.sh index e8a410ce1..b20cdc3e1 100755 --- a/build/minicom/build.sh +++ b/build/minicom/build.sh @@ -28,6 +28,7 @@ PREFIX+=/$PROG set_arch 64 test_relver '>=' 151051 && set_clangver +set_standard XPG6 XFORM_ARGS=" -DOPREFIX=${OPREFIX#/} From 2f24321a66c42840528c6fe152b8255e93a20789 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:11:28 +0000 Subject: [PATCH 09/13] aarch64: fix minidlna cross-build --- build/minidlna/patches/config.h.in.patch | 12 -------- build/minidlna/patches/monitor.c.patch | 37 +++++++++++++----------- build/minidlna/patches/series | 2 +- build/minidlna/patches/utils.h.patch | 18 ++++++++++++ 4 files changed, 39 insertions(+), 30 deletions(-) delete mode 100644 build/minidlna/patches/config.h.in.patch create mode 100644 build/minidlna/patches/utils.h.patch diff --git a/build/minidlna/patches/config.h.in.patch b/build/minidlna/patches/config.h.in.patch deleted file mode 100644 index 44dce774a..000000000 --- a/build/minidlna/patches/config.h.in.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -wpruN --no-dereference '--exclude=*.orig' a~/config.h.in a/config.h.in ---- a~/config.h.in 1970-01-01 00:00:00 -+++ a/config.h.in 1970-01-01 00:00:00 -@@ -1,5 +1,8 @@ - /* config.h.in. Generated from configure.ac by autoheader. */ - -+#define MIN(a,b) (((a)<(b))?(a):(b)) -+#define MAX(a,b) (((a)>(b))?(a):(b)) -+ - /* Define if building universal (internal helper macro) */ - #undef AC_APPLE_UNIVERSAL_BUILD - diff --git a/build/minidlna/patches/monitor.c.patch b/build/minidlna/patches/monitor.c.patch index 062ccf63b..21b5597cd 100644 --- a/build/minidlna/patches/monitor.c.patch +++ b/build/minidlna/patches/monitor.c.patch @@ -1,32 +1,35 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/monitor.c a/monitor.c --- a~/monitor.c 1970-01-01 00:00:00 +++ a/monitor.c 1970-01-01 00:00:00 -@@ -339,17 +339,21 @@ monitor_insert_directory(int fd, char *n +@@ -298,6 +298,7 @@ monitor_insert_directory(int fd, char *n + char path_buf[PATH_MAX]; + enum file_types type = TYPE_UNKNOWN; + media_types dir_types; ++ struct stat sbuf; + + if( access(path, R_OK|X_OK) != 0 ) { - if( e->d_name[0] == '.' ) +@@ -341,18 +342,11 @@ monitor_insert_directory(int fd, char *n continue; -+ -+ type = TYPE_UNKNOWN; esc_name = escape_tag(e->d_name, 1); snprintf(path_buf, sizeof(path_buf), "%s/%s", path, e->d_name); - switch( e->d_type ) -+ if( is_dir(e->d_name) == 1 ) -+ { -+ type = TYPE_DIR; -+ } -+ else if( is_reg(e->d_name) == 1 ) -+ { -+ type = TYPE_FILE; -+ } -+ else - { +- { - case DT_DIR: - case DT_REG: - case DT_LNK: - case DT_UNKNOWN: - type = resolve_unknown_type(path_buf, dir_types); +- type = resolve_unknown_type(path_buf, dir_types); - default: - break; +- } ++ if( stat(path_buf, &sbuf) != 0 || !(S_ISDIR(sbuf.st_mode) || ++ S_ISREG(sbuf.st_mode) || S_ISLNK(sbuf.st_mode)) ) ++ continue; ++ type = resolve_unknown_type(path_buf, dir_types); +- if( type == TYPE_DIR ) +- { ++ if( type == TYPE_DIR ) { + monitor_insert_directory(fd, esc_name, path_buf); } - if( type == TYPE_DIR ) - { + else if( type == TYPE_FILE && check_notsparse(path_buf)) { diff --git a/build/minidlna/patches/series b/build/minidlna/patches/series index 15ea705a5..8681ab14c 100644 --- a/build/minidlna/patches/series +++ b/build/minidlna/patches/series @@ -1,4 +1,4 @@ -config.h.in.patch +utils.h.patch minidlna.conf.patch minissdp.c.patch monitor.c.patch diff --git a/build/minidlna/patches/utils.h.patch b/build/minidlna/patches/utils.h.patch new file mode 100644 index 000000000..961048be8 --- /dev/null +++ b/build/minidlna/patches/utils.h.patch @@ -0,0 +1,18 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/utils.h a/utils.h +--- a~/utils.h 1970-01-01 00:00:00 ++++ a/utils.h 1970-01-01 00:00:00 +@@ -30,6 +30,14 @@ + + #include "minidlnatypes.h" + ++#ifndef MIN ++#define MIN(a, b) ((a) < (b) ? (a) : (b)) ++#endif ++ ++#ifndef MAX ++#define MAX(a, b) ((a) > (b) ? (a) : (b)) ++#endif ++ + /* String functions */ + /* We really want this one inlined, since it has a major performance impact */ + static inline int From 088da47d0fe68d1e507ad695d890e7adfc83204f Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:13:15 +0000 Subject: [PATCH 10/13] popt: fix build with gcc14 --- build/popt/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/popt/build.sh b/build/popt/build.sh index 5e677f1c3..e68ea40c2 100755 --- a/build/popt/build.sh +++ b/build/popt/build.sh @@ -23,6 +23,7 @@ SUMMARY="$PROG" DESC="$PROG - command line option parsing library" set_clangver +set_standard XPG6 TESTSUITE_FILTER='^[A-Z#][A-Z ]' From 4a6eb91597bb6a80d2b4241d10b25aa9700f043e Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:13:37 +0000 Subject: [PATCH 11/13] clang: add aarch64 target support --- build/clang/build-18.sh | 3 --- build/clang/build-19.sh | 3 --- .../clang/patches-18/aarch64-target-support.patch | 14 ++++++++++++++ .../default-preprocessor-definition.patch | 2 +- build/clang/patches-18/series | 1 + .../clang/patches-19/aarch64-target-support.patch | 14 ++++++++++++++ .../add-__illumos__-preprocessor-definition.patch | 2 +- .../clang/patches-19/add-rpath-for-libstdcxx.patch | 8 ++++---- .../default-preprocessor-definition.patch | 4 ++-- .../no-sanitizer-runtime-lib-linking.patch | 2 +- build/clang/patches-19/no-ssp-linking.patch | 2 +- build/clang/patches-19/series | 1 + 12 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 build/clang/patches-18/aarch64-target-support.patch create mode 100644 build/clang/patches-19/aarch64-target-support.patch diff --git a/build/clang/build-18.sh b/build/clang/build-18.sh index 48b369726..aee82159f 100755 --- a/build/clang/build-18.sh +++ b/build/clang/build-18.sh @@ -74,9 +74,6 @@ post_install() { $CAT << EOF >| $cfgfile --gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver -fuse-ld=$CROSSTOOLS/$a/bin/ld --stdlib++-isystem$cxxinc --stdlib++-isystem$cxxinc/${TRIPLETS[$a]} --stdlib++-isystem$cxxinc/backward EOF else $CAT << EOF >| $cfgfile diff --git a/build/clang/build-19.sh b/build/clang/build-19.sh index ff72b0d21..8171b7a10 100755 --- a/build/clang/build-19.sh +++ b/build/clang/build-19.sh @@ -74,9 +74,6 @@ post_install() { $CAT << EOF >| $cfgfile --gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver -fuse-ld=$CROSSTOOLS/$a/bin/ld --stdlib++-isystem$cxxinc --stdlib++-isystem$cxxinc/${TRIPLETS[$a]} --stdlib++-isystem$cxxinc/backward EOF else $CAT << EOF >| $cfgfile diff --git a/build/clang/patches-18/aarch64-target-support.patch b/build/clang/patches-18/aarch64-target-support.patch new file mode 100644 index 000000000..ec2f90da4 --- /dev/null +++ b/build/clang/patches-18/aarch64-target-support.patch @@ -0,0 +1,14 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets.cpp a/lib/Basic/Targets.cpp +--- a~/lib/Basic/Targets.cpp 1970-01-01 00:00:00 ++++ a/lib/Basic/Targets.cpp 1970-01-01 00:00:00 +@@ -160,6 +160,10 @@ std::unique_ptr AllocateTarg + return std::make_unique>(Triple, + Opts); + } ++ ++ case llvm::Triple::Solaris: ++ return std::make_unique>(Triple, ++ Opts); + case llvm::Triple::NetBSD: + return std::make_unique>(Triple, + Opts); diff --git a/build/clang/patches-18/default-preprocessor-definition.patch b/build/clang/patches-18/default-preprocessor-definition.patch index 8050a3d11..3db282e2d 100644 --- a/build/clang/patches-18/default-preprocessor-definition.patch +++ b/build/clang/patches-18/default-preprocessor-definition.patch @@ -20,7 +20,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h + // Compatibility with GCC to satisfy requirements. if (Opts.CPlusPlus) { - Builder.defineMacro("__C99FEATURES__"); -+ Builder.defineMacro("__STDC_VERSION__", "199901L"); ++ Builder.defineMacro("__STDC_VERSION__", "201112L"); + Builder.defineMacro("_XOPEN_SOURCE", "600"); Builder.defineMacro("_FILE_OFFSET_BITS", "64"); - } diff --git a/build/clang/patches-18/series b/build/clang/patches-18/series index 2c8dc747a..d4202fb86 100644 --- a/build/clang/patches-18/series +++ b/build/clang/patches-18/series @@ -3,3 +3,4 @@ default-preprocessor-definition.patch add-rpath-for-libstdcxx.patch no-sanitizer-runtime-lib-linking.patch add-__illumos__-preprocessor-definition.patch +aarch64-target-support.patch diff --git a/build/clang/patches-19/aarch64-target-support.patch b/build/clang/patches-19/aarch64-target-support.patch new file mode 100644 index 000000000..ec2f90da4 --- /dev/null +++ b/build/clang/patches-19/aarch64-target-support.patch @@ -0,0 +1,14 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets.cpp a/lib/Basic/Targets.cpp +--- a~/lib/Basic/Targets.cpp 1970-01-01 00:00:00 ++++ a/lib/Basic/Targets.cpp 1970-01-01 00:00:00 +@@ -160,6 +160,10 @@ std::unique_ptr AllocateTarg + return std::make_unique>(Triple, + Opts); + } ++ ++ case llvm::Triple::Solaris: ++ return std::make_unique>(Triple, ++ Opts); + case llvm::Triple::NetBSD: + return std::make_unique>(Triple, + Opts); diff --git a/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch b/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch index 02a30cc2f..fcfb113d2 100644 --- a/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch +++ b/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch @@ -1,7 +1,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h a/lib/Basic/Targets/OSTargets.h --- a~/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 +++ a/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 -@@ -590,6 +590,7 @@ protected: +@@ -594,6 +594,7 @@ protected: void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, MacroBuilder &Builder) const override { DefineStd(Builder, "sun", Opts); diff --git a/build/clang/patches-19/add-rpath-for-libstdcxx.patch b/build/clang/patches-19/add-rpath-for-libstdcxx.patch index 82c7a5832..66f387568 100644 --- a/build/clang/patches-19/add-rpath-for-libstdcxx.patch +++ b/build/clang/patches-19/add-rpath-for-libstdcxx.patch @@ -1,7 +1,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChain.cpp a/lib/Driver/ToolChain.cpp --- a~/lib/Driver/ToolChain.cpp 1970-01-01 00:00:00 +++ a/lib/Driver/ToolChain.cpp 1970-01-01 00:00:00 -@@ -1233,9 +1233,7 @@ void ToolChain::AddClangCXXStdlibIsystem +@@ -1280,9 +1280,7 @@ void ToolChain::AddClangCXXStdlibIsystem } bool ToolChain::ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const { @@ -15,7 +15,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChain.cpp a/li diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.cpp a/lib/Driver/ToolChains/Solaris.cpp --- a~/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 +++ a/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 -@@ -207,6 +207,9 @@ void solaris::Linker::ConstructJob(Compi +@@ -206,6 +206,9 @@ void solaris::Linker::ConstructJob(Compi bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); @@ -25,8 +25,8 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_r)) { // Use the static OpenMP runtime with -static-openmp -@@ -215,8 +218,6 @@ void solaris::Linker::ConstructJob(Compi - addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP); +@@ -214,8 +217,6 @@ void solaris::Linker::ConstructJob(Compi + addOpenMPRuntime(C, CmdArgs, ToolChain, Args, StaticOpenMP); if (D.CCCIsCXX()) { - if (ToolChain.ShouldLinkCXXStdlib(Args)) diff --git a/build/clang/patches-19/default-preprocessor-definition.patch b/build/clang/patches-19/default-preprocessor-definition.patch index 8050a3d11..13f594312 100644 --- a/build/clang/patches-19/default-preprocessor-definition.patch +++ b/build/clang/patches-19/default-preprocessor-definition.patch @@ -5,7 +5,7 @@ Sync SunOS default defines with a working reality. diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h a/lib/Basic/Targets/OSTargets.h --- a~/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 +++ a/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 -@@ -593,22 +593,15 @@ protected: +@@ -597,22 +597,15 @@ protected: DefineStd(Builder, "unix", Opts); Builder.defineMacro("__svr4__"); Builder.defineMacro("__SVR4"); @@ -20,7 +20,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h + // Compatibility with GCC to satisfy requirements. if (Opts.CPlusPlus) { - Builder.defineMacro("__C99FEATURES__"); -+ Builder.defineMacro("__STDC_VERSION__", "199901L"); ++ Builder.defineMacro("__STDC_VERSION__", "201112L"); + Builder.defineMacro("_XOPEN_SOURCE", "600"); Builder.defineMacro("_FILE_OFFSET_BITS", "64"); - } diff --git a/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch b/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch index 6d841cc57..e077a75db 100644 --- a/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch +++ b/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch @@ -1,7 +1,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/CommonArgs.cpp a/lib/Driver/ToolChains/CommonArgs.cpp --- a~/lib/Driver/ToolChains/CommonArgs.cpp 1970-01-01 00:00:00 +++ a/lib/Driver/ToolChains/CommonArgs.cpp 1970-01-01 00:00:00 -@@ -1366,6 +1366,9 @@ void tools::addAsNeededOption(const Tool +@@ -1360,6 +1360,9 @@ void tools::addAsNeededOption(const Tool void tools::linkSanitizerRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) { diff --git a/build/clang/patches-19/no-ssp-linking.patch b/build/clang/patches-19/no-ssp-linking.patch index 2c8ef88a4..37dd73715 100644 --- a/build/clang/patches-19/no-ssp-linking.patch +++ b/build/clang/patches-19/no-ssp-linking.patch @@ -1,7 +1,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.cpp a/lib/Driver/ToolChains/Solaris.cpp --- a~/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 +++ a/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 -@@ -229,13 +229,6 @@ void solaris::Linker::ConstructJob(Compi +@@ -228,13 +228,6 @@ void solaris::Linker::ConstructJob(Compi addFortranRuntimeLibs(getToolChain(), Args, CmdArgs); CmdArgs.push_back("-lm"); } diff --git a/build/clang/patches-19/series b/build/clang/patches-19/series index 2c8dc747a..d4202fb86 100644 --- a/build/clang/patches-19/series +++ b/build/clang/patches-19/series @@ -3,3 +3,4 @@ default-preprocessor-definition.patch add-rpath-for-libstdcxx.patch no-sanitizer-runtime-lib-linking.patch add-__illumos__-preprocessor-definition.patch +aarch64-target-support.patch From 534e34ec3ce4fd50f9c08429842261f033b23aa1 Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Sat, 14 Dec 2024 12:14:35 +0000 Subject: [PATCH 12/13] aarch64: build znc with clang++ --- build/znc/build.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/znc/build.sh b/build/znc/build.sh index 025624cc3..b03316fd9 100755 --- a/build/znc/build.sh +++ b/build/znc/build.sh @@ -68,6 +68,9 @@ pre_build() { done } +# TODO: if we are going to use clang as a cross-compiler we should +# add support to the framework; this is just a hacky workaround +# to have at least one consumer of clang++ for cross-compiling pre_configure() { typeset arch=$1 @@ -75,6 +78,10 @@ pre_configure() { ! cross_arch $arch && return + set_clangver + + PATH=$CROSSTOOLS/$arch/bin:$PATH + CXX+=" --target=${TRIPLETS[$arch]}" LDFLAGS[$arch]+=" -L${SYSROOT[$arch]}$OPREFIX/${LIBDIRS[$arch]}" } From 518699b17af481ec46b363de7d2484ab0d47ddbb Mon Sep 17 00:00:00 2001 From: Dominik Hassler Date: Thu, 19 Dec 2024 16:22:35 +0000 Subject: [PATCH 13/13] aarch64: build rust --- build/rust/build-arch-aarch64.sh | 105 +++++++++++ build/rust/build.sh | 1 + ...ch64-cpu-feature-support-for-illumos.patch | 167 ++++++++++++++++++ build/rust/patches/aarch64-cpu-features.patch | 35 ---- build/rust/patches/aarch64-eh_frame-ro.patch | 2 +- build/rust/patches/series | 2 +- doc/baseline.aarch64 | 1 + doc/pkglist.aarch64 | 1 + 8 files changed, 277 insertions(+), 37 deletions(-) create mode 100755 build/rust/build-arch-aarch64.sh create mode 100644 build/rust/patches/0001-aarch64-cpu-feature-support-for-illumos.patch delete mode 100644 build/rust/patches/aarch64-cpu-features.patch diff --git a/build/rust/build-arch-aarch64.sh b/build/rust/build-arch-aarch64.sh new file mode 100755 index 000000000..59cbde0da --- /dev/null +++ b/build/rust/build-arch-aarch64.sh @@ -0,0 +1,105 @@ +#!/usr/bin/bash +# +# {{{ CDDL HEADER +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# }}} + +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. + +. ../../lib/build.sh + +PROG=rust +PKG=ooce/developer/rust +VER=1.83.0 +SUMMARY="Rust systems programming language" +DESC="Rust is a systems programming language that runs blazingly fast, " +DESC+="prevents segfaults, and guarantees thread safety." + +set_builddir ${PROG}c-${VER}-src + +OPREFIX=$PREFIX +PREFIX+=/$PROG + +BUILD_DEPENDS_IPS="developer/gnu-binutils" +# TODO: globbing only works reliably as long as we just have +# one cross compiler version per arch. +crossgccver=`pkg_ver aarch64/gcc*` +crossgccver=${crossgccver%%.*} +# `rustc` uses `gcc` as its linker. Other dependencies such as the C runtime +# and linker are themselves pulled in as dependencies of the gcc package. +RUN_DEPENDS_IPS="developer/gcc$crossgccver" + +# rust build requires the final install directory to be present +[ -d "$PREFIX" ] || logcmd $PFEXEC mkdir -p $PREFIX + +XFORM_ARGS=" + -DPREFIX=${PREFIX#/} + -DOPREFIX=${OPREFIX#/} + -DPROG=$PROG +" + +SKIP_RTIME_CHECK=1 +SKIP_SSP_CHECK=1 +NO_SONAME_EXPECTED=1 + +aarch64prefix=$CROSSTOOLS/aarch64/bin/${TRIPLETS[aarch64]} +CONFIGURE_OPTS[aarch64]=" + --prefix=$PREFIX + --sysconfdir=/etc$PREFIX + --localstatedir=/var$PREFIX + --set target.${RUSTTRIPLETS[aarch64]}.cc=$aarch64prefix-gcc + --set target.${RUSTTRIPLETS[aarch64]}.cxx=$aarch64prefix-g++ + --set target.${RUSTTRIPLETS[aarch64]}.ar=$aarch64prefix-ar +" +CONFIGURE_OPTS+=" + --release-description=OmniOS/$RELVER + --enable-vendor + --enable-local-rust + --enable-extended + --build=${RUSTTRIPLETS[$BUILD_ARCH]} + --host=${RUSTTRIPLETS[aarch64]} + --target=${RUSTTRIPLETS[aarch64]} + --enable-rpath + --enable-ninja + --disable-codegen-tests + --disable-dist-src + --disable-llvm-static-stdcpp + --disable-docs + --release-channel=stable + --python=$PYTHON +" + +pre_configure() { :; + # rust needs to find the native gcc for bootstrapping + set_gccver $DEFAULT_GCC_VER + + tripus=${RUSTTRIPLETS[aarch64]//-/_} + tripuc=${tripus^^} + export CARGO_TARGET_${tripuc}_RUSTFLAGS=" + -C link-arg=--sysroot=${SYSROOT[aarch64]} + " + export CXXFLAGS_${tripus}="-mno-outline-atomics -mtls-dialect=trad" +} + +pre_install() { + logcmd $MKDIR -p $DESTDIR/$PREFIX || logerr "failed to create directory" +} + +init +download_source $PROG ${PROG}c $VER-src +patch_source +prep_build autoconf-like +build -noctf +make_package +clean_up + +# Vim hints +# vim:ts=4:sw=4:et:fdm=marker diff --git a/build/rust/build.sh b/build/rust/build.sh index f0f2359c0..429a290ed 100755 --- a/build/rust/build.sh +++ b/build/rust/build.sh @@ -14,6 +14,7 @@ # Copyright 2024 OmniOS Community Edition (OmniOSce) Association. +. ../../lib/arch.sh . ../../lib/build.sh PROG=rust diff --git a/build/rust/patches/0001-aarch64-cpu-feature-support-for-illumos.patch b/build/rust/patches/0001-aarch64-cpu-feature-support-for-illumos.patch new file mode 100644 index 000000000..febdef682 --- /dev/null +++ b/build/rust/patches/0001-aarch64-cpu-feature-support-for-illumos.patch @@ -0,0 +1,167 @@ +From 3e39942698fdc876135000d3fa12f5bad0eecfcc Mon Sep 17 00:00:00 2001 +From: Dominik Hassler +Date: Fri, 20 Dec 2024 15:17:18 +0000 +Subject: [PATCH] aarch64 cpu feature support for illumos + +--- + compiler-rt/lib/builtins/cpu_model/aarch64.c | 7 ++ + .../cpu_model/aarch64/fmv/illumos.inc | 109 ++++++++++++++++++ + .../cpu_model/aarch64/lse_atomics/illumos.inc | 5 + + 3 files changed, 121 insertions(+) + create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/fmv/illumos.inc + create mode 100644 compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc + +diff --git a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c b/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c +index b868caa991b2..a789a9c47745 100644 +--- a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c ++++ b/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c +@@ -45,6 +45,11 @@ _Bool __aarch64_have_lse_atomics + #elif defined(__ANDROID__) + #include "aarch64/hwcap.inc" + #include "aarch64/lse_atomics/android.inc" ++#elif defined(__illumos__) ++// clang-format off: should not reorder sys/auxv.h alphabetically ++#include ++// clang-format on ++#include "aarch64/lse_atomics/illumos.inc" + #elif __has_include() + #include "aarch64/hwcap.inc" + #include "aarch64/lse_atomics/sysauxv.inc" +@@ -73,6 +78,8 @@ struct { + #elif defined(__ANDROID__) + #include "aarch64/fmv/mrs.inc" + #include "aarch64/fmv/android.inc" ++#elif defined(__illumos__) ++#include "aarch64/fmv/illumos.inc" + #elif __has_include() + #include "aarch64/fmv/mrs.inc" + #include "aarch64/fmv/sysauxv.inc" +diff --git a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/illumos.inc b/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/illumos.inc +new file mode 100644 +index 000000000000..2a968e1a1d1f +--- /dev/null ++++ b/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/fmv/illumos.inc +@@ -0,0 +1,109 @@ ++#include ++#define HAVE_SYS_AUXV_H ++ ++static void __init_cpu_features_constructor(unsigned long hwcap, ++ const __ifunc_arg_t *arg) { ++ ++ uint64_t features = 0; ++ uint64_t hwcaps[] = { hwcap, arg->_hwcap2 }; ++ ++ static const struct hwcap_map_t { ++ uint32_t hw_cap; ++ uint32_t hw_index; ++ enum CPUFeatures hw_feature; ++ } hwcap_map[] = { ++ { AV_AARCH64_FP, 1, FEAT_FP }, ++ { AV_AARCH64_ADVSIMD, 1, FEAT_SIMD }, ++ { AV_AARCH64_SVE, 1, FEAT_SVE }, ++ { AV_AARCH64_CRC32, 1, FEAT_CRC }, ++ { AV_AARCH64_SB, 1, FEAT_SB }, ++// { AV_AARCH64_SSBS, 1, RESERVED_FEAT_SSBS}, ++// { AV_AARCH64_DGH, 1, RESERVED_FEAT_DGH}, ++// { AV_AARCH64_AES, 1, RESERVED_FEAT_AES}, ++ { AV_AARCH64_PMULL, 1, FEAT_PMULL}, ++// { AV_AARCH64_SHA1, 1, RESERVED_FEAT_SHA1}, ++ { AV_AARCH64_SHA256, 1, FEAT_SHA2}, ++ { AV_AARCH64_SHA512, 1, FEAT_SHA2}, ++ { AV_AARCH64_SHA3, 1, FEAT_SHA3}, ++// { AV_AARCH64_SM3, 1, ++// { AV_AARCH64_SM4, 1, ++ { AV_AARCH64_LSE, 1, FEAT_LSE}, ++ { AV_AARCH64_RDM, 1, FEAT_RDM}, ++ { AV_AARCH64_FP16, 1, FEAT_FP16}, ++ { AV_AARCH64_DOTPROD, 1, FEAT_DOTPROD}, ++// { AV_AARCH64_FHM, 1, ++// { AV_AARCH64_DCPOP, 1, ++ { AV_AARCH64_F32MM, 1, FEAT_SVE_F32MM}, ++ { AV_AARCH64_F64MM, 1, FEAT_SVE_F64MM}, ++// { AV_AARCH64_DCPODP, 1, ++ { AV_AARCH64_BF16, 1, FEAT_BF16}, ++ { AV_AARCH64_I8MM, 1, FEAT_I8MM}, ++ { AV_AARCH64_FCMA, 1, FEAT_FCMA}, ++ { AV_AARCH64_JSCVT, 1, FEAT_JSCVT}, ++ { AV_AARCH64_LRCPC, 1, FEAT_RCPC}, ++// { AV_AARCH64_PACA, 1, ++// { AV_AARCH64_PACG, 1, ++ { AV_AARCH64_DIT, 1, FEAT_DIT}, ++ { AV_AARCH64_2_FLAGM, 2, FEAT_FLAGM}, ++ { AV_AARCH64_2_ILRCPC, 2, FEAT_RCPC}, ++// { AV_AARCH64_2_LSE2, 2, ++ { AV_AARCH64_2_FLAGM2, 2, FEAT_FLAGM2}, ++ { AV_AARCH64_2_FRINTTS, 2, FEAT_FRINTTS}, ++ { AV_AARCH64_2_BTI, 2, FEAT_BTI}, ++ { AV_AARCH64_2_RNG, 2, FEAT_RNG}, ++ { AV_AARCH64_2_MTE, 2, FEAT_MEMTAG2}, ++// { AV_AARCH64_2_MTE3, 2, RESERVED_FEAT_MEMTAG3}, ++// { AV_AARCH64_2_ECV, 2, ++// { AV_AARCH64_2_AFP, 2, ++// { AV_AARCH64_2_RPRES, 2, RESERVED_FEAT_RPRES}, ++// { AV_AARCH64_2_LD64B, 2, ++// { AV_AARCH64_2_ST64BV, 2, ++// { AV_AARCH64_2_ST64BV0, ,2 ++ { AV_AARCH64_2_WFXT, 2, FEAT_WFXT}, ++ { AV_AARCH64_2_MOPS, 2, FEAT_MOPS}, ++// { AV_AARCH64_2_HBC, 2, ++// { AV_AARCH64_2_CMOW, 2, ++ { AV_AARCH64_2_SVE2, 2, FEAT_SVE2}, ++// { AV_AARCH64_2_SVE2_AES, 2, RESERVED_FEAT_SVE_AES}, ++ { AV_AARCH64_2_SVE2_BITPERM, 2, FEAT_SVE_BITPERM}, ++ { AV_AARCH64_2_SVE2_PMULL128, 2, FEAT_SVE_PMULL128}, ++ { AV_AARCH64_2_SVE2_SHA3, 2, FEAT_SVE_SHA3}, ++ { AV_AARCH64_2_SVE2_SM4, 2, FEAT_SVE_SM4}, ++// { AV_AARCH64_2_TME, 2, ++ { AV_AARCH64_2_SME, 2, FEAT_SME}, ++// { AV_AARCH64_2_SME_FA64, 2, ++// { AV_AARCH64_2_EBF16, 2, RESERVED_FEAT_EBF16}, ++ { AV_AARCH64_2_SME_F64F64, 2, FEAT_SME_F64}, ++ { AV_AARCH64_2_SME_I16I64, 2, FEAT_SME_I64} ++ }; ++ ++ for (size_t i = 0; i < sizeof (hwcap_map) / sizeof (hwcap_map[0]); i++) ++ if (hwcaps[hwcap_map[i].hw_index - 1] & hwcap_map[i].hw_cap) ++ features |= (1ULL << hwcap_map[i].hw_feature); ++ ++ __atomic_store_n(&__aarch64_cpu_features.features, features, __ATOMIC_RELAXED); ++} ++ ++void __init_cpu_features_resolver(unsigned long hwcap, ++ const __ifunc_arg_t *arg) { ++ if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED)) ++ return; ++ __init_cpu_features_constructor(hwcap, arg); ++} ++ ++void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) { ++ uint32_t hwcap[2] = {0}; ++ // CPU features already initialized. ++ if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED)) ++ return; ++ ++ uint_t res = getisax(hwcap, 2); ++ if (res == 0) ++ return; ++ ++ __ifunc_arg_t arg; ++ arg._size = sizeof(__ifunc_arg_t); ++ arg._hwcap = hwcap[0], ++ arg._hwcap2 = hwcap[1]; ++ __init_cpu_features_constructor(hwcap[0], &arg); ++} +diff --git a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc b/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc +new file mode 100644 +index 000000000000..78af1a19f48d +--- /dev/null ++++ b/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc +@@ -0,0 +1,5 @@ ++static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) { ++ uint32_t hwcap = 0; ++ uint_t res = getisax(&hwcap, 1); ++ __aarch64_have_lse_atomics = res != 0 && (hwcap & AV_AARCH64_LSE) != 0; ++} +-- +2.47.1 + diff --git a/build/rust/patches/aarch64-cpu-features.patch b/build/rust/patches/aarch64-cpu-features.patch deleted file mode 100644 index 367182005..000000000 --- a/build/rust/patches/aarch64-cpu-features.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -wpruN --no-dereference '--exclude=*.orig' a~/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc ---- a~/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc 1970-01-01 00:00:00 -+++ a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64/lse_atomics/illumos.inc 1970-01-01 00:00:00 -@@ -0,0 +1,9 @@ -+#include -+ -+static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) { -+ uint32_t hwc[2] = {0}; -+ -+ (void) getisax(&hwc, 2); -+ -+ __aarch64_have_lse_atomics = (hwc[0] & AV_AARCH64_LSE) != 0; -+} -diff -wpruN --no-dereference '--exclude=*.orig' a~/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c ---- a~/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c 1970-01-01 00:00:00 -+++ a/src/llvm-project/compiler-rt/lib/builtins/cpu_model/aarch64.c 1970-01-01 00:00:00 -@@ -45,6 +45,9 @@ _Bool __aarch64_have_lse_atomics - #elif defined(__ANDROID__) - #include "aarch64/hwcap.inc" - #include "aarch64/lse_atomics/android.inc" -+#elif defined(__illumos__) -+#include "aarch64/hwcap.inc" -+#include "aarch64/lse_atomics/illumos.inc" - #elif __has_include() - #include "aarch64/hwcap.inc" - #include "aarch64/lse_atomics/sysauxv.inc" -@@ -141,7 +144,7 @@ struct { - #elif defined(__ANDROID__) - #include "aarch64/fmv/mrs.inc" - #include "aarch64/fmv/android.inc" --#elif __has_include() -+#elif __has_include() && !defined(__illumos__) - #include "aarch64/fmv/mrs.inc" - #include "aarch64/fmv/sysauxv.inc" - #else diff --git a/build/rust/patches/aarch64-eh_frame-ro.patch b/build/rust/patches/aarch64-eh_frame-ro.patch index e5afe505e..7422b606a 100644 --- a/build/rust/patches/aarch64-eh_frame-ro.patch +++ b/build/rust/patches/aarch64-eh_frame-ro.patch @@ -3,7 +3,7 @@ Ensure .eh_frame is consistently read-only for aarch64 diff -wpruN --no-dereference '--exclude=*.orig' a~/src/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp a/src/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp --- a~/src/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp 1970-01-01 00:00:00 +++ a/src/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp 1970-01-01 00:00:00 -@@ -381,8 +381,10 @@ void MCObjectFileInfo::initELFMCObjectFi +@@ -383,8 +383,10 @@ void MCObjectFileInfo::initELFMCObjectFi // Solaris requires different flags for .eh_frame to seemingly every other // platform. unsigned EHSectionFlags = ELF::SHF_ALLOC; diff --git a/build/rust/patches/series b/build/rust/patches/series index 7c53c7705..9dd199a9d 100644 --- a/build/rust/patches/series +++ b/build/rust/patches/series @@ -1,2 +1,2 @@ aarch64-eh_frame-ro.patch -aarch64-cpu-features.patch +0001-aarch64-cpu-feature-support-for-illumos.patch diff --git a/doc/baseline.aarch64 b/doc/baseline.aarch64 index 359400044..efb67109f 100644 --- a/doc/baseline.aarch64 +++ b/doc/baseline.aarch64 @@ -17,6 +17,7 @@ extra.omnios ooce/developer/cunit extra.omnios ooce/developer/git-absorb extra.omnios ooce/developer/ninja extra.omnios ooce/developer/protobuf +extra.omnios ooce/developer/rust extra.omnios ooce/editor/joe extra.omnios ooce/file/tree extra.omnios ooce/fonts/liberation diff --git a/doc/pkglist.aarch64 b/doc/pkglist.aarch64 index 9db96299a..454824512 100644 --- a/doc/pkglist.aarch64 +++ b/doc/pkglist.aarch64 @@ -9,6 +9,7 @@ # .SYSROOT Wait, rebuild the repo, `pkg install *` to the # arch-specific sysroot. +ooce/developer/rust ooce/system/htop ooce/library/libogg ooce/library/nettle