gnu: fritzing: Fix build.

* gnu/local.mk: Register patch.
* gnu/packages/engineering.scm (fritzing):
[patches]: Add patch.
[arguments] <#:phases>: Move source code substitution from configure to after
unpack. Patch src/utils/textutils.cpp to remove non-determinism. Add generate-parts-db.
* gnu/packages/patches/fritzing-0.9.6-fix-types.patch: New patch.

Fixes: guix/guix#3432
Change-Id: Id42f425c1da59cbc56b0b6bbd71380112a655280
Signed-off-by: Gabriel Wicki <gabriel@erlikon.ch>
This commit is contained in:
Jonathan Lin 2025-10-23 21:05:39 -07:00 committed by Gabriel Wicki
parent a59f32a2c3
commit e523f95fc2
No known key found for this signature in database
GPG key ID: CC98E9F04330FD7F
3 changed files with 104 additions and 9 deletions

View file

@ -1305,6 +1305,7 @@ dist_patch_DATA = \
%D%/packages/patches/fp16-system-libraries.patch \
%D%/packages/patches/fpc-reproducibility.patch \
%D%/packages/patches/fpc-glibc-2.34-compat.patch \
%D%/packages/patches/fritzing-0.9.6-fix-types.patch \
%D%/packages/patches/freedict-tools-fix-determinism.patch \
%D%/packages/patches/freedink-engine-fix-sdl-hints.patch \
%D%/packages/patches/freeimage-libtiff-compat.patch \

View file

@ -722,12 +722,21 @@ multipole-accelerated algorithm.")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "083nz7vj7a334575smjry6257535h68gglh8a381xxa36dw96aqs"))))
(base32 "083nz7vj7a334575smjry6257535h68gglh8a381xxa36dw96aqs"))
(patches (search-patches "fritzing-0.9.6-fix-types.patch"))))
(build-system gnu-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-files
(lambda _
;; Trick the internal mechanism to load the parts
(substitute* "src/version/partschecker.cpp"
((".*git_libgit2_init.*")
"return \"083nz7vj7a334575smjry6257535h68gglh8a381xxa36dw96aqs\";"))
(substitute* "src/utils/textutils.cpp"
(("QUuid::createUuid\\(\\)") "QUuid()"))))
(replace 'configure
(lambda _
;; Integrate parts library
@ -744,17 +753,22 @@ multipole-accelerated algorithm.")
"INCLUDEPATH += $$LIBGIT2INCLUDE\n"
"LIBS += -L$$LIBGIT2LIB -lgit2\n"))
(("^.*pri/libgit2detect.pri.") ""))
;; Trick the internal mechanism to load the parts
(substitute* "src/version/partschecker.cpp"
((".*git_libgit2_init.*")
"return \"083nz7vj7a334575smjry6257535h68gglh8a381xxa36dw96aqs\";"))
;; XXX: NixOS and Gento have a phase where they generate part
;; SQLite library, have proper investigation if it's required in
;; Guix as well.
(invoke "qmake"
(string-append "QMAKE_LFLAGS_RPATH=-Wl,-rpath," #$output "/lib")
(string-append "PREFIX=" #$output)
"phoenix.pro"))))))
"phoenix.pro")))
(add-after 'install 'generate-parts-db
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(env-qt-qpa-platform (getenv "QT_QPA_PLATFORM"))
(env-qt-hash-seed (getenv "QT_HASH_SEED")))
(setenv "QT_QPA_PLATFORM" "offscreen")
(setenv "QT_HASH_SEED" "0")
(invoke (string-append out "/bin/Fritzing")
"-db" (string-append out "/share/fritzing/parts/parts.db")
"-folder" (string-append out "/share/fritzing"))
(setenv "QT_QPA_PLATFORM" env-qt-qpa-platform)
(setenv "QT_HASH_SEED" env-qt-hash-seed)))))))
(native-inputs
(list fritzing-parts))
(inputs

View file

@ -0,0 +1,80 @@
From d2f68e7d2f1c5b02e7236e1e4c35b1f37981500e Mon Sep 17 00:00:00 2001
From: Jonathan Lin <jonathanylin1111@gmail.com>
Date: Wed, 22 Oct 2025 11:48:46 -0700
Subject: [PATCH] Fix quazip using wrong types
---
src/lib/quazip/crypt.h | 8 ++++----
src/lib/quazip/unzip.c | 2 +-
src/lib/quazip/zip.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lib/quazip/crypt.h b/src/lib/quazip/crypt.h
index 2ae6fd5..d47260c 100644
--- a/src/lib/quazip/crypt.h
+++ b/src/lib/quazip/crypt.h
@@ -32,7 +32,7 @@
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
-static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
+static int decrypt_byte(unsigned long* pkeys, const z_crc_t FAR * pcrc_32_tab)
{
#ifndef _WINDOWS
(void) pcrc_32_tab; /* avoid "unused parameter" warning */
@@ -49,7 +49,7 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
/***********************************************************************
* Update the encryption keys with the next byte of plain text
*/
-static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
+static int update_keys(unsigned long* pkeys,const z_crc_t FAR * pcrc_32_tab,int c)
{
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
@@ -66,7 +66,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int
* Initialize the encryption keys and the random header according to
* the given password.
*/
-static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
+static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t FAR * pcrc_32_tab)
{
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
@@ -96,7 +96,7 @@ const char *passwd; /* password string */
unsigned char *buf; /* where to write header */
int bufSize;
unsigned long* pkeys;
-const unsigned long* pcrc_32_tab;
+const z_crc_t FAR * pcrc_32_tab;
unsigned long crcForCrypting;
{
int n; /* index in random header */
diff --git a/src/lib/quazip/unzip.c b/src/lib/quazip/unzip.c
index dde4c34..9526964 100644
--- a/src/lib/quazip/unzip.c
+++ b/src/lib/quazip/unzip.c
@@ -150,7 +150,7 @@ typedef struct
int encrypted;
# ifndef NOUNCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
- const unsigned long* pcrc_32_tab;
+ const z_crc_t FAR * pcrc_32_tab;
# endif
} unz_s;
diff --git a/src/lib/quazip/zip.c b/src/lib/quazip/zip.c
index 99f29ce..eb640fe 100644
--- a/src/lib/quazip/zip.c
+++ b/src/lib/quazip/zip.c
@@ -134,7 +134,7 @@ typedef struct
int encrypt;
#ifndef NOCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
- const unsigned long* pcrc_32_tab;
+ const z_crc_t FAR * pcrc_32_tab;
int crypt_header_size;
#endif
} curfile_info;
--
2.51.0