Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / op / openorienteering-mapper / package.nix
blob4a1519337034dc0b65ef4d915efd08e8068d9a6e
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , clipper
6 , cmake
7 , cups
8 , doxygen
9 , gdal
10 , ninja
11 , proj
12 , qt5
13 , zlib
16 stdenv.mkDerivation rec {
17   pname = "OpenOrienteering-Mapper";
18   version = "0.9.5";
20   src = fetchFromGitHub {
21     owner = "OpenOrienteering";
22     repo = "mapper";
23     rev = "v${version}";
24     hash = "sha256-BQbryRV5diBkOtva9sYuLD8yo3IwFqrkz3qC+C6eEfE=";
25   };
27   patches = [
28     # https://github.com/OpenOrienteering/mapper/pull/1907
29     (fetchpatch {
30       url = "https://github.com/OpenOrienteering/mapper/commit/bc52aa567e90a58d6963b44d5ae1909f3f841508.patch";
31       sha256 = "1bkckapzccn6k0ri6bgrr0nhis9498fnwj7b32s2ysym8zcg0355";
32     })
33   ];
35   postPatch = ''
36     substituteInPlace CMakeLists.txt \
37       --replace "find_package(ClangTidy" "#find_package(ClangTidy"
38     substituteInPlace packaging/custom_install.cmake.in \
39       --replace "fixup_bundle_portable(" "#fixup_bundle_portable("
40   '';
42   nativeBuildInputs = [
43     cmake
44     doxygen
45     ninja
46     qt5.qttools
47     qt5.wrapQtAppsHook
48   ];
50   buildInputs = [
51     clipper
52     cups
53     gdal
54     proj
55     qt5.qtimageformats
56     qt5.qtlocation
57     qt5.qtsensors
58     zlib
59   ];
61   cmakeFlags = [
62     # Building the manual and bundling licenses fails
63     # See https://github.com/NixOS/nixpkgs/issues/85306
64     (lib.cmakeBool "LICENSING_PROVIDER" false)
65     (lib.cmakeBool "Mapper_MANUAL_QTHELP" false)
66   ] ++ lib.optionals stdenv.isDarwin [
67     # FindGDAL is broken and always finds /Library/Framework unless this is
68     # specified
69     (lib.cmakeFeature "GDAL_INCLUDE_DIR" "${gdal}/include")
70     (lib.cmakeFeature "GDAL_CONFIG" "${gdal}/bin/gdal-config")
71     (lib.cmakeFeature "GDAL_LIBRARY" "${gdal}/lib/libgdal.dylib")
72     # Don't bundle libraries
73     (lib.cmakeBool "Mapper_PACKAGE_PROJ" false)
74     (lib.cmakeBool "Mapper_PACKAGE_QT" false)
75     (lib.cmakeBool "Mapper_PACKAGE_ASSISTANT" false)
76     (lib.cmakeBool "Mapper_PACKAGE_GDAL" false)
77   ];
79   postInstall = with stdenv; lib.optionalString isDarwin ''
80     mkdir -p $out/{Applications,bin}
81     mv $out/Mapper.app $out/Applications
82     ln -s $out/Applications/Mapper.app/Contents/MacOS/Mapper $out/bin/Mapper
83   '';
85   meta = with lib; {
86     homepage = "https://www.openorienteering.org/apps/mapper/";
87     description = "Orienteering mapmaking program";
88     changelog = "https://github.com/OpenOrienteering/mapper/releases/tag/v${version}";
89     license = licenses.gpl3Plus;
90     maintainers = with maintainers; [ mpickering sikmir ];
91     platforms = with platforms; unix;
92     mainProgram = "Mapper";
93   };