git.iko.soy/typeable/nixpkgs
on master help sign in
cernlib: init at 2006
commit6e95e2a1613389dd0c5ec24fc046942834670ade authorDmitry Kalinkin <dmitry.kalinkin@gmail.com> dateSun 28 May 2017, 06:41 (10 years ago) parentd0f2361
4 files changed+254
pkgs/development/libraries/physics/cernlib/default.nix+63 pkgs/development/libraries/physics/cernlib/patch+186 pkgs/development/libraries/physics/cernlib/setup-hook.sh+3 pkgs/top-level/all-packages.nix+2
pkgs/development/libraries/physics/cernlib/default.nixnew file+63
@@ -0,0 +1,63 @@
1+{ stdenv, fetchurl, gfortran, gnumake, imake, makedepend, motif, xorg }:
2+
3+stdenv.mkDerivation rec {
4+ version = "2006";
5+ name = "cernlib-${version}";
6+
7+ src = fetchurl {
8+ url = "http://cernlib.web.cern.ch/cernlib/download/${version}_source/tar/${version}_src.tar.gz";
9+ sha256 = "0awla1rl96z82br7slcmg8ks1d2a7slk6dj79ywb871j2ksi3fky";
10+ };
11+
12+ buildInputs = with xorg; [ gfortran motif libX11 libXft libXt ];
13+ nativeBuildInputs = [ gnumake imake makedepend ];
14+ sourceRoot = ".";
15+
16+ patches = [ ./patch ];
17+
18+ postPatch = ''
19+ substituteInPlace 2006/src/config/site.def \
20+ --replace "# define MakeCmd gmake" "# define MakeCmd make"
21+ '';
22+
23+ configurePhase = ''
24+ export CERN=`pwd`
25+ export CERN_LEVEL=${version}
26+ export CERN_ROOT=$CERN/$CERN_LEVEL
27+ export CVSCOSRC=`pwd`/$CERN_LEVEL/src
28+ export PATH=$PATH:$CERN_ROOT/bin
29+ '';
30+
31+ buildPhase = ''
32+ cd $CERN_ROOT
33+ mkdir -p build bin lib
34+
35+ cd $CERN_ROOT/build
36+ $CVSCOSRC/config/imake_boot
37+ make bin/kuipc
38+ make scripts/Makefile
39+ pushd scripts
40+ make install.bin
41+ popd
42+ make
43+ '';
44+
45+ installPhase = ''
46+ mkdir "$out"
47+ cp -r "$CERN_ROOT/bin" "$out"
48+ cp -r "$CERN_ROOT/lib" "$out"
49+ mkdir "$out/$CERN_LEVEL"
50+ ln -s "$out/bin" "$out/$CERN_LEVEL/bin"
51+ ln -s "$out/lib" "$out/$CERN_LEVEL/lib"
52+ '';
53+
54+ setupHook = ./setup-hook.sh;
55+
56+ meta = {
57+ homepage = http://cernlib.web.cern.ch;
58+ description = "Legacy collection of libraries and modules for data analysis in high energy physics";
59+ platforms = stdenv.lib.platforms.unix;
60+ maintainers = with stdenv.lib.maintainers; [ veprbl ];
61+ license = stdenv.lib.licenses.gpl2;
62+ };
63+}
pkgs/development/libraries/physics/cernlib/patchnew file+186
@@ -0,0 +1,186 @@
1+diff --git a/2006/src/config/Imake.tmpl b/2006/src/config/Imake.tmpl
2+index 054fb04..a3b3828 100644
3+--- a/2006/src/config/Imake.tmpl
4++++ b/2006/src/config/Imake.tmpl
5+@@ -455,7 +455,7 @@ XCOMM the platform-specific parameters - edit site.def to change
6+ #define NoRConst NO /* YES if const for structs of funcs is bad */
7+ #endif
8+ #ifndef InstPgmFlags
9+-#define InstPgmFlags -s
10++#define InstPgmFlags
11+ #endif
12+ #ifndef InstBinFlags
13+ #define InstBinFlags -m 0755
14+diff --git a/2006/src/config/biglib.rules b/2006/src/config/biglib.rules
15+index c90e58a..9173bdc 100644
16+--- a/2006/src/config/biglib.rules
17++++ b/2006/src/config/biglib.rules
18+@@ -368,7 +368,7 @@ define build-object-list @@\
19+ @ (set -e;\ @@\
20+ case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\
21+ subdirs=Quote(dirs);\ @@\
22+- list=`/bin/pwd`/$@;\ @@\
23++ list=`pwd`/$@;\ @@\
24+ for dir in $$subdirs; do \ @@\
25+ (set -e;cd $$dir;SedCmd -e "\=^[^/]=s=^.=$$dir/&=" $@ >> $$list);\@@\
26+ done) || (rm $@; exit 1) @@\
27+diff --git a/2006/src/config/imake_boot b/2006/src/config/imake_boot
28+index b52d0d3..69cf1b3 100755
29+--- a/2006/src/config/imake_boot
30++++ b/2006/src/config/imake_boot
31+@@ -10,8 +10,8 @@ if [ "$CVSCOSRC" = "" ] ; then
32+ fi
33+ if [ -f Imakefile ] ; then
34+ imake -DUseInstalled -I$CVSCOSRC/config \
35+- -DTOPDIR=`/bin/pwd` -DCURDIR= -fImakefile
36++ -DTOPDIR=`pwd` -DCURDIR= -fImakefile
37+ else
38+ imake -DUseInstalled -I$CVSCOSRC/config \
39+- -DTOPDIR=`/bin/pwd` -DCURDIR= -f$CVSCOSRC/Imakefile
40++ -DTOPDIR=`pwd` -DCURDIR= -f$CVSCOSRC/Imakefile
41+ fi
42+diff --git a/2006/src/config/linux-lp64.cf b/2006/src/config/linux-lp64.cf
43+index e071b2f..3cc5c3b 100644
44+--- a/2006/src/config/linux-lp64.cf
45++++ b/2006/src/config/linux-lp64.cf
46+@@ -173,7 +173,7 @@
47+ #define FortranCmd g77
48+ #define XargsCmd xargs
49+ #define FortranSaveFlags /* */ /* Everything static !? */
50+-#define DefaultFCOptions -fno-automatic -fno-second-underscore -fugly-complex
51++#define DefaultFCOptions -fno-automatic -fno-second-underscore
52+ #define CernlibSystem -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_QMLXIA64
53+
54+ # endif
55+diff --git a/2006/src/config/linux.cf b/2006/src/config/linux.cf
56+index cc0bee5..a8dd954 100644
57+--- a/2006/src/config/linux.cf
58++++ b/2006/src/config/linux.cf
59+@@ -258,7 +258,7 @@ endif @@\
60+ #define FortranCmd g77
61+ #define XargsCmd xargs
62+ #define FortranSaveFlags /* */ /* Everything static !? */
63+-#define DefaultFCOptions -fno-automatic -fno-second-underscore -fugly-complex
64++#define DefaultFCOptions -fno-automatic -fno-second-underscore
65+ #define CernlibSystem -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
66+
67+ # endif
68+diff --git a/2006/src/packlib/kuip/code_kuip/kkern.c b/2006/src/packlib/kuip/code_kuip/kkern.c
69+index 3a5579f..5f3c352 100644
70+--- a/2006/src/packlib/kuip/code_kuip/kkern.c
71++++ b/2006/src/packlib/kuip/code_kuip/kkern.c
72+@@ -543,24 +543,6 @@ char *str0dup( const char *str )
73+
74+
75+ /*
76+- * like strdup() but string is n characters long and not terminated
77+- */
78+-char *strndup( const char *str,
79+- size_t len )
80+-{
81+- size_t bytes = len + 1;
82+- char *p;
83+-
84+- if( bytes < ALLOC_MIN_BYTES )
85+- bytes = ALLOC_MIN_BYTES;
86+-
87+- p = strncpy( malloc( bytes ), str, len );
88+- p[len] = '\0';
89+- return p;
90+-}
91+-
92+-
93+-/*
94+ * strdup() of character representation of integer n
95+ */
96+ char *stridup( int n )
97+diff --git a/2006/src/packlib/kuip/code_kuip/kmenu.c b/2006/src/packlib/kuip/code_kuip/kmenu.c
98+index f135b07..23007a8 100644
99+--- a/2006/src/packlib/kuip/code_kuip/kmenu.c
100++++ b/2006/src/packlib/kuip/code_kuip/kmenu.c
101+@@ -1404,7 +1404,7 @@ void interactive_find( char *expr, int keym )
102+ printf ("See also:\n ");
103+ for (i = 0; i < nval; i++) {
104+ if (i == ncmd) continue;
105+- printf (flis_name[i]);
106++ printf ("%s", flis_name[i]);
107+ if (i < nval-1)
108+ printf (", ");
109+ else
110+diff --git a/2006/src/packlib/kuip/kuip/kstring.h b/2006/src/packlib/kuip/kuip/kstring.h
111+index 7811f15..12a1344 100644
112+--- a/2006/src/packlib/kuip/kuip/kstring.h
113++++ b/2006/src/packlib/kuip/kuip/kstring.h
114+@@ -21,7 +21,6 @@ extern "C" {
115+ */
116+
117+ #ifndef WIN32
118+-extern void* memmove( void* dst, const void* src, size_t n );
119+ #endif
120+
121+ /* GF. make conform to kkern.c#if !defined(__convexc__)*/
122+@@ -46,7 +45,6 @@ extern char* str4dup( const char* str1, const char* str2, const char* str3,
123+ const char* str4 );
124+ extern char* str5dup( const char* str1, const char* str2, const char* str3,
125+ const char* str4, const char* str5 );
126+-extern char* strndup( const char* buf, size_t n );
127+ extern char* stridup( int i );
128+
129+ extern char* mstrcat( char* ptr, const char* str );
130+diff --git a/2006/src/pawlib/paw/cpaw/bugrep.c b/2006/src/pawlib/paw/cpaw/bugrep.c
131+index d503a45..d26e30f 100644
132+--- a/2006/src/pawlib/paw/cpaw/bugrep.c
133++++ b/2006/src/pawlib/paw/cpaw/bugrep.c
134+@@ -432,51 +432,7 @@ br_add_config( char * tmp_file )
135+
136+ static int
137+ br_mail_file( char *addr, char *subj, char *file )
138+-#if (defined(CERNLIB_UNIX))&&(!defined(CERNLIB_WINNT))&&(!defined(CERNLIB_MACOSX))
139+-{
140+- FILE *mfp, *fp;
141+- char line[1024], my_addr[L_cuserid];
142+- time_t clock;
143+- struct tm *ts;
144+-
145+- fp = fopen( file, "r" );
146+- if ( fp == NULL ) {
147+- printf( "BUGREPORT: cannot (re)open temporary file\n" );
148+- return MAIL_ERROR;
149+- }
150+-
151+- cuserid( my_addr );
152+-
153+- sprintf( line, "/usr/lib/sendmail -t" );
154+- mfp = popen( line, "w" );
155+-
156+- if ( mfp == NULL ) {
157+- printf( "BUGREPORT: cannot run sendmail\n" );
158+- return MAIL_ERROR;
159+- }
160+-
161+-
162+- clock = time( (time_t *) 0 );
163+- ts = localtime( &clock );
164+- strftime( line, sizeof( line ),
165+- "%a, %d %h %y %H:%M:%S", ts );
166+- fprintf ( mfp, "To: %s\n", addr );
167+- fprintf ( mfp, "Bcc: %s\n", my_addr );
168+- fprintf ( mfp, "Date: %s\n", line );
169+- fprintf ( mfp, "Subject: %s\n", subj );
170+- fprintf ( mfp, "\n" );
171+-
172+- while( fgets( line, sizeof( line ), fp ) != NULL ) {
173+- fputs( line, mfp );
174+- }
175+- fclose( fp );
176+-
177+- pclose( mfp );
178+-
179+- return MAIL_OK;
180+-}
181+-#endif
182+-#if defined(CERNLIB_MACOSX)
183++#if (defined(CERNLIB_UNIX))&&(!defined(CERNLIB_WINNT))
184+ {
185+ FILE *mfp, *fp;
186+ char line[1024], *my_addr;
pkgs/development/libraries/physics/cernlib/setup-hook.shnew file+3
@@ -0,0 +1,3 @@
1+export CERN_LEVEL=@version@
2+export CERN=@out@
3+export CERN_ROOT=$CERN/$CERN_LEVEL
pkgs/top-level/all-packages.nix+2
@@ -18107,6 +18107,8 @@ with pkgs;
1810718107 motif = null; # motif or lesstif
1810818108 };
1810918109
18110+ cernlib = callPackage ../development/libraries/physics/cernlib { };
18111+
1811018112 g4py = callPackage ../development/libraries/physics/geant4/g4py { };
1811118113
1811218114 hepmc = callPackage ../development/libraries/physics/hepmc { };