summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2024-08-22 14:59:34 -0400
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2024-09-02 15:19:17 -0400
commitac846c8540fa9e331857dc49184cb0c9a4add67b (patch)
treef927d57a5587db9a4a67f3cd708b64ef042bfd71
parentMerge pull request #266892 from vhsconnect/init-themedtabs.nvim (diff)
downloadnixpkgs-origin/pr/cern_2024.tar.gz
cernlib: 2006 -> 2024.06.12.0origin/pr/cern_2024
-rw-r--r--pkgs/development/libraries/physics/cernlib/0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch94
-rw-r--r--pkgs/development/libraries/physics/cernlib/default.nix126
-rw-r--r--pkgs/development/libraries/physics/cernlib/patch.patch186
-rw-r--r--pkgs/development/libraries/physics/cernlib/setup-hook.sh2
4 files changed, 50 insertions, 358 deletions
diff --git a/pkgs/development/libraries/physics/cernlib/0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch b/pkgs/development/libraries/physics/cernlib/0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch
deleted file mode 100644
index bc8c77f913c6..000000000000
--- a/pkgs/development/libraries/physics/cernlib/0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From a69607c511b6da94cde477283b129cbc9cfdd5a3 Mon Sep 17 00:00:00 2001
-From: Maximilian Bosch <maximilian@mbosch.me>
-Date: Tue, 11 Aug 2020 12:32:06 +0200
-Subject: [PATCH] Use `strerror` rather than `sys_errlist` to fix compilation
- w/glibc-2.32
-
-To quote the release-notes[1]:
-
- All programs should use
- strerror or strerror_r instead.
-
-[1] https://sourceware.org/pipermail/libc-announce/2020/000029.html
----
- 2006/src/packlib/cspack/sysreq/serror.c | 10 +---------
- 2006/src/packlib/cspack/sysreq/socket.c | 2 +-
- 2006/src/packlib/kernlib/kernbit/z268/systems.c | 4 ++--
- 2006/src/pawlib/paw/piafs/piafc.c | 5 +----
- 4 files changed, 5 insertions(+), 16 deletions(-)
-
-diff --git a/2006/src/packlib/cspack/sysreq/serror.c b/2006/src/packlib/cspack/sysreq/serror.c
-index 3667c42a..c560e499 100644
---- a/2006/src/packlib/cspack/sysreq/serror.c
-+++ b/2006/src/packlib/cspack/sysreq/serror.c
-@@ -176,15 +176,7 @@ int n;
- }
- else {
- #if !defined(vms)
-- if ((n>0) && (n<sys_nerr)) {
-- return(sys_errlist[n]);
-- }
-- else {
-- (void) sprintf(buf,"%s: %d\n",
-- sys_serrlist[SEMAXERR+1-SEBASEOFF],
-- n);
-- return(buf);
-- }
-+ return strerror(n);
- #else /* vms */
- /*
- * There are (were) some bugs is DEC C compilers (/OPT), just check
-diff --git a/2006/src/packlib/cspack/sysreq/socket.c b/2006/src/packlib/cspack/sysreq/socket.c
-index ceb5bd63..34c2a7bc 100644
---- a/2006/src/packlib/cspack/sysreq/socket.c
-+++ b/2006/src/packlib/cspack/sysreq/socket.c
-@@ -412,7 +412,7 @@ char *
- s_errmsg() /* return last error message */
- {
- #if !defined(vms)
-- return(sys_errlist[errno]);
-+ return(strerror(errno));
- #else /* vms */
- #if defined(MULTINET) && (MULTINET == 1)
- return(vms_errno_string());
-diff --git a/2006/src/packlib/kernlib/kernbit/z268/systems.c b/2006/src/packlib/kernlib/kernbit/z268/systems.c
-index 98459459..d1ad63ed 100644
---- a/2006/src/packlib/kernlib/kernbit/z268/systems.c
-+++ b/2006/src/packlib/kernlib/kernbit/z268/systems.c
-@@ -134,7 +134,7 @@ int *ovflw;
- #endif /* hpux */
-
- if ( (ps=(FILE *)popen(command,"r"))==NULL ) {
-- fprintf(stderr,"systems(): popen(): %s\n",sys_errlist[errno] );
-+ fprintf(stderr,"systems(): popen(): %s\n",strerror(errno) );
- *rc= -errno;
- *chars=0 ;
- *l=0 ;
-@@ -144,7 +144,7 @@ int *ovflw;
- rcode = fread(buf, 1, buflen , ps );
- if ( rcode < 0 ) {
- fprintf(stderr,"systems(): pipe fread(): %s\n",
-- sys_errlist[errno] );
-+ strerror(errno) );
- buf[0]='\n';
- *rc= -errno;
- *chars=0 ;
-diff --git a/2006/src/pawlib/paw/piafs/piafc.c b/2006/src/pawlib/paw/piafs/piafc.c
-index b163f80c..4d8d5528 100644
---- a/2006/src/pawlib/paw/piafs/piafc.c
-+++ b/2006/src/pawlib/paw/piafs/piafc.c
-@@ -1795,10 +1795,7 @@ static void fatalperror(char *msg)
- extern char *sys_errlist[];
- #endif
-
-- if ((unsigned) errno < sys_nerr)
-- sprintf(buf, "%s: %s", msg, sys_errlist[errno]);
-- else
-- sprintf(buf, "%s: Error %d", msg, errno);
-+ sprintf(buf, "%s: %s", msg, strerror(errno));
-
- fatal(buf);
- }
---
-2.25.4
-
diff --git a/pkgs/development/libraries/physics/cernlib/default.nix b/pkgs/development/libraries/physics/cernlib/default.nix
index b589524113d2..e4a2f2435b97 100644
--- a/pkgs/development/libraries/physics/cernlib/default.nix
+++ b/pkgs/development/libraries/physics/cernlib/default.nix
@@ -1,102 +1,74 @@
-{ lib, stdenv, fetchurl, gfortran, imake, makedepend, motif, xorg, libxcrypt }:
+{
+ lib,
+ stdenv,
+ fetchpatch,
+ fetchurl,
+ cmake,
+ freetype,
+ gfortran,
+ gnused,
+ openssl,
+ libnsl,
+ motif,
+ xorg,
+ libxcrypt,
+}:
stdenv.mkDerivation rec {
- version = "2006";
+ version = "2024.06.12.0";
pname = "cernlib";
+ year = lib.versions.major version;
src = fetchurl {
urls = [
- "https://ftp.riken.jp/cernlib/download/${version}_source/tar/${version}_src.tar.gz"
- "https://cernlib.web.cern.ch/cernlib/download/${version}_source/tar/${version}_src.tar.gz"
+ "https://ftp.riken.jp/cernlib/download/${year}_source/tar/cernlib-cernlib-${version}-free.tar.gz"
+ "https://cernlib.web.cern.ch/download/${year}_source/tar/cernlib-cernlib-${version}-free.tar.gz"
];
- sha256 = "0awla1rl96z82br7slcmg8ks1d2a7slk6dj79ywb871j2ksi3fky";
+ hash = "sha256-SEFgQjPBkmRoaMD/7yXiXO9DZNrRhqZ01kptSDQur84=";
};
- buildInputs = with xorg; [ gfortran motif libX11 libXft libXt libxcrypt ];
- nativeBuildInputs = [ imake makedepend ];
- sourceRoot = ".";
-
- patches = [ ./patch.patch ./0001-Use-strerror-rather-than-sys_errlist-to-fix-compilat.patch ];
+ patches = [
+ (fetchpatch {
+ url = "https://github.com/user-attachments/files/16832928/geant321-fix-weak-alias-on-darwin.patch";
+ hash = "sha256-YzaUh4rJBszGdp5s/HDQMI5qQhCGrTt9P6XCgZOFn1I=";
+ })
+ ];
postPatch = ''
- echo 'InstallBinSubdirs(packlib scripts)' >> 2006/src/Imakefile
- substituteInPlace 2006/src/config/site.def \
- --replace "# define MakeCmd gmake" "# define MakeCmd make"
- substituteInPlace 2006/src/config/lnxLib.rules \
- --replace "# lib" "// lib"
-
- substituteInPlace 2006/src/config/linux.cf \
- --replace "# ifdef Hasgfortran" "# if 1" \
- --replace "# define CcCmd gcc4" "# define CcCmd gcc"
- substituteInPlace 2006/src/scripts/cernlib \
- --replace "-lnsl" ""
-
- # binutils 2.37 fix
- substituteInPlace 2006/src/config/Imake.tmpl --replace "clq" "cq"
+ substituteInPlace CMakeLists.txt \
+ --replace-fail "find_program ( SED NAMES gsed" "find_program ( SED NAMES sed"
'';
+ # gfortran warning's on iframework messes with CMake's check_fortran_compiler_flag
+ # see also https://github.com/NixOS/nixpkgs/issues/27218
preConfigure = ''
- export CERN=`pwd`
- export CERN_LEVEL=${version}
- export CERN_ROOT=$CERN/$CERN_LEVEL
- export CVSCOSRC=`pwd`/$CERN_LEVEL/src
- export PATH=$PATH:$CERN_ROOT/bin
+ export NIX_CFLAGS_COMPILE="$(echo $NIX_CFLAGS_COMPILE | sed 's|-iframework [^ ]*||g')"
'';
- FFLAGS = lib.optionals (lib.versionAtLeast gfortran.version "10.0.0") [
- # Fix https://github.com/vmc-project/geant3/issues/17
- "-fallow-invalid-boz"
-
- # Fix for gfortran 10
- "-fallow-argument-mismatch"
- ];
-
- NIX_CFLAGS = [ "-Wno-return-type" ];
-
- # Workaround build failure on -fno-common toolchains:
- # ld: libpacklib.a(kedit.o):kuip/klink1.h:11: multiple definition of `klnkaddr';
- # libzftplib.a(zftpcdf.o):zftp/zftpcdf.c:155: first defined here
- env.NIX_CFLAGS_COMPILE = "-fcommon";
-
- makeFlags = [
- "FORTRANOPTIONS=$(FFLAGS)"
- "CCOPTIONS=$(NIX_CFLAGS)"
- ];
-
- configurePhase = ''
- runHook preConfigure
-
- cd $CERN_ROOT
- mkdir -p build
- cd $CERN_ROOT/build
- $CVSCOSRC/config/imake_boot
-
- runHook postConfigure
- '';
-
- preBuild = ''
- make -j $NIX_BUILD_CORES $makeFlags bin/kuipc
- make -j $NIX_BUILD_CORES $makeFlags scripts/Makefile
- pushd scripts
- make -j $NIX_BUILD_CORES $makeFlags bin/cernlib
- popd
- '';
-
- installTargets = [ "install.bin" "install.lib" "install.include" ];
- installFlags = [
- "CERN_BINDIR=${placeholder "out"}/bin"
- "CERN_INCLUDEDIR=${placeholder "out"}/include"
- "CERN_LIBDIR=${placeholder "out"}/lib"
- "CERN_SHLIBDIR=${placeholder "out"}/libexec"
- ];
+ nativeBuildInputs = [ cmake ];
+ buildInputs = with xorg; [
+ freetype
+ gfortran
+ openssl
+ libX11
+ libXaw
+ libXft
+ libXt
+ libxcrypt
+ motif
+ ] ++ lib.optional stdenv.isLinux libnsl;
setupHook = ./setup-hook.sh;
meta = {
homepage = "http://cernlib.web.cern.ch";
description = "Legacy collection of libraries and modules for data analysis in high energy physics";
- broken = stdenv.isDarwin;
- platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
+ platforms = [
+ "aarch64-linux"
+ "i686-linux"
+ "x86_64-linux"
+ "x86_64-darwin"
+ ];
maintainers = with lib.maintainers; [ veprbl ];
license = lib.licenses.gpl2;
};
diff --git a/pkgs/development/libraries/physics/cernlib/patch.patch b/pkgs/development/libraries/physics/cernlib/patch.patch
deleted file mode 100644
index 2d75b6bf0f88..000000000000
--- a/pkgs/development/libraries/physics/cernlib/patch.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-diff --git a/2006/src/config/Imake.tmpl b/2006/src/config/Imake.tmpl
-index 054fb04..a3b3828 100644
---- a/2006/src/config/Imake.tmpl
-+++ b/2006/src/config/Imake.tmpl
-@@ -455,7 +455,7 @@ XCOMM the platform-specific parameters - edit site.def to change
- #define NoRConst NO /* YES if const for structs of funcs is bad */
- #endif
- #ifndef InstPgmFlags
--#define InstPgmFlags -s
-+#define InstPgmFlags
- #endif
- #ifndef InstBinFlags
- #define InstBinFlags -m 0755
-diff --git a/2006/src/config/biglib.rules b/2006/src/config/biglib.rules
-index c90e58a..9173bdc 100644
---- a/2006/src/config/biglib.rules
-+++ b/2006/src/config/biglib.rules
-@@ -368,7 +368,7 @@ define build-object-list @@\
- @ (set -e;\ @@\
- case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\
- subdirs=Quote(dirs);\ @@\
-- list=`/bin/pwd`/$@;\ @@\
-+ list=`pwd`/$@;\ @@\
- for dir in $$subdirs; do \ @@\
- (set -e;cd $$dir;SedCmd -e "\=^[^/]=s=^.=$$dir/&=" $@ >> $$list);\@@\
- done) || (rm $@; exit 1) @@\
-diff --git a/2006/src/config/imake_boot b/2006/src/config/imake_boot
-index b52d0d3..69cf1b3 100755
---- a/2006/src/config/imake_boot
-+++ b/2006/src/config/imake_boot
-@@ -10,8 +10,8 @@ if [ "$CVSCOSRC" = "" ] ; then
- fi
- if [ -f Imakefile ] ; then
- imake -DUseInstalled -I$CVSCOSRC/config \
-- -DTOPDIR=`/bin/pwd` -DCURDIR= -fImakefile
-+ -DTOPDIR=`pwd` -DCURDIR= -fImakefile
- else
- imake -DUseInstalled -I$CVSCOSRC/config \
-- -DTOPDIR=`/bin/pwd` -DCURDIR= -f$CVSCOSRC/Imakefile
-+ -DTOPDIR=`pwd` -DCURDIR= -f$CVSCOSRC/Imakefile
- fi
-diff --git a/2006/src/config/linux-lp64.cf b/2006/src/config/linux-lp64.cf
-index e071b2f..3cc5c3b 100644
---- a/2006/src/config/linux-lp64.cf
-+++ b/2006/src/config/linux-lp64.cf
-@@ -173,7 +173,7 @@
- #define FortranCmd g77
- #define XargsCmd xargs
- #define FortranSaveFlags /* */ /* Everything static !? */
--#define DefaultFCOptions -fno-automatic -fno-second-underscore -fugly-complex
-+#define DefaultFCOptions -fno-automatic -fno-second-underscore
- #define CernlibSystem -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_QMLXIA64
-
- # endif
-diff --git a/2006/src/config/linux.cf b/2006/src/config/linux.cf
-index cc0bee5..a8dd954 100644
---- a/2006/src/config/linux.cf
-+++ b/2006/src/config/linux.cf
-@@ -258,7 +258,7 @@ endif @@\
- #define FortranCmd g77
- #define XargsCmd xargs
- #define FortranSaveFlags /* */ /* Everything static !? */
--#define DefaultFCOptions -fno-automatic -fno-second-underscore -fugly-complex
-+#define DefaultFCOptions -fno-automatic -fno-second-underscore
- #define CernlibSystem -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
-
- # endif
-diff --git a/2006/src/packlib/kuip/code_kuip/kkern.c b/2006/src/packlib/kuip/code_kuip/kkern.c
-index 3a5579f..5f3c352 100644
---- a/2006/src/packlib/kuip/code_kuip/kkern.c
-+++ b/2006/src/packlib/kuip/code_kuip/kkern.c
-@@ -543,24 +543,6 @@ char *str0dup( const char *str )
-
-
- /*
-- * like strdup() but string is n characters long and not terminated
-- */
--char *strndup( const char *str,
-- size_t len )
--{
-- size_t bytes = len + 1;
-- char *p;
--
-- if( bytes < ALLOC_MIN_BYTES )
-- bytes = ALLOC_MIN_BYTES;
--
-- p = strncpy( malloc( bytes ), str, len );
-- p[len] = '\0';
-- return p;
--}
--
--
--/*
- * strdup() of character representation of integer n
- */
- char *stridup( int n )
-diff --git a/2006/src/packlib/kuip/code_kuip/kmenu.c b/2006/src/packlib/kuip/code_kuip/kmenu.c
-index f135b07..23007a8 100644
---- a/2006/src/packlib/kuip/code_kuip/kmenu.c
-+++ b/2006/src/packlib/kuip/code_kuip/kmenu.c
-@@ -1404,7 +1404,7 @@ void interactive_find( char *expr, int keym )
- printf ("See also:\n ");
- for (i = 0; i < nval; i++) {
- if (i == ncmd) continue;
-- printf (flis_name[i]);
-+ printf ("%s", flis_name[i]);
- if (i < nval-1)
- printf (", ");
- else
-diff --git a/2006/src/packlib/kuip/kuip/kstring.h b/2006/src/packlib/kuip/kuip/kstring.h
-index 7811f15..12a1344 100644
---- a/2006/src/packlib/kuip/kuip/kstring.h
-+++ b/2006/src/packlib/kuip/kuip/kstring.h
-@@ -21,7 +21,6 @@ extern "C" {
- */
-
- #ifndef WIN32
--extern void* memmove( void* dst, const void* src, size_t n );
- #endif
-
- /* GF. make conform to kkern.c#if !defined(__convexc__)*/
-@@ -46,7 +45,6 @@ extern char* str4dup( const char* str1, const char* str2, const char* str3,
- const char* str4 );
- extern char* str5dup( const char* str1, const char* str2, const char* str3,
- const char* str4, const char* str5 );
--extern char* strndup( const char* buf, size_t n );
- extern char* stridup( int i );
-
- extern char* mstrcat( char* ptr, const char* str );
-diff --git a/2006/src/pawlib/paw/cpaw/bugrep.c b/2006/src/pawlib/paw/cpaw/bugrep.c
-index d503a45..d26e30f 100644
---- a/2006/src/pawlib/paw/cpaw/bugrep.c
-+++ b/2006/src/pawlib/paw/cpaw/bugrep.c
-@@ -432,51 +432,7 @@ br_add_config( char * tmp_file )
-
- static int
- br_mail_file( char *addr, char *subj, char *file )
--#if (defined(CERNLIB_UNIX))&&(!defined(CERNLIB_WINNT))&&(!defined(CERNLIB_MACOSX))
--{
-- FILE *mfp, *fp;
-- char line[1024], my_addr[L_cuserid];
-- time_t clock;
-- struct tm *ts;
--
-- fp = fopen( file, "r" );
-- if ( fp == NULL ) {
-- printf( "BUGREPORT: cannot (re)open temporary file\n" );
-- return MAIL_ERROR;
-- }
--
-- cuserid( my_addr );
--
-- sprintf( line, "/usr/lib/sendmail -t" );
-- mfp = popen( line, "w" );
--
-- if ( mfp == NULL ) {
-- printf( "BUGREPORT: cannot run sendmail\n" );
-- return MAIL_ERROR;
-- }
--
--
-- clock = time( (time_t *) 0 );
-- ts = localtime( &clock );
-- strftime( line, sizeof( line ),
-- "%a, %d %h %y %H:%M:%S", ts );
-- fprintf ( mfp, "To: %s\n", addr );
-- fprintf ( mfp, "Bcc: %s\n", my_addr );
-- fprintf ( mfp, "Date: %s\n", line );
-- fprintf ( mfp, "Subject: %s\n", subj );
-- fprintf ( mfp, "\n" );
--
-- while( fgets( line, sizeof( line ), fp ) != NULL ) {
-- fputs( line, mfp );
-- }
-- fclose( fp );
--
-- pclose( mfp );
--
-- return MAIL_OK;
--}
--#endif
--#if defined(CERNLIB_MACOSX)
-+#if (defined(CERNLIB_UNIX))&&(!defined(CERNLIB_WINNT))
- {
- FILE *mfp, *fp;
- char line[1024], *my_addr;
diff --git a/pkgs/development/libraries/physics/cernlib/setup-hook.sh b/pkgs/development/libraries/physics/cernlib/setup-hook.sh
index d83759327760..d48b98cfa624 100644
--- a/pkgs/development/libraries/physics/cernlib/setup-hook.sh
+++ b/pkgs/development/libraries/physics/cernlib/setup-hook.sh
@@ -1,3 +1,3 @@
export CERN_LEVEL=@version@
export CERN=@out@
-export CERN_ROOT=$CERN/$CERN_LEVEL
+export CERN_ROOT=$CERN