grapejuice: use upstream installation script
https://gitlab.com/brinkervii/grapejuice/-/blob/master/src/grapejuice_packaging/builders/linux_package_builder.py
This commit is contained in:
parent
dc340b8860
commit
b33de2708f
|
@ -15,6 +15,7 @@
|
|||
, wine
|
||||
, glxinfo
|
||||
, xrandr
|
||||
, bash
|
||||
}:
|
||||
|
||||
python3Packages.buildPythonApplication rec {
|
||||
|
@ -39,6 +40,7 @@ python3Packages.buildPythonApplication rec {
|
|||
cairo
|
||||
gettext
|
||||
gtk3
|
||||
bash
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
|
@ -57,7 +59,6 @@ python3Packages.buildPythonApplication rec {
|
|||
dontWrapGApps = true;
|
||||
|
||||
makeWrapperArgs = [
|
||||
"\${gappsWrapperArgs[@]}"
|
||||
"--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs wine winetricks pciutils glxinfo xrandr ]}"
|
||||
# make xdg-open overrideable at runtime
|
||||
"--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}"
|
||||
|
@ -77,7 +78,7 @@ python3Packages.buildPythonApplication rec {
|
|||
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
|
||||
--replace \$PLAYER_ICON "grapejuice-roblox-player"
|
||||
|
||||
substituteInPlace src/grapejuice_common/assets/desktop/roblox-studio.desktop \
|
||||
substituteInPlace src/grapejuice_common/assets/desktop/roblox-studio.desktop src/grapejuice_common/assets/desktop/roblox-studio-auth.desktop \
|
||||
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
|
||||
--replace \$STUDIO_ICON "grapejuice-roblox-studio"
|
||||
|
||||
|
@ -87,38 +88,37 @@ python3Packages.buildPythonApplication rec {
|
|||
substituteInPlace src/grapejuice_common/models/settings_model.py \
|
||||
--replace 'default_wine_home: Optional[str] = ""' 'default_wine_home: Optional[str] = "${wine}"'
|
||||
|
||||
# Removed in 7.10.3. Required to set up the binary files.
|
||||
substituteInPlace setup.py \
|
||||
--replace 'install_requires=install_requires(),' 'install_requires=install_requires(),
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"grapejuice=grapejuice.cli.main:easy_install_main",
|
||||
"grapejuice-gui=grapejuice.cli.gui:easy_install_main"
|
||||
]
|
||||
},'
|
||||
substituteInPlace src/grapejuice_packaging/builders/linux_package_builder.py \
|
||||
--replace '"--no-dependencies",' '"--no-dependencies", "--no-build-isolation",'
|
||||
|
||||
substituteInPlace src/grapejuice_packaging/packaging_resources/bin/grapejuice src/grapejuice_packaging/packaging_resources/bin/grapejuice-gui \
|
||||
--replace "/usr/bin/env python3" "${python3Packages.python.interpreter}"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$out/share/icons" "$out/share/applications" "$out/share/mime/packages"
|
||||
cp -r src/grapejuice_common/assets/desktop/* $out/share/applications/
|
||||
cp -r src/grapejuice_common/assets/icons $out/share/
|
||||
cp src/grapejuice_common/assets/mime_xml/*.xml $out/share/mime/packages/
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# compile locales (*.po -> *.mo)
|
||||
# from https://gitlab.com/brinkervii/grapejuice/-/blob/master/src/grapejuice_common/util/mo_util.py
|
||||
LOCALE_DIR="$out/share/locale"
|
||||
PO_DIR="src/grapejuice_common/assets/po"
|
||||
LINGUAS_FILE="src/grapejuice_common/assets/po/LINGUAS"
|
||||
PYTHONPATH=$(pwd)/src:$PYTHONPATH python3 -m grapejuice_packaging linux_package
|
||||
|
||||
for lang in $(<"$LINGUAS_FILE") # extract langs from LINGUAS_FILE
|
||||
do
|
||||
po_file="$PO_DIR/$lang.po"
|
||||
mo_file_dir="$LOCALE_DIR/$lang/LC_MESSAGES"
|
||||
mkdir -p "$out" "$out/${python3Packages.python.sitePackages}"
|
||||
tar -xvf ./dist/linux_package/grapejuice-''${version}.tar.gz --strip-components=1 -C "$out"
|
||||
|
||||
mkdir -p $mo_file_dir
|
||||
mv "$out/lib/python3/dist-packages/"* "$out/${python3Packages.python.sitePackages}"
|
||||
rmdir --ignore-fail-on-non-empty -p "$out/lib/python3/dist-packages"
|
||||
|
||||
mo_file="$mo_file_dir/grapejuice.mo"
|
||||
msgfmt $po_file -o $mo_file # msgfmt from gettext
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
patchShebangs "$out/bin/grapejuice{,-gui}"
|
||||
|
||||
buildPythonPath "$out $pythonPath"
|
||||
|
||||
for bin in grapejuice grapejuice-gui; do
|
||||
wrapProgram "$out/bin/$bin" \
|
||||
--prefix PYTHONPATH : "$PYTHONPATH:$(toPythonPath $out)" \
|
||||
''${makeWrapperArgs[@]} \
|
||||
''${gappsWrapperArgs[@]}
|
||||
done
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue