zathura: Make compatible with darwin

This commit is contained in:
Pallav Agarwal 2018-02-15 01:22:15 +05:30
parent 7876f667b8
commit b484164017
6 changed files with 56 additions and 19 deletions

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, makeWrapper, pkgconfig { stdenv, fetchurl, makeWrapper, pkgconfig
, gtk, girara, ncurses, gettext, docutils , gtk, girara, ncurses, gettext, docutils
, file, sqlite, glib, texlive , file, sqlite, glib, texlive, libintlOrEmpty
, synctexSupport ? true , gtk-mac-integration, synctexSupport ? true
}: }:
assert synctexSupport -> texlive != null; assert synctexSupport -> texlive != null;
@ -19,12 +19,17 @@ stdenv.mkDerivation rec {
icon = ./icon.xpm; icon = ./icon.xpm;
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [
pkgconfig
] ++ optional stdenv.isDarwin [ libintlOrEmpty ];
buildInputs = [ buildInputs = [
file gtk girara file gtk girara
gettext makeWrapper sqlite glib gettext makeWrapper sqlite glib
] ++ optional synctexSupport texlive.bin.core; ] ++ optional synctexSupport texlive.bin.core
++ optional stdenv.isDarwin [ gtk-mac-integration ];
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/gio-unix-2.0"; NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/gio-unix-2.0";
makeFlags = [ makeFlags = [
@ -50,7 +55,7 @@ stdenv.mkDerivation rec {
homepage = http://pwmt.org/projects/zathura/; homepage = http://pwmt.org/projects/zathura/;
description = "A core component for zathura PDF viewer"; description = "A core component for zathura PDF viewer";
license = licenses.zlib; license = licenses.zlib;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers; [ garbas ]; maintainers = with maintainers; [ garbas ];
}; };
} }

View File

@ -13,6 +13,13 @@ stdenv.mkDerivation rec {
patches = [ ./gtkflags.patch ]; patches = [ ./gtkflags.patch ];
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
string1='-shared ''${LDFLAGS} -o $@ ''$(OBJECTS) ''${LIBS}'
string2='-Wl,-dylib_install_name,''${PLUGIN}.dylib -Wl,-bundle_loader,${zathura_core}/bin/.zathura-wrapped -bundle ''${LDFLAGS} -o $@ ''${OBJECTS} ''${LIBS}'
makefileC1=$(sed -r 's/\.so/.dylib/g' Makefile)
echo "''${makefileC1/$string1/$string2}" > Makefile
'';
makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ]; makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
@ -23,7 +30,7 @@ stdenv.mkDerivation rec {
djvulibre library. djvulibre library.
''; '';
license = licenses.zlib; license = licenses.zlib;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers; [ garbas ]; maintainers = with maintainers; [ garbas ];
}; };
} }

View File

@ -1,5 +1,6 @@
{ stdenv, lib, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl { stdenv, lib, fetchurl, pkgconfig, zathura_core, gtk,
, libjpeg, jbig2dec, openjpeg, fetchpatch }: gtk-mac-integration, girara, mupdf, openssl , libjpeg, jbig2dec,
openjpeg, fetchpatch }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "0.3.2"; version = "0.3.2";
@ -11,7 +12,18 @@ stdenv.mkDerivation rec {
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ zathura_core gtk girara openssl mupdf libjpeg jbig2dec openjpeg ];
buildInputs = [
zathura_core gtk girara openssl mupdf libjpeg jbig2dec openjpeg
gtk-mac-integration
];
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
string1='-shared ''${LDFLAGS} -o $@ ''$(OBJECTS) ''${LIBS}'
string2='-Wl,-dylib_install_name,''${PLUGIN}.dylib -Wl,-bundle_loader,${zathura_core}/bin/.zathura-wrapped -bundle ''${LDFLAGS} -o $@ ''${OBJECTS} ''${LIBS}'
makefileC1=$(sed -r 's/\.so/.dylib/g' Makefile)
echo "''${makefileC1/$string1/$string2}" > Makefile
'';
makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ]; makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
@ -23,7 +35,7 @@ stdenv.mkDerivation rec {
using the mupdf rendering library. using the mupdf rendering library.
''; '';
license = licenses.zlib; license = licenses.zlib;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers; [ cstrahan ]; maintainers = with maintainers; [ cstrahan ];
}; };
} }

View File

@ -9,11 +9,18 @@ stdenv.mkDerivation rec {
sha256 = "1m55m7s7f8ng8a7lmcw9z4n5zv7xk4vp9n6fp9j84z6rk2imf7a2"; sha256 = "1m55m7s7f8ng8a7lmcw9z4n5zv7xk4vp9n6fp9j84z6rk2imf7a2";
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig zathura_core ];
buildInputs = [ poppler zathura_core girara ]; buildInputs = [ poppler girara ];
makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ]; makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
string1='-shared ''${LDFLAGS} -o $@ ''$(OBJECTS) ''${LIBS}'
string2='-Wl,-dylib_install_name,''${PLUGIN}.dylib -Wl,-bundle_loader,${zathura_core}/bin/.zathura-wrapped -bundle ''${LDFLAGS} -o $@ ''${OBJECTS} ''${LIBS}'
makefileC1=$(sed -r 's/\.so/.dylib/g' Makefile)
echo "''${makefileC1/$string1/$string2}" > Makefile
'';
meta = with lib; { meta = with lib; {
homepage = http://pwmt.org/projects/zathura/; homepage = http://pwmt.org/projects/zathura/;
description = "A zathura PDF plugin (poppler)"; description = "A zathura PDF plugin (poppler)";
@ -22,7 +29,7 @@ stdenv.mkDerivation rec {
using the poppler rendering library. using the poppler rendering library.
''; '';
license = licenses.zlib; license = licenses.zlib;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers; [ cstrahan garbas ]; maintainers = with maintainers; [ cstrahan garbas ];
}; };
} }

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, pkgconfig, gtk, zathura_core, girara, libspectre, gettext }: { stdenv, lib, fetchurl, pkgconfig, gtk2, zathura_core, girara, libspectre, gettext }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "zathura-ps-0.2.5"; name = "zathura-ps-0.2.5";
@ -9,10 +9,17 @@ stdenv.mkDerivation rec {
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libspectre gettext zathura_core gtk girara ]; buildInputs = [ libspectre gettext zathura_core gtk2 girara ];
patches = [ ./gtkflags.patch ]; patches = [ ./gtkflags.patch ];
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
makefileC1=$(sed -r 's/\.so/.dylib/g' Makefile)
makefileC2=$(echo "$makefileC1" | sed 's|-shared ''${LDFLAGS} -o $@ ''$(OBJECTS) ''${LIBS}|-Wl,-dylib_install_name,''${PLUGIN}.dylib -Wl,-bundle_loader,${zathura_core}/bin/.zathura-wrapped -bundle ''${LDFLAGS} -o $@ ''${OBJECTS} ''${LIBS}|g' )
echo "$makefileC2" > Makefile
echo "$makefileC2"
'';
makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ]; makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
meta = with lib; { meta = with lib; {
@ -23,7 +30,7 @@ stdenv.mkDerivation rec {
libspectre library. libspectre library.
''; '';
license = licenses.zlib; license = licenses.zlib;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers; [ cstrahan garbas ]; maintainers = with maintainers; [ cstrahan garbas ];
}; };
} }

View File

@ -11,8 +11,7 @@ in symlinkJoin {
buildInputs = [ makeWrapper ]; buildInputs = [ makeWrapper ];
postBuild = '' postBuild = ''
wrapProgram $out/bin/zathura \ wrapProgram $out/bin/zathura --add-flags --plugins-dir=${pluginsPath}
--add-flags --plugins-dir=${pluginsPath}
''; '';
meta = with lib; { meta = with lib; {
@ -25,7 +24,7 @@ in symlinkJoin {
as well as an easy usage that mainly focuses on keyboard interaction. as well as an easy usage that mainly focuses on keyboard interaction.
''; '';
license = licenses.zlib; license = licenses.zlib;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers;[ garbas smironov ]; maintainers = with maintainers;[ garbas smironov ];
}; };
} }