From 4cfa34b1e101adcd050a476307b7680db8afcd8e Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Fri, 3 Jul 2026 16:23:00 +0200 Subject: Configuration: fixed portability issues, add jq and updated GCC Summary: this commit will not affect your analysis: only the version of GCC has been updated for portability and jq (a JSON parser) has been added. Until now, several portability issues existed in Maneage, causing problems mostl on macOS, but some also some on GNU/Linux. They are listed below along with the fix. With this commit, the problems mentioned above have been fixed: - 'pkg-config' on macOS needed some manual steps for a successful installation. The cause was its improper checks on the macOS "carbon" library. So we now manually fix this check within the code to fix the problem. This was found and fixed by Martin Wiesmann. - Apple chip variants like M1 Pro, M1 Max, M1 Ultra, M2 Pro, etc could not be properly recognized as a macOS system since we expected a single word. This was solved by using pattern matching instead. Found and fixed by Martin Wiesmann. - macOS's sha512sum wraps the 128-character hex hash across two output lines (80 + 48 chars) and the command that we used to read the output would only captured the first 80 characters, so checksums never matched. The solution was to merge the lines before the check. Found and fixed by Martin Wiesmann. - When a checksum failed, the script exited with an error but left the bad '.unchecked' file on disk. On the next run, the download script saw the file already existed and skipped downloading entirely. As a result, the corrupt file was passed to the checksum check again, failing forever. The fix was to remove the file when we confirmed a bad download. Found and fixed by Martin Wiesmann. - When the server of a file returns a HTML output instead of the file we want, the download script could not detect and would assume that the download was successful. Therefore, it would always crash with a checksum error. The fix was to check the first few bytes of the output and consider it failed if we detect ' $@ +# jq (to parse JSON files on the command-line) uses the external Oniguruma +# regular expression library that has ended development in 2025-04-24, see +# https://github.com/kkos/oniguruma. If this library ('libonig') is present +# on the host, jq will build with that: causing a leaking of os environment +# into the Maneage'd environment. Fortunately, jq maintains a copy of this +# library in its own source (within its tarball) and will build it with the +# '--with-oniguruma=builtin' configuration option. +$(ibidir)/jq-$(jq-version): + tarball=jq-$(jq-version).tar.lz + $(call import-source, $(jq-url), $(jq-checksum)) + $(call gbuild, jq-$(jq-version), static, \ + --with-oniguruma=builtin, V=1) + echo "jq $(jq-version)" > $@ + # This is the LIGO lscsoft package 'metaio' [1] (to be distinguished from # some other packages with the same name). # @@ -1771,7 +1785,7 @@ $(ibidir)/imfit-$(imfit-version): \ $(ibidir)/metaio-$(metaio-version): tarball=metaio-$(metaio-version).tar.lz $(call import-source, $(metaio-url), $(metaio-checksum)) - $(call gbuild, metaio-$(metaio-version), static) + $(call gbuild, metaio-$(metaio-version), static,, V=1) echo "Lscsoft Metaio $(metaio-version)" > $@ # Minizip 1.x is actually distributed within zlib. It doesn't have its own @@ -2279,14 +2293,45 @@ $(ibidir)/vim-$(vim-version): rm -rf $$unpackdir echo "VIM $(vim-version)" > $@ -$(ibidir)/unzip-$(unzip-version): $(ibidir)/gzip-$(gzip-version) +$(ibidir)/unzip-$(unzip-version): + +# Prepare the tarball and build directory. tarball=unzip-$(unzip-version).tar.lz $(call import-source, $(unzip-url), $(unzip-checksum)) - $(call gbuild, unzip-$(unzip-version), static,, \ - -f unix/Makefile generic \ - CFLAGS="-DBIG_MEM -DMMAP",,pwd, \ - -f unix/Makefile generic \ - BINDIR=$(ibdir) MANDIR=$(idir)/man/man1 ) + +# Unpack and go into the directory. + export LDFLAGS="$$LDFLAGS -static" + cd $(ddir) + rm -fr unzip-$(unzip-version)/ + tar -xf $(tdir)/$$tarball --no-same-owner --no-same-permissions + cd unzip-$(unzip-version)/ + +# Remove reference to the old 'gmtime' function and include the +# system's 'time.h instead. + sed -i -e's|struct tm *gmtime(), *localtime();|#include |' \ + -e'/gmtime/d; /localtime/d' unix/unxcfg.h + +# The 'NO_DIR' variable causes conflicts: the unzip code has its own +# internal fallback implementation called 'NO_DIR'. The modern Linux +# system already provides a standard implementation using +# 'dirent.h'. These two systems conflict with each other. This causes +# compilation errors such as conflicting types for DIR and invalid +# use of DIR. + sed -i -e's/-DNO_DIR//g' unix/configure + sed -i -e's/#ifdef NO_DIR/#if 0/g' unix/unix.c + sed -i -e's/-DNO_DIR//g' -e's/-U_NO_DIR//g' unix/Makefile + +# Since unzip is no longer maintained, it uses an old C standard. + export CFLAGS="-std=gnu89 -fcommon" + +# Build and install + make SHELL=$(ibdir)/bash -f unix/Makefile generic + make SHELL=$(ibdir)/bash install -f unix/Makefile \ + generic BINDIR=$(ibdir) MANDIR=$(idir)/man/man1 + +# Go back to the top build directory, clean up and finalize. + cd $(ddir) + rm -rf unzip-$(unzip-version)/ echo "Unzip $(unzip-version)" > $@ $(ibidir)/zip-$(zip-version): -- cgit v1.2.1