8bc5104a6e
When specifying the `builder` attribute in `stdenv.mkDerivation`, this will be effectively transformed into builtins.derivation { builder = stdenv.shell; args = [ "-e" builder ]; } This also means that `default-builder.sh` is never sourced and as a result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct location[1]. Also, we need to source `.attrs.sh` to source `$stdenv`. So, the following is done now: * If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it. Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage (see previous commit for more context), so prefer the environment variable if possible. * Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this can happen. * If neither applies, it can be assumed that `__structuredAttrs` is turned off and thus nothing needs to be done. [1] It's possible that it doesn't exist at all - in case of Nix 2.3 or it can point to a wrong location on older Nix versions with a bug in `__structuredAttrs`.
43 lines
1.3 KiB
Bash
43 lines
1.3 KiB
Bash
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
|