about summary refs log tree commit diff
path: root/pkgs/by-name/gc
diff options
context:
space:
mode:
authorToma <62384384+TomaSajt@users.noreply.github.com>2024-01-30 15:09:54 +0100
committerGitHub <noreply@github.com>2024-01-30 15:09:54 +0100
commit9188d39c92920e5c215b827a2efd64b664c2f9db (patch)
treef9fcb6ec8e93937e186fd2ae87c06368e73ea3e2 /pkgs/by-name/gc
parentd8d039b1e2b7e7ad1b3eeccee3ec78b559ae2fac (diff)
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>
Diffstat (limited to 'pkgs/by-name/gc')
-rw-r--r--pkgs/by-name/gc/gcs/package.nix86
1 files changed, 86 insertions, 0 deletions
diff --git a/pkgs/by-name/gc/gcs/package.nix b/pkgs/by-name/gc/gcs/package.nix
new file mode 100644
index 0000000000000..3ded7802d6746
--- /dev/null
+++ b/pkgs/by-name/gc/gcs/package.nix
@@ -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;
+  };
+}