about summary refs log tree commit diff
path: root/pkgs/by-name/gt
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2023-12-30 12:00:08 -0300
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-12-30 12:18:38 -0300
commitd76236da522f95e8728151a54b7371b77b7dbdb3 (patch)
tree126d5286c10cf17242109ee9c465840ef1b34916 /pkgs/by-name/gt
parent2aca1fc81d8e85c9d5a7136edd4afb66eed42aad (diff)
gtklp: migrate to by-name
Diffstat (limited to 'pkgs/by-name/gt')
-rw-r--r--pkgs/by-name/gt/gtklp/package.nix57
-rw-r--r--pkgs/by-name/gt/gtklp/patches/autoconf.patch23
-rw-r--r--pkgs/by-name/gt/gtklp/patches/mdv-fix-str-fmt.patch22
3 files changed, 102 insertions, 0 deletions
diff --git a/pkgs/by-name/gt/gtklp/package.nix b/pkgs/by-name/gt/gtklp/package.nix
new file mode 100644
index 0000000000000..af98ed1ae1b73
--- /dev/null
+++ b/pkgs/by-name/gt/gtklp/package.nix
@@ -0,0 +1,57 @@
+{ stdenv, lib, fetchurl
+, autoreconfHook, libtool, pkg-config
+, gtk2, glib, cups, gettext, openssl
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gtklp";
+  version = "1.3.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/${pname}/${pname}-${version}.src.tar.gz";
+    sha256 = "1arvnnvar22ipgnzqqq8xh0kkwyf71q2sfsf0crajpsr8a8601xy";
+  };
+
+  nativeBuildInputs = [
+    pkg-config
+    autoreconfHook
+  ];
+
+  buildInputs = [
+    cups
+    gettext
+    glib
+    gtk2
+    libtool
+    openssl
+  ];
+
+  patches = [
+    ./patches/mdv-fix-str-fmt.patch
+    ./patches/autoconf.patch
+  ];
+
+  # Workaround build failure on -fno-common toolchains:
+  #   ld: libgtklp.a(libgtklp.o):libgtklp/libgtklp.h:83: multiple definition of `progressBar';
+  #     file.o:libgtklp/libgtklp.h:83: first defined here
+  env.NIX_CFLAGS_COMPILE = "-fcommon";
+
+  preConfigure = ''
+    substituteInPlace include/defaults.h --replace "netscape" "firefox"
+    substituteInPlace include/defaults.h --replace "http://localhost:631/sum.html#STANDARD_OPTIONS" \
+                                                   "http://localhost:631/help/"
+  '';
+
+  preInstall = ''
+    install -D -m0644 -t $out/share/doc AUTHORS BUGS ChangeLog README USAGE
+  '';
+
+  meta = with lib; {
+    description = "A graphical frontend for CUPS";
+    homepage = "https://gtklp.sirtobi.com";
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ caadar ];
+    platforms = platforms.unix;
+  };
+
+}
diff --git a/pkgs/by-name/gt/gtklp/patches/autoconf.patch b/pkgs/by-name/gt/gtklp/patches/autoconf.patch
new file mode 100644
index 0000000000000..c1698bee1fdc0
--- /dev/null
+++ b/pkgs/by-name/gt/gtklp/patches/autoconf.patch
@@ -0,0 +1,23 @@
+Patch origin: http://sophie.zarb.org/rpms/68e90a72e0052022f558148d97c9ea2a/files/3
+
+diff --git a/configure.ac b/configure.ac
+index b7a30e9..3768ae9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -8,6 +8,7 @@ AC_CONFIG_HEADERS([config.h])
+ 
+ AC_CONFIG_MACRO_DIR([m4])
+ AM_GNU_GETTEXT([external])
++AM_GNU_GETTEXT_REQUIRE_VERSION([0.21])
+ 
+ dnl Extra params
+ CUPSCONFIGPATH=""
+@@ -30,8 +31,6 @@ AC_SUBST(XLIBS)
+ 
+ dnl Checks for header files
+ 
+-dnl internationalization macros
+-AM_GNU_GETTEXT
+ 
+ 
+ # Forte Compiler ############################################################
diff --git a/pkgs/by-name/gt/gtklp/patches/mdv-fix-str-fmt.patch b/pkgs/by-name/gt/gtklp/patches/mdv-fix-str-fmt.patch
new file mode 100644
index 0000000000000..6cfc90beb02a8
--- /dev/null
+++ b/pkgs/by-name/gt/gtklp/patches/mdv-fix-str-fmt.patch
@@ -0,0 +1,22 @@
+Patch source: http://sophie.zarb.org/rpms/68e90a72e0052022f558148d97c9ea2a/files/1
+
+--- a/libgtklp/libgtklp.c	2020-08-25 17:31:52.427298559 +0100
++++ b/libgtklp/libgtklp.c	2020-08-25 17:36:37.728154682 +0100
+@@ -939,7 +939,7 @@
+ 		gtk_widget_show(pixmapwid);
+ 
+ 		if (strlen(gerror2) == 0)
+-			snprintf(tmplabel, (size_t) MAXLINE, gerror1);
++			snprintf(tmplabel, (size_t) MAXLINE, "%s", gerror1);
+ 		else
+ 			snprintf(tmplabel, (size_t) MAXLINE, gerror1, gerror2);
+ 		label = gtk_label_new(tmplabel);
+@@ -973,7 +973,7 @@
+ #endif
+ 	} else {
+ 		if (strlen(gerror2) == 0)
+-			g_warning(gerror1);
++			g_warning("%s", gerror1);
+ 		else
+ 			g_warning(gerror1, gerror2);
+ 	}