Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / by-name / fr / free42 / package.nix
blobd821bbf628f9c29c65afa165d3c70a520d264293
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , alsa-lib
5 , copyDesktopItems
6 , gtk3
7 , makeDesktopItem
8 , pkg-config
9 }:
11 stdenv.mkDerivation (finalAttrs: {
12   pname = "free42";
13   version = "3.1";
15   src = fetchFromGitHub {
16     owner = "thomasokken";
17     repo = "free42";
18     rev = "v${finalAttrs.version}";
19     hash = "sha256-v3nZMjV9KnoTefeu2jl3k1B7efnJnNVOAfDVLyce6QI=";
20   };
22   nativeBuildInputs = [
23     copyDesktopItems
24     pkg-config
25   ];
27   buildInputs = [
28     alsa-lib
29     gtk3
30   ];
32   postPatch = ''
33     sed -i -e "s|/bin/ls|ls|" gtk/Makefile
34   '';
36   dontConfigure = true;
38   desktopItems = [
39     (makeDesktopItem {
40       name = "com.thomasokken.free42bin";
41       desktopName = "Free42Bin";
42       genericName = "Calculator";
43       exec = "free42bin";
44       type = "Application";
45       comment = finalAttrs.meta.description;
46       categories = [ "Utility" "Calculator" ];
47     })
48     (makeDesktopItem {
49       name = "com.thomasokken.free42dec";
50       desktopName = "Free42Dec";
51       genericName = "Calculator";
52       exec = "free42dec";
53       type = "Application";
54       comment = finalAttrs.meta.description;
55       categories = [ "Utility" "Calculator" ];
56     })
57   ];
59   buildPhase = ''
60     runHook preBuild
62     make -C gtk cleaner
63     make --jobs=$NIX_BUILD_CORES -C gtk
64     make -C gtk clean
65     make --jobs=$NIX_BUILD_CORES -C gtk BCD_MATH=1
67     runHook postBuild
68   '';
70   installPhase = ''
71     runHook preInstall
73     install --directory $out/bin \
74                         $out/share/doc/free42 \
75                         $out/share/free42/skins \
76                         $out/share/icons/hicolor/48x48/apps \
77                         $out/share/icons/hicolor/128x128/apps
79     install -m755 gtk/free42dec gtk/free42bin $out/bin
80     install -m644 gtk/README $out/share/doc/free42/README-GTK
81     install -m644 README $out/share/doc/free42/README
83     install -m644 gtk/icon-48x48.xpm $out/share/icons/hicolor/48x48/apps
84     install -m644 gtk/icon-128x128.xpm $out/share/icons/hicolor/128x128/apps
85     install -m644 skins/* $out/share/free42/skins
87     runHook postInstall
88   '';
90   meta = {
91     homepage = "https://github.com/thomasokken/free42";
92     description = "A software clone of HP-42S Calculator";
93     license = with lib.licenses; [ gpl2Only ];
94     maintainers = with lib.maintainers; [ AndersonTorres ];
95     mainProgram = "free42dec";
96     platforms = with lib.platforms; unix;
97   };