mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-31 09:14:28 +00:00
mupdf: build a shared library instead
This commit is contained in:
parent
fec634c25a
commit
a422c021b6
@ -19,12 +19,42 @@ stdenv.mkDerivation rec {
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
my_soname = "libmupdf.so.1.3";
|
||||
my_soname_js_none = "libmupdf-js-none.so.1.3";
|
||||
preBuild = ''
|
||||
export makeFlags="prefix=$out build=release XCFLAGS=-fpic"
|
||||
export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
|
||||
|
||||
# Copied from Gentoo ebuild
|
||||
rm -rf thirdparty
|
||||
sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \
|
||||
-e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \
|
||||
-e "/^MUPDF_LIB :=/s:=.*:= \$(OUT)/${my_soname}:" \
|
||||
-e "\$a\$(MUPDF_JS_NONE_LIB):" \
|
||||
-e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \
|
||||
-e "/^MUPDF_JS_NONE_LIB :=/s:=.*:= \$(OUT)/${my_soname_js_none}:" \
|
||||
-i Makefile
|
||||
|
||||
sed -e "s/libopenjpeg1/libopenjp2/" -i Makerules
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
ln -s ${my_soname} $out/lib/libmupdf.so
|
||||
|
||||
mkdir -p "$out/lib/pkgconfig"
|
||||
cat >"$out/lib/pkgconfig/mupdf.pc" <<EOF
|
||||
prefix=$out
|
||||
libdir=$out/lib
|
||||
includedir=$out/include
|
||||
|
||||
Name: mupdf
|
||||
Description: Library for rendering PDF documents
|
||||
Requires: freetype2 libopenjp2 libcrypto
|
||||
Version: 1.3
|
||||
Libs: -L$out/lib -lmupdf
|
||||
Cflags: -I$out/include
|
||||
EOF
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cat > $out/share/applications/mupdf.desktop <<EOF
|
||||
[Desktop Entry]
|
||||
|
Loading…
Reference in New Issue
Block a user