nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 155 lines 2.7 kB view raw
1{ 2 stdenv, 3 lib, 4 DarwinTools, 5 alsa-utils, 6 at-spi2-core, 7 cmake, 8 curl, 9 dbus, 10 elfutils, 11 fetchFromGitHub, 12 flac, 13 gitMinimal, 14 wrapGAppsHook3, 15 glew, 16 gtest, 17 jasper, 18 lame, 19 libGLU, 20 libarchive, 21 libdatrie, 22 libepoxy, 23 libexif, 24 libogg, 25 libopus, 26 libselinux, 27 libsepol, 28 libsndfile, 29 libthai, 30 libunarr, 31 libusb1, 32 libvorbis, 33 libxkbcommon, 34 lsb-release, 35 lz4, 36 libmpg123, 37 makeWrapper, 38 pkg-config, 39 portaudio, 40 rapidjson, 41 sqlite, 42 tinyxml, 43 util-linux, 44 wxGTK32, 45 xorg, 46}: 47 48stdenv.mkDerivation (finalAttrs: { 49 pname = "opencpn"; 50 version = "5.10.2"; 51 52 src = fetchFromGitHub { 53 owner = "OpenCPN"; 54 repo = "OpenCPN"; 55 rev = "Release_${finalAttrs.version}"; 56 hash = "sha256-VuMClQ5k1mTMF5yWstTi9YTF4tEN68acH5OPhjdzIwM="; 57 }; 58 59 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 60 sed -i '/fixup_bundle/d; /NO_DEFAULT_PATH/d' CMakeLists.txt 61 ''; 62 63 nativeBuildInputs = [ 64 cmake 65 pkg-config 66 gtest 67 wrapGAppsHook3 68 ] 69 ++ lib.optionals stdenv.hostPlatform.isLinux [ 70 lsb-release 71 ] 72 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 73 DarwinTools 74 makeWrapper 75 ]; 76 77 buildInputs = [ 78 at-spi2-core 79 curl 80 dbus 81 flac 82 gitMinimal 83 ] 84 ++ [ 85 glew 86 jasper 87 libGLU 88 libarchive 89 libdatrie 90 libepoxy 91 libexif 92 libogg 93 libopus 94 libsndfile 95 libthai 96 libunarr 97 libusb1 98 libvorbis 99 libxkbcommon 100 lz4 101 libmpg123 102 portaudio 103 rapidjson 104 sqlite 105 tinyxml 106 wxGTK32 107 ] 108 ++ lib.optionals stdenv.hostPlatform.isLinux [ 109 alsa-utils 110 libselinux 111 libsepol 112 util-linux 113 xorg.libXdmcp 114 xorg.libXtst 115 ] 116 ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [ 117 elfutils 118 ] 119 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 120 lame 121 ]; 122 123 cmakeFlags = [ 124 "-DOCPN_BUNDLE_DOCS=true" 125 ] 126 ++ lib.optionals stdenv.hostPlatform.isLinux [ 127 # Override OpenCPN platform detection. 128 "-DOCPN_TARGET_TUPLE=unknown;unknown;${stdenv.hostPlatform.linuxArch}" 129 ]; 130 131 env.NIX_CFLAGS_COMPILE = toString ( 132 lib.optionals (!stdenv.hostPlatform.isx86) [ 133 "-DSQUISH_USE_SSE=0" 134 ] 135 ); 136 137 postInstall = lib.optionals stdenv.hostPlatform.isDarwin '' 138 mkdir -p $out/Applications 139 mv $out/bin/OpenCPN.app $out/Applications 140 makeWrapper $out/Applications/OpenCPN.app/Contents/MacOS/OpenCPN $out/bin/opencpn 141 ''; 142 143 doCheck = true; 144 145 meta = with lib; { 146 description = "Concise ChartPlotter/Navigator"; 147 maintainers = with maintainers; [ 148 kragniz 149 lovesegfault 150 ]; 151 platforms = platforms.unix; 152 license = licenses.gpl2Plus; 153 homepage = "https://opencpn.org/"; 154 }; 155})