diff --git a/recipes/dev/gcc13/recipe.sh b/recipes/dev/gcc13/recipe.sh deleted file mode 100644 index fef38205..00000000 --- a/recipes/dev/gcc13/recipe.sh +++ /dev/null @@ -1,56 +0,0 @@ -VERSION="13.2.0" -TAR="https://gitlab.redox-os.org/redox-os/gcc/-/archive/redox-${VERSION}/gcc-redox-${VERSION}.tar.gz" -#GIT=https://gitlab.redox-os.org/redox-os/gcc.git -#GIT_UPSTREAM=https://gcc.gnu.org/git/gcc.git -#BRANCH="redox-${VERSION}" -BUILD_DEPENDS=(relibc) -DEPENDS="gnu-binutils relibc" - -function recipe_version { - echo "${VERSION}" - skip=1 -} - -function recipe_build { - ./contrib/download_prerequisites - cp config.sub gmp/config.sub - cp config.sub isl/config.sub - cp config.sub mpfr/config.sub - cp -f config.sub mpc/config.sub - - sysroot="$(realpath ../sysroot)" - mkdir -p "$sysroot/usr" - ln -sf "$sysroot/include" "$sysroot/usr/include" - ln -sf "$sysroot/lib" "$sysroot/usr/lib" - export LDFLAGS="--static" - ./configure \ - --build=${BUILD} \ - --host=${HOST} \ - --target=${HOST} \ - --prefix=/ \ - --with-sysroot=/ \ - --with-build-sysroot="$sysroot" \ - --with-static-standard-libraries \ - --disable-dlopen \ - --disable-lto \ - --disable-nls \ - --enable-languages=c,c++ \ - --enable-shared \ - --enable-static \ - --enable-threads=posix - "$REDOX_MAKE" -j "$(nproc)" all-gcc all-target-libgcc all-target-libstdc++-v3 - skip=1 -} - -function recipe_clean { - "$REDOX_MAKE" clean - skip=1 -} - -function recipe_stage { - dest="$(realpath $1)" - "$REDOX_MAKE" DESTDIR="$dest" install-gcc install-target-libgcc install-target-libstdc++-v3 - find "$dest"/{bin,libexec} -exec $STRIP {} ';' 2> /dev/null - ln -s "gcc" "$1/bin/cc" - skip=1 -} diff --git a/recipes/dev/gcc13/recipe.toml b/recipes/dev/gcc13/recipe.toml new file mode 100644 index 00000000..106e8e74 --- /dev/null +++ b/recipes/dev/gcc13/recipe.toml @@ -0,0 +1,65 @@ +[source] +tar = "https://gitlab.redox-os.org/redox-os/gcc/-/archive/redox-13.2.0/gcc-redox-13.2.0.tar.gz" + +[build] +template = "custom" +dependencies = [ + "libgmp", + "libmpfr", + "mpc", + "zlib" +] +script = """ +DYNAMIC_INIT + +mkdir -p "${COOKBOOK_SYSROOT}/usr" +ln -sf "${COOKBOOK_SYSROOT}/include" "${COOKBOOK_SYSROOT}/usr/include" +ln -sf "${COOKBOOK_SYSROOT}/lib" "${COOKBOOK_SYSROOT}/usr/lib" + +pushd $COOKBOOK_SOURCE +COOKBOOK_AUTORECONF=autoreconf2.69 autotools_recursive_regenerate -I"$(realpath ./config)" +cp -fpv $COOKBOOK_HOST_SYSROOT/share/libtool/build-aux/{config.sub,config.guess,install-sh} libiberty/ +popd # pushd $COOKBOOK_SOURCE + +COOKBOOK_CONFIGURE_FLAGS=( + --host="${GNU_TARGET}" + --target="${GNU_TARGET}" + --prefix=/ + --enable-shared + --disable-static + --with-sysroot=/ + --with-build-sysroot="${COOKBOOK_SYSROOT}" + --enable-languages=c,c++,lto + --enable-initfini-array + --disable-multilib + --with-system-zlib + --enable-host-shared + --with-bugurl="https://gitlab.redox-os.org/redox-os/gcc/-/issues" +) + +if [[ -n "$COOKBOOK_PREFER_STATIC" ]]; then + COOKBOOK_CONFIGURE_FLAGS+=( + --enable-static + --disable-shared + ) +else + COOKBOOK_CONFIGURE_FLAGS+=( + --enable-shared + --disable-static + ) +fi + +"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" +"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-gcc +"${COOKBOOK_MAKE}" install-gcc DESTDIR="${COOKBOOK_STAGE}" +ln -s "gcc" "${COOKBOOK_STAGE}/bin/cc" +""" + +[package] +dependencies = [ + "libgcc", + "libgmp", + "libmpfr", + "mpc", + "zlib" +] diff --git a/recipes/dev/git/recipe.sh b/recipes/dev/git/recipe.sh index 0d6f14c2..90c672ef 100644 --- a/recipes/dev/git/recipe.sh +++ b/recipes/dev/git/recipe.sh @@ -1,7 +1,7 @@ VERSION=2.13.1 TAR=https://www.kernel.org/pub/software/scm/git/git-$VERSION.tar.xz BUILD_DEPENDS=(zlib curl openssl1 expat nghttp2) -DEPENDS="ca-certificates" +DEPENDS="ca-certificates nghttp2" MAKEFLAGS=( NEEDS_SSL_WITH_CURL=1 @@ -24,7 +24,7 @@ function recipe_version { function recipe_build { sysroot="$(realpath ../sysroot)" - export LDFLAGS="-L$sysroot/lib -static" + export LDFLAGS="-L$sysroot/lib" export CPPFLAGS="-I$sysroot/include" export CURL_CONFIG="$sysroot/bin/curl-config" ./configure \ diff --git a/recipes/dev/gnu-make/recipe.toml b/recipes/dev/gnu-make/recipe.toml index 7db31a04..fb274e60 100644 --- a/recipes/dev/gnu-make/recipe.toml +++ b/recipes/dev/gnu-make/recipe.toml @@ -1,9 +1,19 @@ -#TODO very basic makefiles are tested to work but needs more testing -[source] -tar = "http://ftp.gnu.org/gnu/make/make-4.4.tar.gz" -patches = [ - "redox.patch" -] - -[build] -template = "configure" +#TODO very basic makefiles are tested to work but needs more testing +[source] +tar = "http://ftp.gnu.org/gnu/make/make-4.4.tar.gz" +patches = [ + "redox.patch" +] +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + +[build] +template = "custom" +script = """ +DYNAMIC_INIT +cp -rp "$COOKBOOK_SOURCE/." ./ +cookbook_configure +""" + diff --git a/recipes/libs/libgcc/recipe.toml b/recipes/libs/libgcc/recipe.toml new file mode 100644 index 00000000..cfdf136a --- /dev/null +++ b/recipes/libs/libgcc/recipe.toml @@ -0,0 +1,11 @@ +[source] +path = "../prefix/x86_64-unknown-redox/sysroot" + +[build] +template = "custom" +script = """ +mkdir -p "${COOKBOOK_STAGE}/lib" +cp -vr ${COOKBOOK_HOST_SYSROOT}/lib/gcc ${COOKBOOK_STAGE}/lib/ +cp -vr ${COOKBOOK_HOST_SYSROOT}/${TARGET}/lib/. ${COOKBOOK_STAGE}/lib/ +rm ${COOKBOOK_STAGE}/lib/{crt0.o,crt1.o,crti.o,crtn.o,libc.a,libc.so.6,ld64.so.1} +""" diff --git a/recipes/libs/libgmp/recipe.toml b/recipes/libs/libgmp/recipe.toml index e464785c..a2330bd6 100644 --- a/recipes/libs/libgmp/recipe.toml +++ b/recipes/libs/libgmp/recipe.toml @@ -1,5 +1,19 @@ +# GNU Multiple Precision Arithmetic Library (GMP) is a free and open source +# library for arbitrary-precision arithmetic, operating on signed integers, +# rational numbers, and floating-point numbers. + [source] -tar = "https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz" -blake3 = "52cecfbbe286820d1f8bc118769008acb6451bd074fe6dea9e868d54b2ada855" +tar = "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" +blake3 = "fffe4996713928ae19331c8ef39129e46d3bf5b7182820656fd4639435cd83a4" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + [build] -template = "configure" +template = "custom" +script = """ +DYNAMIC_INIT +cookbook_configure +""" + diff --git a/recipes/libs/libiconv/01_redox.patch b/recipes/libs/libiconv/01_redox.patch index 860bbed5..1e083ca8 100644 --- a/recipes/libs/libiconv/01_redox.patch +++ b/recipes/libs/libiconv/01_redox.patch @@ -1,7 +1,7 @@ -diff -ruw source/srclib/getprogname.c source-new/srclib/getprogname.c ---- source/srclib/getprogname.c 2017-01-01 16:02:21.000000000 -0700 -+++ source-new/srclib/getprogname.c 2018-12-29 08:08:09.138286508 -0700 -@@ -43,6 +43,14 @@ +diff '--color=auto' -ur source/srclib/getprogname.c source-new/srclib/getprogname.c +--- source/srclib/getprogname.c 2022-01-04 19:33:29.000000000 +1100 ++++ source-new/srclib/getprogname.c 2024-11-24 00:42:48.384997609 +1100 +@@ -28,6 +28,14 @@ # include #endif @@ -13,13 +13,13 @@ diff -ruw source/srclib/getprogname.c source-new/srclib/getprogname.c +# include +#endif + - #include "dirname.h" - - #ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ -@@ -143,6 +151,17 @@ - free (buf.ps_pathptr); + #ifdef __MVS__ + # ifndef _OPEN_SYS + # define _OPEN_SYS +@@ -287,6 +295,17 @@ + close (fd); } - return p; + return "?"; +# elif defined(__redox__) + char filename[PATH_MAX]; + int fd = open ("sys:exe", O_RDONLY); diff --git a/recipes/libs/libiconv/recipe.toml b/recipes/libs/libiconv/recipe.toml index 3c0970b7..38e46cce 100644 --- a/recipes/libs/libiconv/recipe.toml +++ b/recipes/libs/libiconv/recipe.toml @@ -1,15 +1,40 @@ [source] -tar = "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz" -blake3 = "b736af4e8245ae9f1618ef226a3bf2a998334b745520565cf413c0a7d54b6924" +tar = "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz" +blake3 = "820b3b9fd3e2181bfb95475f01e9a3451e6d751e4f8c98ebcdcca1d8aa720f7f" patches = [ "01_redox.patch" ] +script = """ +DYNAMIC_INIT +cp ${COOKBOOK_HOST_SYSROOT}/share/aclocal/libtool.m4 ./m4/ +cp ${COOKBOOK_HOST_SYSROOT}/share/aclocal/libtool.m4 ./libcharset/m4/ +cp -fp ${COOKBOOK_HOST_SYSROOT}/share/libtool/build-aux/ltmain.sh ./build-aux/ +cp -fp ${COOKBOOK_HOST_SYSROOT}/share/libtool/build-aux/ltmain.sh ./libcharset/build-aux/ +cp ${COOKBOOK_HOST_SYSROOT}/share/aclocal/ltversion.m4 ./m4/ +cp ${COOKBOOK_HOST_SYSROOT}/share/aclocal/ltversion.m4 ./libcharset/m4/ + +autotools_recursive_regenerate -I$(realpath ./m4) -I$(realpath ./srcm4) +""" [build] template = "custom" script = """ -COOKBOOK_CONFIGURE_FLAGS+=( +DYNAMIC_INIT +COOKBOOK_CONFIGURE_FLAGS=( + --host="${GNU_TARGET}" + --prefix="" ac_cv_have_decl_program_invocation_name=no ) +if [[ -n "$COOKBOOK_PREFER_STATIC" ]]; then + COOKBOOK_CONFIGURE_FLAGS+=( + --enable-static + --disable-shared + ) +else + COOKBOOK_CONFIGURE_FLAGS+=( + --enable-shared + --enable-static + ) +fi cookbook_configure """ diff --git a/recipes/libs/libmpfr/recipe.toml b/recipes/libs/libmpfr/recipe.toml index a1f9d91f..3e653153 100644 --- a/recipes/libs/libmpfr/recipe.toml +++ b/recipes/libs/libmpfr/recipe.toml @@ -1,9 +1,18 @@ [source] tar = "https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.xz" blake3 = "f428023b8f7569fc1178faf63265ecb6cab4505fc3fce5d8c46af70db848a334" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" [build] +template = "custom" dependencies = [ "libgmp", ] -template = "configure" +script = """ +DYNAMIC_INIT +cookbook_configure +""" + diff --git a/recipes/libs/mpc/recipe.toml b/recipes/libs/mpc/recipe.toml new file mode 100644 index 00000000..749805ad --- /dev/null +++ b/recipes/libs/mpc/recipe.toml @@ -0,0 +1,21 @@ + # C library for the arithmetic of complex numbers with arbitrarily high + # precision and correct rounding of the result. + +[source] +tar = "https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + +[build] +template = "custom" +dependencies = [ + "libgmp", + "libmpfr", +] +script = """ +DYNAMIC_INIT +cookbook_configure +""" + diff --git a/recipes/libs/nghttp2/recipe.toml b/recipes/libs/nghttp2/recipe.toml index 81ef6277..ce862c9f 100644 --- a/recipes/libs/nghttp2/recipe.toml +++ b/recipes/libs/nghttp2/recipe.toml @@ -1,9 +1,16 @@ [source] -tar = "https://github.com/nghttp2/nghttp2/releases/download/v1.62.1/nghttp2-1.62.1.tar.xz" -blake3 = "77b1c0fed8e97db0aa7d6e1a5ed16e5a053093ed0006b7c747dca290d694f3af" +tar = "https://github.com/nghttp2/nghttp2/releases/download/v1.64.0/nghttp2-1.64.0.tar.xz" +blake3 = "1bbc08de4816769d800c42f501a00c1ba3f5efa1b76e1f65d2e5bdf3aa30354d" +script = """ +DYNAMIC_INIT +autotools_recursive_regenerate +""" + [build] template = "custom" script = """ +DYNAMIC_INIT + COOKBOOK_CONFIGURE_FLAGS+=( --enable-lib-only ) diff --git a/recipes/libs/openssl1/openssl1.patch b/recipes/libs/openssl1/openssl1.patch new file mode 100644 index 00000000..82fe3ac2 --- /dev/null +++ b/recipes/libs/openssl1/openssl1.patch @@ -0,0 +1,50 @@ +diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf +index 45e2fc7a..2d7f7db3 100644 +--- a/Configurations/10-main.conf ++++ b/Configurations/10-main.conf +@@ -175,28 +175,32 @@ sub vms_info { + }, + + +-### Redox +- "redox-aarch64" => { +- inherit_from => [ "BASE_common", asm("aarch64_asm") ], ++### Redox configurations ++ "redox-common" => { ++ inherit_from => [ "BASE_common" ], + cc => "gcc", +- cflags => "-DL_ENDIAN -DOSSL_SSIZE_MAX=LONG_MAX -DNO_SYSLOG -O3 -static -Wall", ++ thread_scheme => "(unknown)", ++ dso_scheme => "dlfcn", ++ shared_target => "linux-shared", ++ shared_cflag => "-fPIC", ++ shared_ldflag => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" }, ++ shared_extension => ".so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++ }, ++ "redox-aarch64" => { ++ inherit_from => [ "redox-common", asm("aarch64_asm") ], ++ cflags => "-DL_ENDIAN -DOSSL_SSIZE_MAX=LONG_MAX -DNO_SYSLOG -O3 -Wall", + bn_ops => "SIXTY_FOUR_BIT_LONG", + perlasm_scheme => "elf", +- thread_scheme => "(unknown)", + }, + "redox-i686" => { +- inherit_from => [ "BASE_unix", asm("x86_elf_asm") ], +- cc => "gcc", +- cflags => "-DL_ENDIAN -DNO_SYSLOG -O3 -static -Wall", ++ inherit_from => [ "redox-common", asm("x86_elf_asm") ], ++ cflags => "-DL_ENDIAN -DNO_SYSLOG -O3 -Wall", + bn_ops => "BN_LLONG", +- thread_scheme => "(unknown)", + }, + "redox-x86_64" => { +- inherit_from => [ "BASE_common", asm("x86_64_asm") ], +- cc => "gcc", +- cflags => "-DL_ENDIAN -DOSSL_SSIZE_MAX=LONG_MAX -DNO_SYSLOG -O3 -static -Wall", ++ inherit_from => [ "redox-common", asm("x86_64_asm") ], ++ cflags => "-DL_ENDIAN -DOSSL_SSIZE_MAX=LONG_MAX -DNO_SYSLOG -O3 -Wall", + bn_ops => "SIXTY_FOUR_BIT_LONG", +- thread_scheme => "(unknown)", + }, + + #### Solaris configurations diff --git a/recipes/libs/openssl1/recipe.toml b/recipes/libs/openssl1/recipe.toml index 55b707c0..2666b386 100644 --- a/recipes/libs/openssl1/recipe.toml +++ b/recipes/libs/openssl1/recipe.toml @@ -5,15 +5,18 @@ branch = "redox-v1" [build] template = "custom" script = """ +DYNAMIC_INIT ARCH="${TARGET%%-*}" COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/Configure" COOKBOOK_CONFIGURE_FLAGS=( - no-shared + shared no-dgram "redox-${ARCH}" --prefix="/" ) export CC="${TARGET}-gcc" -cookbook_configure +"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" +"${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}" +"${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}" rm -rfv "${COOKBOOK_STAGE}/"{share,ssl} """ diff --git a/recipes/libs/zlib/recipe.toml b/recipes/libs/zlib/recipe.toml index 8e9a8709..fe1fc839 100644 --- a/recipes/libs/zlib/recipe.toml +++ b/recipes/libs/zlib/recipe.toml @@ -4,11 +4,10 @@ blake3 = "ec1abc6f672a7a6ee6f49ba544cc9529f73121b478310473be44fee22a140ebf" [build] template = "custom" script = """ - export LDFLAGS="--static" + DYNAMIC_INIT # See https://stackoverflow.com/questions/21396988/zlib-build-not-configuring-properly-with-cross-compiler-ignores-ar. - CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" \ - --prefix="" \ - --static + CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" --prefix="" "${COOKBOOK_MAKE}" -j "$(nproc)" "${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}" """ + diff --git a/recipes/tools/gnu-binutils/01_build_fix.patch b/recipes/tools/gnu-binutils/01_build_fix.patch new file mode 100644 index 00000000..9bf0ddac --- /dev/null +++ b/recipes/tools/gnu-binutils/01_build_fix.patch @@ -0,0 +1,24 @@ +diff '--color=auto' -ur source/gprofng/libcollector/configure.ac source-new/gprofng/libcollector/configure.ac +--- source/gprofng/libcollector/configure.ac 2024-08-17 09:00:00.000000000 +1000 ++++ source-new/gprofng/libcollector/configure.ac 2024-12-04 15:59:58.407412951 +1100 +@@ -18,7 +18,7 @@ + + m4_include([../../bfd/version.m4]) + AC_INIT([gprofng], [BFD_VERSION]) +-AC_CONFIG_MACRO_DIRS([../../config ../..]) ++#AC_CONFIG_MACRO_DIRS([../../config ../..]) + AC_CONFIG_AUX_DIR(../..) + AC_CANONICAL_TARGET + AM_INIT_AUTOMAKE +diff '--color=auto' -ur source/libiberty/configure.ac source-new/libiberty/configure.ac +--- source/libiberty/configure.ac 2024-08-17 09:00:00.000000000 +1000 ++++ source-new/libiberty/configure.ac 2024-12-04 15:59:31.572203764 +1100 +@@ -37,7 +37,7 @@ + libiberty_topdir="${srcdir}/.." + fi + AC_SUBST(libiberty_topdir) +-AC_CONFIG_AUX_DIR($libiberty_topdir) ++AC_CONFIG_AUX_DIR([.]) + + dnl Very limited version of automake's enable-maintainer-mode + diff --git a/recipes/tools/gnu-binutils/recipe.sh b/recipes/tools/gnu-binutils/recipe.sh deleted file mode 100644 index f87b12bc..00000000 --- a/recipes/tools/gnu-binutils/recipe.sh +++ /dev/null @@ -1,47 +0,0 @@ -GIT=https://gitlab.redox-os.org/redox-os/binutils-gdb.git -BRANCH=redox-2.41 -GIT_UPSTREAM=https://sourceware.org/git/binutils-gdb.git -BUILD_DEPENDS=(expat libgmp libmpfr) - -function recipe_version { - printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" - skip=1 -} - -function recipe_build { - sysroot="$(realpath ../sysroot)" - mkdir -p "$sysroot/usr" - ln -sf "$sysroot/include" "$sysroot/usr/include" - ln -sf "$sysroot/lib" "$sysroot/usr/lib" - export CPPFLAGS="-I$sysroot/include -pie -fPIC -g" - export LDFLAGS="-L$sysroot/lib --static -g" - ./configure \ - --build=${BUILD} \ - --host=${HOST} \ - --target=${HOST} \ - --prefix=/ \ - --with-sysroot=/ \ - --with-build-sysroot="$sysroot" \ - --enable-gdb \ - --with-expat \ - --with-multilib \ - --with-interwork \ - --enable-targets="${TARGET}" \ - --disable-lto \ - --disable-nls \ - --disable-werror - "$REDOX_MAKE" -j"$($NPROC)" - skip=1 -} - -function recipe_clean { - "$REDOX_MAKE" clean - skip=1 -} - -function recipe_stage { - dest="$(realpath $1)" - "$REDOX_MAKE" DESTDIR="$dest" install - find "$dest/bin" -exec $STRIP {} ';' 2> /dev/null - skip=1 -} diff --git a/recipes/tools/gnu-binutils/recipe.toml b/recipes/tools/gnu-binutils/recipe.toml new file mode 100644 index 00000000..198037b1 --- /dev/null +++ b/recipes/tools/gnu-binutils/recipe.toml @@ -0,0 +1,47 @@ +[source] +tar = "https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.xz" +patches = ["01_build_fix.patch"] +script = """ +DYNAMIC_INIT + +COOKBOOK_AUTORECONF=autoreconf2.69 autotools_recursive_regenerate -I"$(realpath ./config)" +cp -fpv ${COOKBOOK_HOST_SYSROOT}/share/libtool/build-aux/{config.sub,config.guess,install-sh} libiberty/ +""" + +[build] +template = "custom" +dependencies = [ + "expat", + "libgmp", + "libmpfr", + "zlib", +] +script = """ +DYNAMIC_INIT + +COOKBOOK_CONFIGURE_FLAGS+=( + --target="${GNU_TARGET}" + --disable-werror + --disable-dependency-tracking + --disable-nls + --enable-colored-disassembly + --enable-gdb + --with-system-zlib + --with-multilib + --with-interwork + --with-pic + --with-expat +) + +cookbook_configure +""" + +[package] +dependencies = [ + "libgcc", + "expat", + "libgmp", + "libmpfr", + "zlib", +] + diff --git a/recipes/wip/libs/other/mpc/recipe.toml b/recipes/wip/libs/other/mpc/recipe.toml deleted file mode 100644 index bb6d1d4b..00000000 --- a/recipes/wip/libs/other/mpc/recipe.toml +++ /dev/null @@ -1,9 +0,0 @@ -#TODO compiled but not tested -[source] -tar = "https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz" -[build] -template = "configure" -dependencies = [ - "libgmp", - "libmpfr", -] diff --git a/src/bin/cook.rs b/src/bin/cook.rs index 4b394b74..fcfab14a 100644 --- a/src/bin/cook.rs +++ b/src/bin/cook.rs @@ -168,6 +168,35 @@ fn run_command_stdin(mut command: process::Command, stdin_data: &[u8]) -> Result Ok(()) } +static SHARED_PRESCRIPT: &str = r#" +function DYNAMIC_INIT { + COOKBOOK_AUTORECONF="autoreconf" + autotools_recursive_regenerate() { + for f in $(find . -name configure.ac -o -name configure.in -type f | sort); do + echo "* autotools regen in '$(dirname $f)'..." + ( cd "$(dirname "$f")" && "${COOKBOOK_AUTORECONF}" -fvi "$@" -I${COOKBOOK_HOST_SYSROOT}/share/aclocal ) + done + } + + if [[ -n "$COOKBOOK_PREFER_STATIC" ]]; then + return + fi + + echo "WARN: Program is being compiled dynamically." + + COOKBOOK_CONFIGURE_FLAGS=( + --host="${GNU_TARGET}" + --prefix="" + --enable-shared + --disable-static + ) + + # TODO: check paths for spaces + export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib" + export RUSTFLAGS="-C target-feature=-crt-static" +} +"#; + fn fetch(recipe_dir: &Path, source: &Option) -> Result { let source_dir = recipe_dir.join("source"); match source { @@ -392,7 +421,7 @@ fi"#, let mut command = Command::new("bash"); command.arg("-ex"); command.current_dir(&source_dir_tmp); - run_command_stdin(command, script.as_bytes())?; + run_command_stdin(command, format!("{SHARED_PRESCRIPT}\n{script}").as_bytes())?; } // Move source.tmp to source atomically @@ -610,28 +639,6 @@ function cookbook_configure { "${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" "${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}" } - -function DYNAMIC_INIT { - echo "WARN: Program is being compiled dynamically." - - COOKBOOK_CONFIGURE_FLAGS=( - --host="${GNU_TARGET}" - --prefix="" - --enable-shared - --disable-static - ) - - # TODO: check paths for spaces - export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib" - - autotools_recursive_regenerate() { - for f in $(find . -name configure.ac -o -name configure.in -type f | sort); do - echo "* autotools regenerate in '$(dirname $f)'..." - ( cd "$(dirname "$f")" && autoreconf -fvi "$@" -I${COOKBOOK_HOST_SYSROOT}/share/aclocal ) - done - } -} - "#; let post_script = r#"# Common post script @@ -716,7 +723,7 @@ done command }; - let full_script = format!("{}\n{}\n{}", pre_script, script, post_script); + let full_script = format!("{}\n{}\n{}\n{}", pre_script, SHARED_PRESCRIPT, script, post_script); run_command_stdin(command, full_script.as_bytes())?; // Move stage.tmp to stage atomically