adobe-reader: restructure and add mainProgram (#364580)

This commit is contained in:
Sandro 2024-12-13 18:04:21 +01:00 committed by GitHub
commit c0f32c90de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 46 deletions

View File

@ -1,43 +0,0 @@
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
source $stdenv/setup
echo "unpacking $src..."
tar xvfa $src
echo "unpacking reader..."
p=$out/libexec/adobe-reader
mkdir -p $out/libexec
tar xvf AdobeReader/COMMON.TAR -C $out
tar xvf AdobeReader/ILINXR.TAR -C $out
mv $out/Adobe/Reader9 $p
rmdir $out/Adobe
# Disable this plugin for now (it needs LDAP, and I'm too lazy to add it).
rm $p/Reader/intellinux/plug_ins/PPKLite.api
# More pointless files.
rm $p/bin/UNINSTALL
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $libPath \
$p/Reader/intellinux/bin/acroread
# The "xargs -r" is to shut up a warning when Mozilla can't be found.
substituteInPlace $p/bin/acroread \
--replace /bin/pwd $(type -P pwd) \
--replace /bin/ls $(type -P ls) \
--replace xargs "xargs -r"
mkdir -p $out/bin
ln -s $p/bin/acroread $out/bin/acroread
mkdir -p $out/share/applications
mv $p/Resource/Support/AdobeReader.desktop $out/share/applications/
icon=$p/Resource/Icons/128x128/AdobeReader9.png
[ -e $icon ]
sed -i $out/share/applications/AdobeReader.desktop \
-e "s|Icon=.*|Icon=$icon|"
# Not sure if this works.
mkdir -p $out/share/mimelnk/application
mv $p/Resource/Support/vnd*.desktop $out/share/mimelnk/application

View File

@ -18,9 +18,6 @@ stdenv.mkDerivation rec {
pname = "adobe-reader";
version = "9.5.5";
# TODO: convert to phases
builder = ./builder.sh;
src = fetchurl {
url = "http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/${version}/enu/AdbeRdr${version}-1_i486linux_enu.tar.bz2";
sha256 = "0h35misxrqkl5zlmmvray1bqf4ywczkm89n9qw7d9arqbg3aj3pf";
@ -42,6 +39,48 @@ stdenv.mkDerivation rec {
gdk-pixbuf-xlib
];
installPhase = ''
p=$out/libexec/adobe-reader
mkdir -p $out/libexec
tar xvf COMMON.TAR -C $out
tar xvf ILINXR.TAR -C $out
mv $out/Adobe/Reader9 $p
rmdir $out/Adobe
# Disable this plugin for now (it needs LDAP).
rm $p/Reader/intellinux/plug_ins/PPKLite.api
# Remove unneeded files
rm $p/bin/UNINSTALL
'';
postFixup = ''
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $libPath \
$p/Reader/intellinux/bin/acroread
# The "xargs -r" is to shut up a warning when Mozilla can't be found.
substituteInPlace $p/bin/acroread \
--replace-fail /bin/pwd $(type -P pwd) \
--replace-fail /bin/ls $(type -P ls) \
--replace-fail xargs "xargs -r"
mkdir -p $out/bin
ln -s $p/bin/acroread $out/bin/acroread
mkdir -p $out/share/applications
mv $p/Resource/Support/AdobeReader.desktop $out/share/applications/
icon=$p/Resource/Icons/128x128/AdobeReader9.png
[ -e $icon ]
sed -i $out/share/applications/AdobeReader.desktop \
-e "s|Icon=.*|Icon=$icon|"
mkdir -p $out/share/mimelnk/application
mv $p/Resource/Support/vnd*.desktop $out/share/mimelnk/application
'';
dontStrip = true;
passthru.mozillaPlugin = "/libexec/adobe-reader/Browser/intellinux";
meta = {
@ -54,5 +93,7 @@ stdenv.mkDerivation rec {
"See: https://www.cvedetails.com/product/497/Adobe-Acrobat-Reader.html?vendor_id=53"
];
platforms = [ "i686-linux" ];
maintainers = with lib.maintainers; [ onny ];
mainProgram = "acroread";
};
}