ieda: init at 0-unstable-2024-10-11 (#338769)
[NixPkgs.git] / pkgs / by-name / fr / free42 / package.nix
blobee1be3804755c720034b81d0fdbd2390fa16ddfa
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   alsa-lib,
6   copyDesktopItems,
7   gtk3,
8   makeDesktopItem,
9   pkg-config,
12 stdenv.mkDerivation (finalAttrs: {
13   pname = "free42";
14   version = "3.1.10";
16   src = fetchFromGitHub {
17     owner = "thomasokken";
18     repo = "free42";
19     rev = "v${finalAttrs.version}";
20     hash = "sha256-X1fNr+0xc15KmR+qbDOkQraYPUj50b1eWmSheIKl4e8=";
21   };
23   nativeBuildInputs = [
24     copyDesktopItems
25     pkg-config
26   ];
28   buildInputs = [
29     alsa-lib
30     gtk3
31   ];
33   postPatch = ''
34     sed -i -e "s|/bin/ls|ls|" gtk/Makefile
35   '';
37   dontConfigure = true;
39   desktopItems = [
40     (makeDesktopItem {
41       name = "com.thomasokken.free42bin";
42       desktopName = "Free42Bin";
43       genericName = "Calculator";
44       exec = "free42bin";
45       type = "Application";
46       comment = "A software clone of HP-42S Calculator";
47       categories = [
48         "Utility"
49         "Calculator"
50       ];
51     })
52     (makeDesktopItem {
53       name = "com.thomasokken.free42dec";
54       desktopName = "Free42Dec";
55       genericName = "Calculator";
56       exec = "free42dec";
57       type = "Application";
58       comment = "A software clone of HP-42S Calculator";
59       categories = [
60         "Utility"
61         "Calculator"
62       ];
63     })
64   ];
66   buildPhase = ''
67     runHook preBuild
69     make -C gtk cleaner
70     make --jobs=$NIX_BUILD_CORES -C gtk
71     make -C gtk clean
72     make --jobs=$NIX_BUILD_CORES -C gtk BCD_MATH=1
74     runHook postBuild
75   '';
77   installPhase = ''
78     runHook preInstall
80     install --directory $out/bin \
81                         $out/share/doc/free42 \
82                         $out/share/free42/skins \
83                         $out/share/icons/hicolor/48x48/apps \
84                         $out/share/icons/hicolor/128x128/apps
86     install -m755 gtk/free42dec gtk/free42bin $out/bin
87     install -m644 gtk/README $out/share/doc/free42/README-GTK
88     install -m644 README $out/share/doc/free42/README
90     install -m644 gtk/icon-48x48.xpm $out/share/icons/hicolor/48x48/apps
91     install -m644 gtk/icon-128x128.xpm $out/share/icons/hicolor/128x128/apps
92     install -m644 skins/* $out/share/free42/skins
94     runHook postInstall
95   '';
97   meta = {
98     homepage = "https://github.com/thomasokken/free42";
99     description = "Software clone of HP-42S Calculator";
100     license = with lib.licenses; [ gpl2Only ];
101     maintainers = with lib.maintainers; [ AndersonTorres ];
102     mainProgram = "free42dec";
103     platforms = with lib.platforms; unix;
104   };