···1818 "-DEZMINC_BUILD_MRFSEG=TRUE"
1919 "-DEZMINC_BUILD_DD=TRUE" ];
20202121- checkPhase = "ctest --output-on-failure ../tests/"; # but ctest doesn't find the tests ...
2222-2321 enableParallelBuilding = true;
24222523 meta = with stdenv.lib; {
-3
pkgs/applications/science/biology/N3/default.nix
···19192020 cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" "-DEBTKS_DIR=${EBTKS}/lib/" ];
21212222- checkPhase = "ctest --output-on-failure";
2323- # don't run the tests as they fail at least due to missing program wrappers in this phase ...
2424-2522 postFixup = ''
2623 for p in $out/bin/*; do
2724 wrapProgram $p --prefix PERL5LIB : $PERL5LIB
···269269 ## Man page and info support
270270 ##
271271272272- mkdir -p $man/nix-support $info/nix-support
273273- echo ${bintools.man or ""} >> $man/nix-support/propagated-user-env-packages
274274- echo ${bintools.info or ""} >> $info/nix-support/propagated-user-env-packages
272272+ ln -s ${bintools.man} $man
273273+ ln -s ${bintools.info} $info
275274 ''
276275277276 + ''
+2-3
pkgs/build-support/cc-wrapper/default.nix
···263263 ## Man page and info support
264264 ##
265265266266- mkdir -p $man/nix-support $info/nix-support
267267- printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages
268268- printWords ${cc.info or ""} > $info/nix-support/propagated-user-env-packages
266266+ ln -s ${cc.man} $man
267267+ ln -s ${cc.info} $info
269268 ''
270269271270 + ''
+4-3
pkgs/build-support/rust/fetchcargo.nix
···3838 fi
39394040 export CARGO_HOME=$(mktemp -d cargo-home.XXX)
4141+ CARGO_CONFIG=$(mktemp cargo-config.XXXX)
41424243 ${cargoUpdateHook}
43444445 mkdir -p $out
4545- cargo vendor $out | cargo-vendor-normalise > config
4646+ cargo vendor $out | cargo-vendor-normalise > $CARGO_CONFIG
4647 # fetchcargo used to never keep the config output by cargo vendor
4748 # and instead hardcode the config in ./fetchcargo-default-config.toml.
4849 # This broke on packages needing git dependencies, so now we keep the config.
4950 # But not to break old cargoSha256, if the previous behavior was enough,
5051 # we don't store the config.
5151- if ! cmp config ${./fetchcargo-default-config.toml} > /dev/null; then
5252- install -Dt $out/.cargo config;
5252+ if ! cmp $CARGO_CONFIG ${./fetchcargo-default-config.toml} > /dev/null; then
5353+ install -Dt $out/.cargo $CARGO_CONFIG;
5354 fi;
5455 '';
5556
···1010 local newestFile="${res[1]}"
11111212 # Update $SOURCE_DATE_EPOCH if the most recent file we found is newer.
1313- if [ "$time" -gt "$SOURCE_DATE_EPOCH" ]; then
1313+ if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then
1414 echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"
1515 export SOURCE_DATE_EPOCH="$time"
1616
···11--- a/giscanner/scannermain.py
22+++ b/giscanner/scannermain.py
33-@@ -100,6 +100,39 @@
33+@@ -101,6 +101,39 @@
44 return group
5566···88+ # Newer multiple-output-optimized stdenv has an environment variable
99+ # $outputLib which in turn specifies another variable which then is used as
1010+ # the destination for the library contents (${!outputLib}/lib).
1111-+ store_path = os.environ.get(os.environ.get("outputLib"))
1111++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
1212+ if store_path is None:
1313+ outputs = os.environ.get("outputs", "out").split()
1414+ if "lib" in outputs:
···3838+
3939+
4040 def _get_option_parser():
4141- parser = optparse.OptionParser('%prog [options] sources')
4242- parser.add_option('', "--quiet",
4343-@@ -209,6 +242,10 @@
4141+ parser = optparse.OptionParser('%prog [options] sources',
4242+ version='%prog ' + giscanner.__version__)
4343+@@ -211,6 +244,10 @@
4444 parser.add_option("", "--filelist",
4545 action="store", dest="filelist", default=[],
4646 help="file containing headers and sources to be scanned")
···5353 parser.add_option_group(group)
5454--- a/giscanner/shlibs.py
5555+++ b/giscanner/shlibs.py
5656-@@ -63,6 +63,11 @@
5757- pattern = "([^\s]*lib*%s[^A-Za-z0-9_-][^\s\(\)]*)"
5858- return re.compile(pattern % re.escape(library_name))
5656+@@ -62,6 +62,12 @@
5757+ $""" % re.escape(library_name), re.VERBOSE)
5858+59596060+def _ldd_library_nix_pattern(library_name):
6161+ nix_store_dir = re.escape('@nixStoreDir@'.rstrip('/'))
6262+ pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
6363+ return re.compile(pattern % (nix_store_dir, re.escape(library_name)))
6464+
6565-6565++
6666 # This is a what we do for non-la files. We assume that we are on an
6767 # ELF-like system where ldd exists and the soname extracted with ldd is
6868-@@ -112,7 +117,7 @@
6969- proc = subprocess.Popen(args, stdout=subprocess.PIPE)
7070- patterns = {}
7171- for library in libraries:
6868+ # a filename that can be opened with dlopen().
6969+@@ -110,17 +116,16 @@ def _resolve_non_libtool(options, binary, libraries):
7070+ if isinstance(output, bytes):
7171+ output = output.decode("utf-8", "replace")
7272+7373+- # Use absolute paths on OS X to conform to how libraries are usually
7474+- # referenced on OS X systems, and file names everywhere else.
7575+- basename = platform.system() != 'Darwin'
7676+- return resolve_from_ldd_output(libraries, output, basename=basename)
7777++ # Never strip away absolute paths in Nix
7878++ basename = False
7979++ return resolve_from_ldd_output(libraries, output, basename=basename, fallback_libpath=options.fallback_libpath)
8080+8181+8282+-def resolve_from_ldd_output(libraries, output, basename=False):
8383++def resolve_from_ldd_output(libraries, output, basename=False, fallback_libpath=""):
8484+ patterns = {}
8585+ for library in libraries:
8686+ if not os.path.isfile(library):
7287- patterns[library] = _ldd_library_pattern(library)
7388+ patterns[library] = (_ldd_library_pattern(library), _ldd_library_nix_pattern(library))
8989+ if len(patterns) == 0:
9090+ return []
74917575- shlibs = []
7676- for line in proc.stdout:
7777-@@ -122,11 +127,14 @@
7878- # possible for the name of the binary to match _ldd_library_pattern.
7979- if line == binary.args[0] + ':\n':
8080- continue
9292+@@ -129,11 +134,14 @@ def resolve_from_ldd_output(libraries, output, basename=False):
9393+ if line.endswith(':'):
9494+ continue
9595+ for word in line.split():
8196- for library, pattern in patterns.items():
8282-- m = pattern.search(line)
9797+- m = pattern.match(word)
8398+ for library, (pattern, nix_pattern) in patterns.items():
8499+ if line.find('@nixStoreDir@') != -1:
8585-+ m = nix_pattern.search(line)
100100++ m = nix_pattern.match(word)
86101+ else:
8787-+ m = pattern.search(line)
102102++ m = pattern.match(word)
88103 if m:
89104 del patterns[library]
9090-- shlibs.append(m.group(1))
9191-+ shlibs.append(os.path.join(options.fallback_libpath, m.group(1)))
105105+- shlibs.append(_sanitize_install_name(m.group()))
106106++ shlibs.append(os.path.join(fallback_libpath, _sanitize_install_name(m.group())))
92107 break
931089494- if len(patterns) > 0:
109109+ if len(patterns) > 0:
95110--- a/giscanner/utils.py
96111+++ b/giscanner/utils.py
9797-@@ -113,17 +113,11 @@
112112+@@ -116,17 +116,11 @@
98113 if dlname is None:
99114 return None
100115
···11+diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
22+index c93d20c..4d4915d 100644
33+--- a/giscanner/shlibs.py
44++++ b/giscanner/shlibs.py
55+@@ -43,6 +43,22 @@ def _resolve_libtool(options, binary, libraries):
66+77+ return shlibs
88+99++def _sanitize_install_name(install_name):
1010++ '''
1111++ On macOS, the dylib can be built with install_name as @rpath/libfoo.so
1212++ instead of the absolute path to the library, so handle that. The name
1313++ can also be @loader_path or @executable_path.
1414++ '''
1515++ if not install_name.startswith('@'):
1616++ return install_name
1717++ if install_name.startswith('@rpath/'):
1818++ return install_name[7:]
1919++ if install_name.startswith('@loader_path/'):
2020++ return install_name[13:]
2121++ if install_name.startswith('@executable_path/'):
2222++ return install_name[17:]
2323++ raise RuntimeError('Unknown install_name {!r}'.format(install_name))
2424++
2525+2626+ # Assume ldd output is something vaguely like
2727+ #
2828+@@ -136,7 +152,7 @@ def resolve_from_ldd_output(libraries, output, basename=False):
2929+ m = pattern.match(word)
3030+ if m:
3131+ del patterns[library]
3232+- shlibs.append(m.group())
3333++ shlibs.append(_sanitize_install_name(m.group()))
3434+ break
3535+3636+ if len(patterns) > 0:
···3131 "-DNLOPT_LIBRARY=${nlopt}/lib/libnlopt_cxx.so" "-DPAGMO_WITH_IPOPT=yes"
3232 "-DCMAKE_CXX_FLAGS='-fuse-ld=gold'" ];
33333434- checkPhase = ''
3535- ctest
3636- '';
3737-3834 # All but one test pass skip for now (tests also take about 30 min to compile)
3935 doCheck = false;
4036
···16161717 cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" ];
18181919- checkPhase = "ctest --output-on-failure"; # but cmake doesn't run the tests ...
2020-2119 meta = with stdenv.lib; {
2220 homepage = "https://github.com/BIC-MNI/${pname}";
2321 description = "Library for working with MINC files";
···2727 )
2828 '';
29293030- checkPhase = ''
3030+ preCheck = ''
3131 # make sure the test starts even if we have less than 4 cores
3232 export OMPI_MCA_rmaps_base_oversubscribe=1
3333···3535 export OMP_NUM_THREADS=1
36363737 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/lib
3838- export CTEST_OUTPUT_ON_FAILURE=1
3939-4040- make test
4138 '';
42394340 meta = with stdenv.lib; {
···25252626 # Create symlinks lacking a ".py" suffix, many programs depend on these names
2727 postFixup = ''
2828- (cd $out/bin && for f in *.py; do
2929- ln -s $f $(echo $f | sed -e 's/\.py$//')
3030- done)
2828+ for f in $out/bin/*.py; do
2929+ ln -s $(basename $f) $out/bin/$(basename $f .py)
3030+ done
3131 '';
32323333 meta = {
···6060 ++ optional (libpaper != null) "--enable-libpaper"
6161 ++ optional stdenv.isDarwin "--disable-launchd";
62626363+ # AR has to be an absolute path
6364 preConfigure = ''
6565+ export AR="${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
6466 configureFlagsArray+=(
6567 # Put just lib/* and locale into $lib; this didn't work directly.
6668 # lib/cups is moved back to $out in postInstall.
···7070 # Remove static libraries in case dynamic are available.
7171 for i in $out/lib/*.a; do
7272 name="$(basename "$i")"
7373- if [ -e "$lib/lib/''${name%.a}.so" ] || [ -e "''${i%.a}.so" ]; then
7373+ ext="${stdenv.hostPlatform.extensions.sharedLibrary}"
7474+ if [ -e "$lib/lib/''${name%.a}$ext" ] || [ -e "''${i%.a}$ext" ]; then
7475 rm "$i"
7576 fi
7677 done
···150150 for i in as ld ar ranlib nm strip readelf objdump; do
151151 cp ${binutils.bintools.out}/bin/$i $out/bin
152152 done
153153+ cp '${lib.getLib binutils.bintools}'/lib/* "$out/lib/"
153154154155 chmod -R u+w $out
155156
···1919 # Fixes '#error You must compile this program without "-O"'
2020 hardeningDisable = [ "all" ];
21212222+ # Ignore undefined references to a bunch of libsoup symbols
2323+ NIX_LDFLAGS = "--unresolved-symbol=ignore-all";
2424+2225 preConfigure = ''
2326 patchShebangs configure
2427