gcs: 4.8.0 -> 5.20.4, adopt, refactor (#279271)

* gcs: 4.8.0 -> 5.20.4, adopt, refactor

---------

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
This commit is contained in:
Toma 2024-01-30 15:09:54 +01:00 committed by GitHub
parent d8d039b1e2
commit 9188d39c92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 86 additions and 83 deletions

View File

@ -0,0 +1,86 @@
{ lib
, buildGoModule
, fetchFromGitHub
, pkg-config
, moreutils
, libGL
, libX11
, libXcursor
, libXrandr
, libXinerama
, libXi
, libXxf86vm
, mupdf
, fontconfig
, freetype
, stdenv
, darwin
, nix-update-script
}:
buildGoModule rec {
pname = "gcs";
version = "5.20.4";
src = fetchFromGitHub {
owner = "richardwilkes";
repo = "gcs";
rev = "v${version}";
hash = "sha256-aoU2wRz2XB6+3e6am/dLjRbcDmWTjtDtTBwc6c4n3DE=";
};
modPostBuild = ''
chmod +w vendor/github.com/richardwilkes/pdf
sed -i 's|-lmupdf[^ ]* |-lmupdf |g' vendor/github.com/richardwilkes/pdf/pdf.go
'';
vendorHash = "sha256-ee6qvwnUXtsBcovPOORfVpdndICtIUYe4GrP52V/P3k=";
nativeBuildInputs = [ pkg-config moreutils ];
buildInputs = [
libGL
libX11
libXcursor
libXrandr
libXinerama
libXi
libXxf86vm
mupdf
fontconfig
freetype
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk_11_0.frameworks.Carbon
darwin.apple_sdk_11_0.frameworks.Cocoa
darwin.apple_sdk_11_0.frameworks.Kernel
];
# flags are based on https://github.com/richardwilkes/gcs/blob/master/build.sh
flags = [ "-a -trimpath" ];
ldflags = [ "-s" "-w" "-X github.com/richardwilkes/toolbox/cmdline.AppVersion=${version}" ];
# Workaround for https://github.com/NixOS/nixpkgs/issues/166205
env = lib.optionalAttrs (stdenv.cc.libcxx != null) {
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
};
installPhase = ''
runHook preInstall
install -Dm755 $GOPATH/bin/gcs -t $out/bin
runHook postInstall
'';
passthru.updateScript = nix-update-script { };
meta = {
changelog = "https://github.com/richardwilkes/gcs/releases/tag/${src.rev}";
description = "A stand-alone, interactive, character sheet editor for the GURPS 4th Edition roleplaying game system";
homepage = "https://gurpscharactersheet.com/";
license = lib.licenses.mpl20;
mainProgram = "gcs";
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
# incompatible vendor/github.com/richardwilkes/unison/internal/skia/libskia_linux.a
broken = stdenv.isLinux && stdenv.isAarch64;
};
}

View File

@ -1,81 +0,0 @@
{ lib, stdenv, fetchFromGitHub, runCommand
, jdk8, ant
, jre8, makeWrapper
}:
let
gcs = fetchFromGitHub {
owner = "richardwilkes";
repo = "gcs";
rev = "gcs-4.8.0";
sha256 = "0k8am8vfwls5s2z4zj1p1aqy8gapn5vbr9zy66s5g048ch8ah1hm";
};
appleStubs = fetchFromGitHub {
owner = "richardwilkes";
repo = "apple_stubs";
rev = "gcs-4.3.0";
sha256 = "0m1qw30b19s04hj7nch1mbvv5s698g5dr1d1r7r07ykvk1yh7zsa";
};
toolkit = fetchFromGitHub {
owner = "richardwilkes";
repo = "toolkit";
rev = "gcs-4.8.0";
sha256 = "1ciwwh0wxk3pzsj6rbggsbg3l2f741qy7yx1ca4v7vflsma84f1n";
};
library = fetchFromGitHub {
owner = "richardwilkes";
repo = "gcs_library";
rev = "gcs-4.8.0";
sha256 = "085jpp9mpv5kw00zds9sywmfq31mrlbrgahnwcjkx0z9i22amz4g";
};
in stdenv.mkDerivation rec {
pname = "gcs";
version = "4.8.0";
src = runCommand "${pname}-${version}-src" { preferLocalBuild = true; } ''
mkdir -p $out
cd $out
cp -r ${gcs} gcs
cp -r ${appleStubs} apple_stubs
cp -r ${toolkit} toolkit
cp -r ${library} gcs_library
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jdk8 jre8 ant ];
buildPhase = ''
cd apple_stubs
ant
cd ../toolkit
ant
cd ../gcs
ant
cd ..
'';
installPhase = ''
mkdir -p $out/bin $out/share/java
find gcs/libraries toolkit/libraries apple_stubs/ \( -name '*.jar' -and -not -name '*-src.jar' \) -exec cp '{}' $out/share/java ';'
makeWrapper ${jre8}/bin/java $out/bin/gcs \
--set GCS_LIBRARY ${library} \
--add-flags "-cp $out/share/java/gcs-${version}.jar com.trollworks.gcs.app.GCS"
'';
meta = with lib; {
description = "A stand-alone, interactive, character sheet editor for the GURPS 4th Edition roleplaying game system";
homepage = "https://gurpscharactersheet.com/";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # source bundles dependencies as jars
];
license = licenses.mpl20;
platforms = platforms.all;
maintainers = with maintainers; [];
};
}

View File

@ -37699,8 +37699,6 @@ with pkgs;
gav = callPackage ../games/gav { };
gcs = callPackage ../games/gcs { };
gcompris = libsForQt5.callPackage ../games/gcompris { };
gemrb = callPackage ../games/gemrb { };