2022-08-12 12:06:08 +00:00
|
|
|
{ stdenv
|
2021-06-28 23:13:55 +00:00
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2021-10-28 06:52:43 +00:00
|
|
|
, fetchpatch
|
2022-08-12 12:06:08 +00:00
|
|
|
, wrapQtAppsHook
|
2021-06-28 23:13:55 +00:00
|
|
|
, qmake
|
|
|
|
, pkg-config
|
|
|
|
, qtbase
|
|
|
|
, qtsvg
|
|
|
|
, qttools
|
|
|
|
, qtserialport
|
2024-01-25 14:12:00 +00:00
|
|
|
, qtwayland
|
|
|
|
, qt5compat
|
2021-06-28 23:13:55 +00:00
|
|
|
, boost
|
2022-08-12 12:06:08 +00:00
|
|
|
, libngspice
|
2021-06-28 23:13:55 +00:00
|
|
|
, libgit2
|
2021-10-28 06:52:43 +00:00
|
|
|
, quazip
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
let
|
|
|
|
# SHA256 of the fritzing-parts HEAD on the master branch,
|
|
|
|
# which contains the latest stable parts definitions
|
2024-01-25 14:12:00 +00:00
|
|
|
partsSha = "015626e6cafb1fc7831c2e536d97ca2275a83d32";
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
parts = fetchFromGitHub {
|
|
|
|
owner = "fritzing";
|
|
|
|
repo = "fritzing-parts";
|
|
|
|
rev = partsSha;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-5jw56cqxpT/8bf1q551WG53J6Lw5pH0HEtRUoNNMc+A=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Header-only library
|
|
|
|
svgpp = fetchFromGitHub {
|
|
|
|
owner = "svgpp";
|
|
|
|
repo = "svgpp";
|
|
|
|
rev = "v1.3.0";
|
|
|
|
hash = "sha256-kJEVnMYnDF7bThDB60bGXalYgpn9c5/JCZkRSK5GoE4=";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
2020-10-16 20:44:37 +00:00
|
|
|
in
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "fritzing";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "1.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-06-28 23:13:55 +00:00
|
|
|
owner = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "fritzing-app";
|
2024-01-25 14:12:00 +00:00
|
|
|
rev = "8f5f1373835050ce014299c78d91c24beea9b633";
|
|
|
|
hash = "sha256-jLVNzSh2KwXpi3begtp/53sdBmQQbCnKMCm2p770etg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
patches = [
|
2024-01-25 14:12:00 +00:00
|
|
|
# Fix error caused by implicit call
|
2021-10-28 06:52:43 +00:00
|
|
|
(fetchpatch {
|
2024-01-25 14:12:00 +00:00
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/0003-ParseResult-operator-bool-in-explicit.patch?h=fritzing&id=b2c79b55f0a2811e80bb1136b1e021fbc56937c9";
|
|
|
|
hash = "sha256-9HdcNqLHEB0HQbF7AaTdUIJUbafwsRKPA+wfF4g8veU=";
|
2021-10-28 06:52:43 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
nativeBuildInputs = [ qmake pkg-config qttools wrapQtAppsHook ];
|
|
|
|
buildInputs = [
|
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
qtserialport
|
|
|
|
qtwayland
|
|
|
|
qt5compat
|
|
|
|
boost
|
|
|
|
libgit2
|
|
|
|
quazip
|
|
|
|
libngspice
|
|
|
|
];
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
postPatch = ''
|
2024-01-25 14:12:00 +00:00
|
|
|
# Use packaged quazip, libgit and ngspice
|
|
|
|
sed -i "/pri\/quazipdetect.pri/d" phoenix.pro
|
|
|
|
sed -i "/pri\/spicedetect.pri/d" phoenix.pro
|
2020-10-16 20:44:37 +00:00
|
|
|
substituteInPlace phoenix.pro \
|
|
|
|
--replace 'LIBGIT_STATIC = true' 'LIBGIT_STATIC = false'
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
#TODO: Do not hardcode SHA.
|
2020-10-16 20:44:37 +00:00
|
|
|
substituteInPlace src/fapplication.cpp \
|
|
|
|
--replace 'PartsChecker::getSha(dir.absolutePath());' '"${partsSha}";'
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
mkdir parts
|
|
|
|
cp -a ${parts}/* parts/
|
2020-10-16 20:44:37 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [
|
|
|
|
"-I${lib.getDev quazip}/include/QuaZip-Qt${lib.versions.major qtbase.version}-${quazip.version}/quazip"
|
|
|
|
"-I${svgpp}/include"
|
|
|
|
];
|
|
|
|
env.NIX_LDFLAGS = "-lquazip1-qt${lib.versions.major qtbase.version}";
|
2022-08-12 12:06:08 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
qmakeFlags = [
|
|
|
|
"phoenix.pro"
|
|
|
|
];
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
postFixup = ''
|
|
|
|
# generate the parts.db file
|
2021-06-28 23:13:55 +00:00
|
|
|
QT_QPA_PLATFORM=offscreen "$out/bin/Fritzing" \
|
|
|
|
-db "$out/share/fritzing/parts/parts.db" \
|
2021-10-28 06:52:43 +00:00
|
|
|
-pp "$out/share/fritzing/parts" \
|
2021-06-28 23:13:55 +00:00
|
|
|
-folder "$out/share/fritzing"
|
2020-10-16 20:44:37 +00:00
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An open source prototyping tool for Arduino-based projects";
|
2020-10-07 09:15:18 +00:00
|
|
|
homepage = "https://fritzing.org/";
|
2021-06-28 23:13:55 +00:00
|
|
|
license = with licenses; [ gpl3 cc-by-sa-30 ];
|
2022-05-18 14:49:53 +00:00
|
|
|
maintainers = with maintainers; [ robberer muscaln ];
|
2021-06-28 23:13:55 +00:00
|
|
|
platforms = platforms.linux;
|
2023-05-24 13:37:59 +00:00
|
|
|
mainProgram = "Fritzing";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|