gildas: 20230801_a -> 20240401_a; fix build on darwin (#304813)

- Use GNU's cpp instead of Apple's (see #304528)

- Use clang and clang++ on darwin-aarch64

- Update from 20230801_a -> 20240401_a

Closes #304516
This commit is contained in:
Sébastien Maret 2024-04-27 13:56:58 +02:00 committed by GitHub
parent 92fa114574
commit ef401a3702
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 94 additions and 31 deletions

View File

@ -1,12 +0,0 @@
diff -ruN gildas-src-jul18a/admin/define-system.sh gildas-src-jul18a.aarch64/admin/define-system.sh
--- gildas-src-jul18a/admin/define-system.sh 2018-06-12 15:22:32.000000000 +0200
+++ gildas-src-jul18a.aarch64/admin/define-system.sh 2018-07-21 13:05:52.000000000 +0200
@@ -174,7 +174,7 @@
DEFAULT_CONFIG= # Default config is empty
case `uname` in
Linux)
- if [ `uname -m | grep -c "x86_64"` -ne 0 ]; then
+ if [ `uname -m | grep -c "64"` -ne 0 ]; then
GAG_MACHINE=x86_64
else
GAG_MACHINE=pc

View File

@ -1,22 +1,77 @@
diff -ruN gildas-src-jun18a/admin/define-system.sh gildas-src-jun18a.clang/admin/define-system.sh
--- gildas-src-jun18a/admin/define-system.sh 2018-03-12 11:07:57.000000000 +0100
+++ gildas-src-jun18a.clang/admin/define-system.sh 2018-06-12 14:56:14.000000000 +0200
@@ -218,13 +218,13 @@
diff --git a/admin/Makefile.def b/admin/Makefile.def
index 932d18f102..309114e339 100644
--- a/admin/Makefile.def
+++ b/admin/Makefile.def
@@ -310,7 +310,7 @@ endif
# Apple CLANG flags (identical to GCC)
ifeq ($(GAG_COMPILER_CKIND),clang)
- GLOBAL_CFLAGS += -pipe -fPIC
+ GLOBAL_CFLAGS += -fPIC
ifeq ($(RELEASE_MODE),no)
OPTION_CFLAGS += -Wall
endif
@@ -360,7 +360,7 @@ endif
# GFORTRAN flags
ifeq ($(GAG_COMPILER_FKIND),gfortran)
- GLOBAL_FFLAGS += -J$(moddir) -pipe -fno-backslash -fno-range-check
+ GLOBAL_FFLAGS += -J$(moddir) -fno-backslash -fno-range-check
ifeq ($(GAG_USE_SANITIZE),yes)
GLOBAL_FFLAGS += -fsanitize=address -fsanitize=null
# Can not be used with our memory(ip):
diff --git a/admin/define-system.sh b/admin/define-system.sh
index b6eda9fdfd..704050a9ac 100644
--- a/admin/define-system.sh
+++ b/admin/define-system.sh
@@ -272,34 +272,23 @@ EOF
else
GAG_MACHINE=pc
fi
- if which gcc > /dev/null 2>&1; then
- DEFAULT_CCOMPILER=gcc
+ if which clang > /dev/null 2>&1; then
+ DEFAULT_CCOMPILER=clang
fi
- fi
- if which g++ > /dev/null 2>&1; then
- DEFAULT_CXXCOMPILER=g++
- elif which clang++ > /dev/null 2>&1; then
+ if which clang++ > /dev/null 2>&1; then
DEFAULT_CXXCOMPILER=clang++
+ elif which g++ > /dev/null 2>&1; then
+ DEFAULT_CXXCOMPILER=g++
fi
if which ifort > /dev/null 2>&1; then
DEFAULT_FCOMPILER=ifort
- DEFAULT_CXXCOMPILER=clang++
- fi
- if which ifort > /dev/null 2>&1; then
- DEFAULT_FCOMPILER=ifort
- elif which gfortran > /dev/null 2>&1; then
- DEFAULT_FCOMPILER=gfortran
- fi
- elif [ `uname -p` = "arm" ]; then
+ elif [ `uname -p` = "arm" ]; then
GAG_MACHINE=arm64
- if which gcc > /dev/null 2>&1; then
- DEFAULT_CCOMPILER=gcc
- fi
- if which clang++ > /dev/null 2>&1; then
- DEFAULT_CXXCOMPILER=clang++
- elif which g++ > /dev/null 2>&1; then
- DEFAULT_CXXCOMPILER=g++
- fi
- if which ifort > /dev/null 2>&1; then
- DEFAULT_FCOMPILER=ifort
- elif which gfortran > /dev/null 2>&1; then
- DEFAULT_FCOMPILER=gfortran
- fi
+ fi
+ if which clang > /dev/null 2>&1; then
+ DEFAULT_CCOMPILER=clang
+ elif which gcc > /dev/null 2>&1; then
+ DEFAULT_CCOMPILER=gcc
+ fi
+ if which clang++ > /dev/null 2>&1; then
+ DEFAULT_CXXCOMPILER=clang++
+ elif which g++ > /dev/null 2>&1; then
+ DEFAULT_CXXCOMPILER=g++
+ fi
+ if which ifort > /dev/null 2>&1; then
+ DEFAULT_FCOMPILER=ifort
+ elif which gfortran > /dev/null 2>&1; then
+ DEFAULT_FCOMPILER=gfortran
fi ;;
CYGWIN*)
if [ `uname -m | grep -c "x86_64"` -ne 0 ]; then

View File

@ -0,0 +1,17 @@
diff --git a/admin/Makefile.def b/admin/Makefile.def
index 0395d9d4f0..932d18f102 100644
--- a/admin/Makefile.def
+++ b/admin/Makefile.def
@@ -228,7 +228,11 @@ GLOBAL_DIRTY = $(builddir) *~ TAGS ChangeLog* Makefile.bak
# Fortran preprocessing
# Preprocessor command
-CPP = cpp
+ifdef GAG_CPP
+ CPP = $(GAG_CPP)
+else
+ CPP = cpp
+endif
# Preprocessor generic flags
GLOBAL_CPPFLAGS += -P -traditional -C

View File

@ -7,8 +7,8 @@ let
in
stdenv.mkDerivation rec {
srcVersion = "aug23a";
version = "20230801_a";
srcVersion = "apr24a";
version = "20240401_a";
pname = "gildas";
src = fetchurl {
@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
# source code of the previous release to a different directory
urls = [ "http://www.iram.fr/~gildas/dist/gildas-src-${srcVersion}.tar.xz"
"http://www.iram.fr/~gildas/dist/archive/gildas/gildas-src-${srcVersion}.tar.xz" ];
sha256 = "sha256-jlyv2K1V+510C4uLek4oofm13d40nGJ46wqjW+tjfq4=";
sha256 = "sha256-Eq6S5S8xrhkCo6O2wUaHnoMDVG9WeiSurGvOc+2JKbM=";
};
nativeBuildInputs = [ pkg-config groff perl getopt gfortran which ];
@ -24,10 +24,14 @@ stdenv.mkDerivation rec {
buildInputs = [ gtk2-x11 lesstif cfitsio python3Env ncurses ]
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ CoreFoundation ]);
patches = [ ./wrapper.patch ./clang.patch ./aarch64.patch ];
patches = [ ./wrapper.patch ]
++ lib.optionals stdenv.isDarwin ([ ./clang.patch ./cpp-darwin.patch ]);
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument";
# Workaround for https://github.com/NixOS/nixpkgs/issues/304528
env.GAG_CPP = lib.optionalString stdenv.isDarwin "${gfortran.outPath}/bin/cpp";
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin (with darwin.apple_sdk.frameworks; "-F${CoreFoundation}/Library/Frameworks");
configurePhase=''
@ -66,7 +70,6 @@ stdenv.mkDerivation rec {
license = lib.licenses.free;
maintainers = [ lib.maintainers.bzizou lib.maintainers.smaret ];
platforms = lib.platforms.all;
broken = stdenv.isDarwin && stdenv.isAarch64;
};
}