atlauncher: build from source (#327592)

This commit is contained in:
K900 2024-09-05 14:00:14 +03:00 committed by GitHub
commit 4c7acf930a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1321 additions and 29 deletions

1278
pkgs/by-name/at/atlauncher/deps.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,8 @@
{
copyDesktopItems,
fetchurl,
fetchFromGitHub,
gradle,
jre,
lib,
makeDesktopItem,
makeWrapper,
stdenvNoCC,
@ -24,23 +23,37 @@ stdenvNoCC.mkDerivation (finalAttrs: {
pname = "atlauncher";
version = "3.4.36.10";
src = fetchurl {
url = "https://github.com/ATLauncher/ATLauncher/releases/download/v${finalAttrs.version}/ATLauncher-${finalAttrs.version}.jar";
hash = "sha256-JZTiYcea5ik8a4RmNLxZcuea7spGWftUGRiRW2Ive7c=";
src = fetchFromGitHub {
owner = "ATLauncher";
repo = "ATLauncher";
rev = "v${finalAttrs.version}";
hash = "sha256-EMV/M5W/acJaQJsi4COoRQC2YVfuJG9HGcwvGfakoNo=";
};
env.ICON = fetchurl {
url = "https://atlauncher.com/assets/images/logo.svg";
hash = "sha256-XoqpsgLmkpa2SdjZvPkgg6BUJulIBIeu6mBsJJCixfo=";
};
dontUnpack = true;
postPatch = ''
# exclude UI tests
sed -i "/test {/a\ exclude '**/BasicLauncherUiTest.class'" build.gradle
'';
nativeBuildInputs = [
copyDesktopItems
gradle
makeWrapper
];
mitmCache = gradle.fetchDeps {
inherit (finalAttrs) pname;
data = ./deps.json;
};
doCheck = true;
gradleBuildTask = "shadowJar";
gradleFlags = [
"--exclude-task"
"createExe"
];
installPhase =
let
runtimeLibraries =
@ -59,30 +72,28 @@ stdenvNoCC.mkDerivation (finalAttrs: {
''
runHook preInstall
mkdir -p $out/bin $out/share/java
cp $src $out/share/java/ATLauncher.jar
mkdir -p $out/{bin,share/java}
cp build/libs/ATLauncher-${finalAttrs.version}.jar $out/share/java/ATLauncher.jar
makeWrapper ${jre}/bin/java $out/bin/atlauncher \
makeWrapper ${lib.getExe jre} $out/bin/atlauncher \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeLibraries}" \
--add-flags "-jar $out/share/java/ATLauncher.jar" \
--add-flags "--working-dir \"\''${XDG_DATA_HOME:-\$HOME/.local/share}/ATLauncher\"" \
--add-flags "--no-launcher-update"
mkdir -p $out/share/icons/hicolor/scalable/apps
cp $ICON $out/share/icons/hicolor/scalable/apps/atlauncher.svg
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
categories = [ "Game" ];
desktopName = "ATLauncher";
exec = "atlauncher";
icon = "atlauncher";
name = "atlauncher";
})
];
postInstall =
let
packagingDir = "${finalAttrs.src}/packaging/linux/_common";
in
''
install -D -m444 ${packagingDir}/atlauncher.desktop -t $out/share/applications
install -D -m444 ${packagingDir}/atlauncher.metainfo.xml -t $out/share/metainfo
install -D -m444 ${packagingDir}/atlauncher.png -t $out/share/pixmaps
install -D -m444 ${packagingDir}/atlauncher.svg -t $out/share/icons/hicolor/scalable/apps
'';
meta = {
changelog = "https://github.com/ATLauncher/ATLauncher/blob/v${finalAttrs.version}/CHANGELOG.md";
@ -93,6 +104,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
mainProgram = "atlauncher";
maintainers = with lib.maintainers; [ getpsyched ];
platforms = lib.platforms.all;
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryBytecode # mitm cache
];
};
})