From 765994d7c81e63e93c514ac22ff34196ed8c20b6 Mon Sep 17 00:00:00 2001 From: OscarL Date: Mon, 26 May 2025 05:57:53 +0000 Subject: [PATCH] muon: update recipe to 0.4.0. (#12404) Had to switch to a non-boostrap build, to avoid pretty early errors. --- dev-build/muon/muon-0.2.0.recipe | 58 --------- dev-build/muon/muon-0.4.0.recipe | 129 +++++++++++++++++++++ dev-build/muon/patches/muon-0.2.0.patchset | 24 ---- dev-build/muon/patches/muon-0.4.0.patchset | 124 ++++++++++++++++++++ 4 files changed, 253 insertions(+), 82 deletions(-) delete mode 100644 dev-build/muon/muon-0.2.0.recipe create mode 100644 dev-build/muon/muon-0.4.0.recipe delete mode 100644 dev-build/muon/patches/muon-0.2.0.patchset create mode 100644 dev-build/muon/patches/muon-0.4.0.patchset diff --git a/dev-build/muon/muon-0.2.0.recipe b/dev-build/muon/muon-0.2.0.recipe deleted file mode 100644 index 962b999c2..000000000 --- a/dev-build/muon/muon-0.2.0.recipe +++ /dev/null @@ -1,58 +0,0 @@ -SUMMARY="A meson implementation in C" -DESCRIPTION="Muon is a meson implementation in c99 with minimal dependencies" -HOMEPAGE="https://sr.ht/~lattis/muon" -COPYRIGHT="2022-2024 Stone Tickle" -LICENSE="GNU GPL v3" -REVISION="1" -SOURCE_URI="https://git.sr.ht/~lattis/muon/archive/$portVersion.tar.gz" -CHECKSUM_SHA256="d73db1be5388821179a25a15ba76fd59a8bf7c8709347a4ec2cb91755203f36c" -PATCHES="muon-$portVersion.patchset" - -ARCHITECTURES="!all" - -PROVIDES=" - muon = $portVersion - cmd:muon = $portVersion - " -REQUIRES=" - haiku - lib:libarchive$secondaryArchSuffix - lib:libcurl$secondaryArchSuffix - lib:libpkgconf$secondaryArchSuffix - " - -BUILD_REQUIRES=" - haiku_devel - devel:libarchive$secondaryArchSuffix - devel:libcurl$secondaryArchSuffix - devel:libpkgconf$secondaryArchSuffix - " -BUILD_PREREQUIRES=" - cmd:sed - cmd:gcc - cmd:ninja - " - -BUILD() -{ - export CC=gcc - - # Stage 1 - ./bootstrap.sh build-stage1 - - # Stage 2 - build-stage1/muon setup build-stage2 - ninja -C build-stage2 - - # Stage 3 - build-stage2/muon setup \ - -D prefix=$prefix \ - build - ninja -C build -} - -INSTALL() -{ - cd build - DESTDIR="$prefix" ./muon install -} diff --git a/dev-build/muon/muon-0.4.0.recipe b/dev-build/muon/muon-0.4.0.recipe new file mode 100644 index 000000000..2d0a9c1f0 --- /dev/null +++ b/dev-build/muon/muon-0.4.0.recipe @@ -0,0 +1,129 @@ +SUMMARY="A meson implementation in C" +DESCRIPTION="Muon is a meson implementation in c99 with minimal dependencies" +HOMEPAGE="https://muon.build/" +COPYRIGHT="2022-2025 Stone Tickle" +LICENSE="GNU GPL v3" +REVISION="1" +SOURCE_URI="https://muon.build/releases/v$portVersion/muon-v$portVersion.tar.gz" +CHECKSUM_SHA256="9121f2521fb5037a87a922573b7fd886f0c4e7eb17696dd80901d810b9b56609" +SOURCE_DIR="muon-v$portVersion" +PATCHES="muon-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +# Bootstrap build fails pretty early on. +BOOSTRAP_BUILD=false + +PROVIDES=" + muon = $portVersion + cmd:muon = $portVersion + " +REQUIRES=" + haiku + lib:libarchive$secondaryArchSuffix + lib:libcurl$secondaryArchSuffix + lib:libpkgconf$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku_devel + devel:libarchive$secondaryArchSuffix + devel:libcurl$secondaryArchSuffix + devel:libpkgconf$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:sed + cmd:gcc$secondaryArchSuffix + " + +if $BoostrapBuild; then + BUILD_PREREQUIRES+=" + cmd:ninja + cmd:meson + " +fi + +BUILD_BOOSTRAP() +{ + export CC=gcc + + # Stage 1 + ./bootstrap.sh build + + # Stage 2 + CFLAGS="-Dprefix=$prefix" \ + build/muon-bootstrap setup build + + build/muon-bootstrap -C build samu +} + + +BUILD_NON_BOOSTRAP() +{ + unset meson + meson setup build \ + --buildtype=release \ + --prefix="$prefix" \ + -Ddocs=disabled \ + -Dwebsite=false + ninja -C build +} + +BUILD() +{ + if $BOOSTRAP_BUILD; then + BUILD_BOOSTRAP + else + BUILD_NON_BOOSTRAP + fi +} + + +INSTALL_BOOSTRAP() +{ + build/muon install -C build +} + +INSTALL_NON_BOOSTRAP() +{ + unset meson + meson install -C build +} + +INSTALL() +{ + if $BOOSTRAP_BUILD; then + INSTALL_BOOSTRAP + else + INSTALL_NON_BOOSTRAP + fi +} + + +TEST_BOOSTRAP() +{ + build/muon test -C build +} + +TEST_NON_BOOSTRAP() +{ + unset meson + meson test -C build +} + +# For reference, results on beta5 64 bits: +# Ok: 291 +# Expected Fail: 3 +# Fail: 38 +# Unexpected Pass: 0 +# Skipped: 16 +# Timeout: 2 +TEST() +{ + if $BOOSTRAP_BUILD; then + TEST_BOOSTRAP + else + TEST_NON_BOOSTRAP + fi +} diff --git a/dev-build/muon/patches/muon-0.2.0.patchset b/dev-build/muon/patches/muon-0.2.0.patchset deleted file mode 100644 index 82ddca0eb..000000000 --- a/dev-build/muon/patches/muon-0.2.0.patchset +++ /dev/null @@ -1,24 +0,0 @@ -From 5a643d304767a91a1bdb2dff91dc55e288b767d3 Mon Sep 17 00:00:00 2001 -From: Alexander von Gluck IV -Date: Sat, 16 Mar 2024 15:38:54 -0500 -Subject: [PATCH] build: Add haiku to posix operating systems - ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/meson.build b/meson.build -index 80ac7ea..455f402 100644 ---- a/meson.build -+++ b/meson.build -@@ -41,6 +41,7 @@ if ( - 'cygwin', - 'darwin', - 'freebsd', -+ 'haiku', - 'linux', - 'msys2', - 'netbsd', --- -2.43.2 - diff --git a/dev-build/muon/patches/muon-0.4.0.patchset b/dev-build/muon/patches/muon-0.4.0.patchset new file mode 100644 index 000000000..0f70a64f9 --- /dev/null +++ b/dev-build/muon/patches/muon-0.4.0.patchset @@ -0,0 +1,124 @@ +From 070e391bb1cb4e36a07f2da0351e9aeb5ffff4e1 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sun, 18 May 2025 21:10:21 -0300 +Subject: Replace `os_getopt()` with the one from `src/platform/windows/os.c`. + +See: https://dev.haiku-os.org/ticket/18852 + +Fixes almost all the test failures. (from 260 down to 4 on nightlies). + +diff --git a/src/platform/posix/os.c b/src/platform/posix/os.c +index c537aa0..b38c3ab 100644 +--- a/src/platform/posix/os.c ++++ b/src/platform/posix/os.c +@@ -33,12 +33,107 @@ os_getcwd(char *buf, size_t size) + return getcwd(buf, size); + } + ++#define REPLACE_GETOPT 1 ++#if REPLACE_GETOPT ++/* ++ * getopt ported from musl libc ++ */ ++char *optarg; ++int optind = 1, opterr = 1, optopt, __optpos, __optreset = 0; ++ ++#define optpos __optpos ++ ++int ++os_getopt(int argc, char *const argv[], const char *optstring) ++{ ++ int i; ++ char c, d; ++ ++ if (!optind || __optreset) { ++ __optreset = 0; ++ __optpos = 0; ++ optind = 1; ++ } ++ ++ if (optind >= argc || !argv[optind]) { ++ return -1; ++ } ++ ++ if (argv[optind][0] != '-') { ++ if (optstring[0] == '-') { ++ optarg = argv[optind++]; ++ return 1; ++ } ++ return -1; ++ } ++ ++ if (!argv[optind][1]) { ++ return -1; ++ } ++ ++ if (argv[optind][1] == '-' && !argv[optind][2]) { ++ return optind++, -1; ++ } ++ ++ if (!optpos) { ++ optpos++; ++ } ++ ++ c = argv[optind][optpos]; ++ ++optpos; ++ ++ if (!argv[optind][optpos]) { ++ optind++; ++ optpos = 0; ++ } ++ ++ if (optstring[0] == '-' || optstring[0] == '+') { ++ optstring++; ++ } ++ ++ i = 0; ++ do { ++ d = optstring[i]; ++ i++; ++ } while (d != c); ++ ++ if (d != c || c == ':') { ++ optopt = c; ++ if (optstring[0] != ':' && opterr) { ++ fprintf(stderr, "%s: unrecognized option: %c\n", argv[0], c); ++ } ++ return '?'; ++ } ++ if (optstring[i] == ':') { ++ optarg = 0; ++ if (optstring[i + 1] != ':' || optpos) { ++ optarg = argv[optind++] + optpos; ++ optpos = 0; ++ } ++ if (optind > argc) { ++ optopt = c; ++ if (optstring[0] == ':') { ++ return ':'; ++ } ++ if (opterr) { ++ fprintf(stderr, "%s: option requires an argument: %c\n", argv[0], c); ++ } ++ return '?'; ++ } ++ } ++ return c; ++ ++} ++#else ++ + int + os_getopt(int argc, char *const argv[], const char *optstring) + { + return getopt(argc, argv, optstring); + } + ++#endif // REPLACE_GETOPT ++ + int32_t + os_ncpus(void) + { +-- +2.48.1 +