Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fritzing: 0.9.3b -> 0.9.4 #98381

Merged
merged 1 commit into from
Oct 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 54 additions & 14 deletions pkgs/applications/science/electronics/fritzing/default.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,81 @@
{ mkDerivation, stdenv, fetchpatch, fetchFromGitHub, qmake, pkgconfig
, qtbase, qtsvg, qtserialport, boost, libgit2
, qtbase, qtsvg, qttools, qtserialport, boost, libgit2
}:

let
# build number corresponding to a release, has no further relation
# see https://github.com/fritzing/fritzing-app/releases/tag/CD-498
fritzingBuild = "498";
# SHA256 of the fritzing-parts HEAD on the master branch,
# which contains the latest stable parts definitions
partsSha = "e79a69765026f3fda8aab1b3e7a4952c28047a62";
in

mkDerivation rec {
pname = "fritzing";
version = "0.9.3b";
version = "0.9.4-${fritzingBuild}";

src = fetchFromGitHub {
owner = "fritzing";
repo = "fritzing-app";
rev = version;
sha256 = "0hpyc550xfhr6gmnc85nq60w00rm0ljm0y744dp0z88ikl04f4s3";
rev = "CD-${fritzingBuild}";
sha256 = "0aljj2wbmm1vd64nhj6lh9qy856pd5avlgydsznya2vylyz20p34";
};

parts = fetchFromGitHub {
owner = "fritzing";
repo = "fritzing-parts";
rev = version;
sha256 = "1d2v8k7p176j0lczx4vx9n9gbg3vw09n2c4b6w0wj5wqmifywhc1";
name = "fritzing-parts";
rev = partsSha;
sha256 = "0spka33a5qq34aq79j01arw1aly4vh0hzv7mahryhdlcdk22qqvc";
};

buildInputs = [ qtbase qtsvg qtserialport boost libgit2 ];

nativeBuildInputs = [ qmake pkgconfig qttools ];

patches = [(fetchpatch {
name = "0001-Squashed-commit-of-the-following.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-Squashed-commit-of-the-following.patch?h=fritzing";
sha256 = "1cv6myidxhy28i8m8v13ghzkvx5978p9dcd8v7885y0l1h3108mf";
name = "fix-libgit2-version.patch";
url = "https://github.com/fritzing/fritzing-app/commit/472951243d70eeb40a53b1f7e16e6eab0588d079.patch";
sha256 = "0v1zi609cjnqac80xgnk23n54z08g1lia37hbzfl8jcq9sn9adak";
})];

buildInputs = [ qtbase qtsvg qtserialport boost libgit2 ];
postPatch = ''
substituteInPlace phoenix.pro \
--replace 'LIBGIT_STATIC = true' 'LIBGIT_STATIC = false'

nativeBuildInputs = [ qmake pkgconfig ];
substituteInPlace tools/linux_release_script/release.sh \
--replace 'git status' 'echo >/dev/null' \
--replace 'git clean' 'echo >/dev/null' \
--replace 'git clone' 'echo >/dev/null' \
--replace 'release_folder="' 'release_folder="$out" #' \
--replace './Fritzing -db' '# run after fixup'

qmakeFlags = [ "phoenix.pro" ];
substituteInPlace src/fapplication.cpp \
--replace 'PartsChecker::getSha(dir.absolutePath());' '"${partsSha}";'
'';

preConfigure = ''
ln -s "$parts" parts
buildPhase = ''
bash tools/linux_release_script/release.sh ${version}
'';

installPhase = ''
rm "$out/Fritzing" # remove script file
mkdir "$out/bin"
mv "$out/lib/Fritzing" "$out/bin/Fritzing"
mkdir --parents "$out/share/applications" "$out/share/metainfo"
mv --target-directory="$out/share/applications" "$out/org.fritzing.Fritzing.desktop"
mv --target-directory="$out/share/metainfo" "$out/org.fritzing.Fritzing.appdata.xml"
cp --recursive --no-target-directory "$parts" "$out/fritzing-parts"
'';

postFixup = ''
# generate the parts.db file
QT_QPA_PLATFORM=offscreen "$out/bin/Fritzing" -db "$out/fritzing-parts/parts.db" -pp "$out/fritzing-parts" -folder "$out"
'';

qmakeFlags = [ "phoenix.pro" ];

meta = {
description = "An open source prototyping tool for Arduino-based projects";
homepage = "http://fritzing.org/";
Expand Down