ncurses: Fix up library linking
This commit is contained in:
parent
10d06f4252
commit
5191f5be2e
|
@ -9,9 +9,7 @@
|
||||||
, abiVersion ? "5"
|
, abiVersion ? "5"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let libSuffix = if stdenv.isDarwin then "dylib" else "so";
|
stdenv.mkDerivation rec {
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
name = "ncurses-5.9";
|
name = "ncurses-5.9";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
|
@ -50,50 +48,37 @@ in stdenv.mkDerivation rec {
|
||||||
# When building a wide-character (Unicode) build, create backward
|
# When building a wide-character (Unicode) build, create backward
|
||||||
# compatibility links from the the "normal" libraries to the
|
# compatibility links from the the "normal" libraries to the
|
||||||
# wide-character libraries (e.g. libncurses.so to libncursesw.so).
|
# wide-character libraries (e.g. libncurses.so to libncursesw.so).
|
||||||
postInstall = if unicode then (''
|
postInstall = ''
|
||||||
# Create a non-abi versioned config
|
# Determine what suffixes our libraries have
|
||||||
|
suffix="$(awk -F': ' 'f{print $3; f=0} /default library suffix/{f=1}' config.log)"
|
||||||
|
libs="$(ls $out/lib/pkgconfig | tr ' ' '\n' | sed "s,\(.*\)$suffix\.pc,\1,g")"
|
||||||
|
suffixes="$(echo "$suffix" | awk '{for (i=1; i < length($0); i++) {x=substr($0, i+1, length($0)-i); print x}}')"
|
||||||
|
|
||||||
|
# Get the path to the config util
|
||||||
cfg=$(basename $out/bin/ncurses*-config)
|
cfg=$(basename $out/bin/ncurses*-config)
|
||||||
ln -svf $cfg $out/bin/ncursesw-config
|
|
||||||
ln -svf $cfg $out/bin/ncurses-config
|
for newsuffix in $suffixes ""; do
|
||||||
|
# Create a non-abi versioned config util links
|
||||||
|
ln -svf $cfg $out/bin/ncurses$newsuffix-config
|
||||||
|
|
||||||
# Allow for end users who #include <ncurses?w/*.h>
|
# Allow for end users who #include <ncurses?w/*.h>
|
||||||
mv "$out"/include/ncursesw/* "$out"/include/
|
ln -svf . $out/include/ncurses$newsuffix
|
||||||
rmdir "$out"/include/ncursesw
|
|
||||||
ln -svf . $out/include/ncursesw
|
|
||||||
ln -svf . $out/include/ncurses
|
|
||||||
|
|
||||||
# Create non-unicode compatability
|
|
||||||
libs="$(find $out/lib -name \*w.a | sed 's,.*lib\(.*\)w.a.*,\1,g')"
|
|
||||||
for lib in $libs; do
|
for lib in $libs; do
|
||||||
if [ -e "$out/lib/lib''${lib}w.${libSuffix}" ]; then
|
for dylibtype in so dll dylib; do
|
||||||
ln -svf lib''${lib}w.${libSuffix} $out/lib/lib$lib.${libSuffix}
|
if [ -e "$out/lib/lib''${lib}$suffix.$dylibtype" ]; then
|
||||||
ln -svf lib''${lib}w.${libSuffix}.${abiVersion} $out/lib/lib$lib.${libSuffix}.${abiVersion}
|
ln -svf lib''${lib}$suffix.$dylibtype $out/lib/lib$lib$newsuffix.$dylibtype
|
||||||
fi
|
ln -svf lib''${lib}$suffix.$dylibtype.${abiVersion} $out/lib/lib$lib$newsuffix.$dylibtype.${abiVersion}
|
||||||
ln -svf lib''${lib}w.a $out/lib/lib$lib.a
|
|
||||||
ln -svf ''${lib}w.pc $out/lib/pkgconfig/$lib.pc
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create curses compatability
|
|
||||||
ln -svf libncursesw.so $out/lib/libcursesw.so
|
|
||||||
ln -svf libncursesw.so $out/lib/libcurses.so
|
|
||||||
'' + lib.optionalString stdenv.isCygwin ''
|
|
||||||
for lib in $libs; do
|
|
||||||
if test -e $out/lib/lib''${lib}w.dll.a; then
|
|
||||||
ln -svf lib''${lib}w.dll.a $out/lib/lib$lib.dll.a
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'') else ''
|
for statictype in a dll.a la; do
|
||||||
# Create a non-abi versioned config
|
if [ -e "$out/lib/lib''${lib}$suffix.$statictype" ]; then
|
||||||
cfg=$(basename $out/bin/ncurses*-config)
|
ln -svf lib''${lib}$suffix.$statictype $out/lib/lib$lib$newsuffix.$statictype
|
||||||
ln -svf $cfg $out/bin/ncurses-config
|
fi
|
||||||
|
done
|
||||||
# Allow for end users who #include <ncurses/*.h>
|
ln -svf ''${lib}$suffix.pc $out/lib/pkgconfig/$lib$newsuffix.pc
|
||||||
mv "$out"/include/ncurses/* "$out"/include/
|
done
|
||||||
rmdir "$out"/include/ncurses
|
done
|
||||||
ln -svf . $out/include/ncurses
|
|
||||||
|
|
||||||
# Create curses compatability
|
|
||||||
ln -svf libncurses.so $out/lib/libcurses.so
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
|
@ -124,5 +109,5 @@ in stdenv.mkDerivation rec {
|
||||||
maintainers = [ lib.maintainers.wkennington ];
|
maintainers = [ lib.maintainers.wkennington ];
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru.ldflags = if unicode then "-lncursesw" else "-lncurses";
|
passthru.ldflags = "-lncurses";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue