@ -1,5 +1,5 @@
{ stdenv , lib , makeDesktopItem , makeWrapper , lndir , config
, replace , fetchurl , zip , unzip , jq , xdg-utils , writeText
, fetchurl , zip , unzip , jq , xdg-utils , writeText
## various stuff that can be plugged in
, ffmpeg , xorg , alsa-lib , libpulseaudio , libcanberra-gtk3 , libglvnd , libnotify , opensc
@ -176,7 +176,7 @@ let
startupWMClass = wmClass ;
} ;
nativeBuildInputs = [ makeWrapper lndir replace jq ] ;
nativeBuildInputs = [ makeWrapper lndir jq ] ;
buildInputs = [ browser . gtk3 ] ;
@ -206,48 +206,50 @@ let
done
# fix links and absolute references
cd " ${ browser } "
find . - type l - print0 | while read - d $ ' \ 0 ' l ; do
target = " $ ( r e a d l i n k " $ l " | r e p l a c e - l i t e r a l - e s - - " $ { browser } " " $ out " ) "
target = " $ ( r e a d l i n k " $ l " ) "
target = '' ${ target / #"${browser}"/"$out"}
ln - sfT " $ t a r g e t " " $ o u t / $ l "
done
# This will not patch binaries, only "text" files.
# Its there for the wrapper mostly.
cd " $ o u t "
replace-literal - esfR - - " ${ browser } " " $ o u t "
# create the wrapper
executablePrefix = " $ o u t / b i n "
executablePath = " $ e x e c u t a b l e P r e f i x / ${ applicationName } "
oldWrapperArgs = ( )
if [ ! - x " $ e x e c u t a b l e P a t h " ]
then
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } / b i n / ${ applicationName } ' "
exit 1
fi
if [ ! - L " $ e x e c u t a b l e P a t h " ]
then
# Careful here, the file at executablePath may already be
# a wrapper. That is why we postfix it with -old instead
# of -wrapped.
oldExe = " $ e x e c u t a b l e P r e f i x " / " . ${ applicationName } " - old
mv " $ e x e c u t a b l e P a t h " " $ o l d E x e "
else
if [ [ - L $ executablePath ] ] ; then
# Symbolic link: wrap the link's target.
oldExe = " $ ( r e a d l i n k - v - - c a n o n i c a l i z e - e x i s t i n g " $ executablePath " ) "
rm " $ e x e c u t a b l e P a t h "
elif wrapperCmd = $ ( strings - dw " $ e x e c u t a b l e P a t h " | sed - n ' / ^ makeCWrapper / , / ^ $ / p' ) ; [ [ $ wrapperCmd ] ] ; then
# If the executable is a binary wrapper, we need to update its target to
# point to $out, but we can't just edit the binary in-place because of length
# issues. So we extract the command used to create the wrapper and add the
# arguments to our wrapper.
parseMakeCWrapperCall ( ) {
shift # makeCWrapper
oldExe = $ 1 ; shift
for arg do case $ arg in
- - inherit-argv0 ) oldWrapperArgs + = ( - - argv0 ' $ 0 ' ) ; ; # makeWrapper doesn't understand --inherit-argv0
* ) oldWrapperArgs + = ( " $ a r g " ) ; ;
esac done
}
eval " p a r s e M a k e C W r a p p e r C a l l ' ' ${ wrapperCmd // " ${ browser } " / " $ o u t " } "
rm " $ e x e c u t a b l e P a t h "
else
if read - rn2 shebang < " $ e x e c u t a b l e P a t h " && [ [ $ shebang == ' #!' ]]; then
# Shell wrapper: patch in place to point to $out.
sed - i " s @ ${ browser } @ $ o u t @ g " " $ e x e c u t a b l e P a t h "
fi
if [ ! - x " ${ browser } / b i n / ${ applicationName } " ]
then
echo " c a n n o t f i n d e x e c u t a b l e f i l e \` ${ browser } / b i n / ${ applicationName } ' "
exit 1
# Suffix the executable with -old, because -wrapped might already be used by the old wrapper.
oldExe = " $ e x e c u t a b l e P r e f i x / . ${ applicationName } " - old
mv " $ e x e c u t a b l e P a t h " " $ o l d E x e "
fi
makeWrapper " $ o l d E x e " \
" $ o u t / b i n / ${ applicationName } ${ nameSuffix } " \
" ' ' ${ executablePath } ${ nameSuffix } " \
- - prefix LD_LIBRARY_PATH ' : ' " $ l i b s " \
- - suffix-each GTK_PATH ' : ' " $ g t k _ m o d u l e s " \
- - prefix PATH ' : ' " ${ xdg-utils } / b i n " \
@ -258,9 +260,8 @@ let
- - set MOZ_ALLOW_DOWNGRADE 1 \
- - prefix XDG_DATA_DIRS : " $ G S E T T I N G S _ S C H E M A S _ P A T H " \
- - suffix XDG_DATA_DIRS : ' $ { gnome . adwaita-icon-theme } /share ' \
$ { lib . optionalString forceWayland ''
- - set MOZ_ENABLE_WAYLAND " 1 " \
'' }
$ { lib . optionalString forceWayland " - - s e t M O Z _ E N A B L E _ W A Y L A N D 1 " } \
" ' ' ${ oldWrapperArgs [ @ ] } "
#############################
# #
# END EXTRA PREF CHANGES #