nixpkgs/pkgs/by-name/op/openscad-unstable/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

149 lines
3.2 KiB
Nix

{ lib
, clangStdenv
, llvmPackages
, fetchFromGitHub
, cmake
, ninja
, pkg-config
, bison
, boost
, cairo
, cgal_5
, clipper2
, double-conversion
, eigen
, flex
, fontconfig
, freetype
, ghostscript
, glib
, glm
, gmp
, harfbuzz
, hidapi
, lib3mf
, libGLU
, libICE
, libSM
, libsForQt5
, libspnav
, libzip
, manifold
, mesa
, mpfr
, python3
, tbb_2021_11
, wayland
, wayland-protocols
, wrapGAppsHook3
, xorg
, mimalloc
, opencsg
}:
# clang consume much less RAM than GCC
clangStdenv.mkDerivation rec {
pname = "openscad-unstable";
version = "2024-09-22";
src = fetchFromGitHub {
owner = "openscad";
repo = "openscad";
rev = "1cf4e97ed488d606c823f107dcc361f218aa84ca";
hash = "sha256-5WzLAQnjH+4JjJhh9pCgY3j8+lyNPrtY9a104tzkglo=";
fetchSubmodules = true; # Only really need sanitizers-cmake and MCAD
};
patches = [ ./test.diff ];
nativeBuildInputs = [
(python3.withPackages (ps: with ps; [ numpy pillow ]))
bison
cmake
flex
libsForQt5.qt5.wrapQtAppsHook
llvmPackages.bintools
wrapGAppsHook3
ninja
pkg-config
];
buildInputs = with libsForQt5; with qt5; [
clipper2
glm
tbb_2021_11
mimalloc
boost
cairo
cgal_5
double-conversion
eigen
fontconfig
freetype
ghostscript
glib
gmp
opencsg
harfbuzz
hidapi
lib3mf
libspnav
libzip
manifold
mpfr
qscintilla
qtbase
qtmultimedia
]
++ lib.optionals clangStdenv.hostPlatform.isLinux [
xorg.libXdmcp
libICE
libSM
wayland
wayland-protocols
qtwayland
libGLU
]
++ lib.optional clangStdenv.hostPlatform.isDarwin qtmacextras
;
cmakeFlags = [
"-DEXPERIMENTAL=ON" # enable experimental options
"-DSNAPSHOT=ON" # nightly icons
"-DUSE_BUILTIN_OPENCSG=OFF"
"-DUSE_BUILTIN_MANIFOLD=OFF"
"-DOPENSCAD_VERSION=\"${builtins.replaceStrings ["-"] ["."] version}\""
"-DCMAKE_UNITY_BUILD=ON" # faster build
# IPO
"-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld"
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON"
];
doCheck = true;
nativeCheckInputs = [
mesa.llvmpipeHook
];
checkPhase = ''
# some fontconfig issues cause pdf output to have wrong font
ctest -j$NIX_BUILD_CORES -E pdfexporttest.\*
'';
meta = with lib; {
description = "3D parametric model compiler (unstable)";
longDescription = ''
OpenSCAD is a software for creating solid 3D CAD objects. It is free
software and available for Linux/UNIX, MS Windows and macOS.
Unlike most free software for creating 3D models (such as the famous
application Blender) it does not focus on the artistic aspects of 3D
modelling but instead on the CAD aspects. Thus it might be the
application you are looking for when you are planning to create 3D models of
machine parts but pretty sure is not what you are looking for when you are more
interested in creating computer-animated movies.
'';
homepage = "https://openscad.org/";
# note that the *binary license* is gpl3 due to CGAL
license = lib.licenses.gpl3;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ pca006132 raskin ];
mainProgram = "openscad";
};
}