mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-24 05:44:13 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
95 lines
2.5 KiB
Nix
95 lines
2.5 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, clipper
|
|
, cmake
|
|
, cups
|
|
, doxygen
|
|
, gdal
|
|
, ninja
|
|
, proj
|
|
, qt5
|
|
, zlib
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "OpenOrienteering-Mapper";
|
|
version = "0.9.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "OpenOrienteering";
|
|
repo = "mapper";
|
|
rev = "v${version}";
|
|
hash = "sha256-BQbryRV5diBkOtva9sYuLD8yo3IwFqrkz3qC+C6eEfE=";
|
|
};
|
|
|
|
patches = [
|
|
# https://github.com/OpenOrienteering/mapper/pull/1907
|
|
(fetchpatch {
|
|
url = "https://github.com/OpenOrienteering/mapper/commit/bc52aa567e90a58d6963b44d5ae1909f3f841508.patch";
|
|
hash = "sha256-pQzw2EfVay+0GOtIbh1KJOkILcj5LRMzmMYy9q+abK4=";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
substituteInPlace CMakeLists.txt \
|
|
--replace "find_package(ClangTidy" "#find_package(ClangTidy"
|
|
substituteInPlace packaging/custom_install.cmake.in \
|
|
--replace "fixup_bundle_portable(" "#fixup_bundle_portable("
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
doxygen
|
|
ninja
|
|
qt5.qttools
|
|
qt5.wrapQtAppsHook
|
|
];
|
|
|
|
buildInputs = [
|
|
clipper
|
|
cups
|
|
gdal
|
|
proj
|
|
qt5.qtimageformats
|
|
qt5.qtlocation
|
|
qt5.qtsensors
|
|
zlib
|
|
];
|
|
|
|
cmakeFlags = [
|
|
# Building the manual and bundling licenses fails
|
|
# See https://github.com/NixOS/nixpkgs/issues/85306
|
|
(lib.cmakeBool "LICENSING_PROVIDER" false)
|
|
(lib.cmakeBool "Mapper_MANUAL_QTHELP" false)
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
# FindGDAL is broken and always finds /Library/Framework unless this is
|
|
# specified
|
|
(lib.cmakeFeature "GDAL_INCLUDE_DIR" "${gdal}/include")
|
|
(lib.cmakeFeature "GDAL_CONFIG" "${gdal}/bin/gdal-config")
|
|
(lib.cmakeFeature "GDAL_LIBRARY" "${gdal}/lib/libgdal.dylib")
|
|
# Don't bundle libraries
|
|
(lib.cmakeBool "Mapper_PACKAGE_PROJ" false)
|
|
(lib.cmakeBool "Mapper_PACKAGE_QT" false)
|
|
(lib.cmakeBool "Mapper_PACKAGE_ASSISTANT" false)
|
|
(lib.cmakeBool "Mapper_PACKAGE_GDAL" false)
|
|
];
|
|
|
|
postInstall = with stdenv; lib.optionalString isDarwin ''
|
|
mkdir -p $out/{Applications,bin}
|
|
mv $out/Mapper.app $out/Applications
|
|
ln -s $out/Applications/Mapper.app/Contents/MacOS/Mapper $out/bin/Mapper
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://www.openorienteering.org/apps/mapper/";
|
|
description = "Orienteering mapmaking program";
|
|
changelog = "https://github.com/OpenOrienteering/mapper/releases/tag/v${version}";
|
|
license = licenses.gpl3Plus;
|
|
maintainers = with maintainers; [ mpickering sikmir ];
|
|
platforms = with platforms; unix;
|
|
mainProgram = "Mapper";
|
|
};
|
|
}
|