Merge pull request #223245 from doronbehar/pkg/libreoffice.chdir
libreoffice/wrapper: Don't --chdir
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
# The unwrapped libreoffice derivation
|
||||
, unwrapped
|
||||
, makeWrapper
|
||||
, xorg # for lndir
|
||||
, runCommand
|
||||
, substituteAll
|
||||
# For Emulating wrapGAppsHook
|
||||
@@ -72,14 +73,13 @@ let
|
||||
fi
|
||||
'')
|
||||
] ++ [
|
||||
"--chdir" "${unwrapped}/lib/libreoffice/program"
|
||||
"--inherit-argv0"
|
||||
] ++ extraMakeWrapperArgs
|
||||
);
|
||||
in runCommand "${unwrapped.name}-wrapped" {
|
||||
inherit (unwrapped) meta;
|
||||
paths = [ unwrapped ];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
nativeBuildInputs = [ makeWrapper xorg.lndir ];
|
||||
passthru = {
|
||||
inherit unwrapped;
|
||||
# For backwards compatibility:
|
||||
@@ -87,8 +87,7 @@ in runCommand "${unwrapped.name}-wrapped" {
|
||||
inherit (unwrapped) kdeIntegration;
|
||||
};
|
||||
} (''
|
||||
mkdir -p "$out/bin"
|
||||
mkdir -p "$out/share"
|
||||
mkdir -p $out/share
|
||||
for dir in ${unwrapped}/share/*; do
|
||||
dirname="''${dir##*/}"
|
||||
if [[ $dirname == "applications" ]]; then
|
||||
@@ -97,21 +96,30 @@ in runCommand "${unwrapped.name}-wrapped" {
|
||||
ln -s $dir $out/share/
|
||||
fi
|
||||
done
|
||||
|
||||
ln -s ${unwrapped}/lib $out/lib
|
||||
for f in $out/share/applications/*.desktop; do
|
||||
substituteInPlace "$f" \
|
||||
--replace "Exec=libreoffice${major}.${minor}" "Exec=soffice"
|
||||
done
|
||||
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/lib/libreoffice/program
|
||||
lndir -silent ${unwrapped}/lib/libreoffice/program $out/lib/libreoffice/program
|
||||
for i in sbase scalc sdraw smath swriter simpress soffice unopkg; do
|
||||
makeWrapper ${unwrapped}/lib/libreoffice/program/$i $out/bin/$i ${makeWrapperArgs}
|
||||
# Delete the symlink created by lndir, and replace it by our wrapper
|
||||
rm $out/lib/libreoffice/program/$i
|
||||
makeWrapper \
|
||||
${unwrapped}/lib/libreoffice/program/$i \
|
||||
$out/lib/libreoffice/program/$i \
|
||||
${makeWrapperArgs}
|
||||
'' + lib.optionalString dbusVerify ''
|
||||
# Delete the dbus socket directory after libreoffice quits
|
||||
sed -i 's/^exec -a "$0" //g' $out/bin/"$i"
|
||||
echo 'code="$?"' >> $out/bin/$i
|
||||
echo 'test -n "$dbus_socket_dir" && { rm -rf "$dbus_socket_dir"; kill $dbus_pid; }' >> $out/bin/$i
|
||||
echo 'exit "$code"' >> $out/bin/$i
|
||||
sed -i 's/^exec -a "$0" //g' $out/lib/libreoffice/program/$i
|
||||
echo 'code="$?"' >> $out/lib/libreoffice/program/$i
|
||||
echo 'test -n "$dbus_socket_dir" && { rm -rf "$dbus_socket_dir"; kill $dbus_pid; }' >> $out/lib/libreoffice/program/$i
|
||||
echo 'exit "$code"' >> $out/lib/libreoffice/program/$i
|
||||
'' + ''
|
||||
ln -s $out/lib/libreoffice/program/$i $out/bin/$i
|
||||
done
|
||||
# A symlink many users rely upon
|
||||
ln -s $out/bin/soffice $out/bin/libreoffice
|
||||
'')
|
||||
|
||||
Reference in New Issue
Block a user