Re: [External] Re: PKG_LIB_DIR/PKGMODULEDIR expansion issues
"Matsumura, George" <[email protected]> Sat, 16 Jul 2022 14:50:57 -0600
| Newsgroups | gmane.linux.printing.gimp-print.devel |
|---|---|
| Message-ID | <[email protected]> |
On 7/16/22 12:35, Robert Krawitz wrote:
> Use caution with links and attachments.
>
> On 7/16/22 06:31, Matsumura, George wrote:
>> Greetings,
>>
>> In order to solve the mentioned issues, I was able to create the
>> attached prefix_defines.patch which moves the expansion of the ${prefix}
>> and ${exec_prefix} variables to build time through make as opposed to
>> configure time through autoconf. This is in accordance with the
>> suggestion here:
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.gnu.org%2Fsoftware%2Fautoconf%2Fmanual%2Fautoconf-2.67%2Fhtml_node%2FInstallation-Directory-Variables.html&data=05%7C01%7Cgm960420%40ohio.edu%7Cd5739f5c4e0849c0cc9d08da6759f501%7Cf3308007477c4a70888934611817c55a%7C0%7C0%7C637935933315176710%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wGuU%2BC4NHgTFiYTVdXWLI7IrRjhH9eIohyppPYlsB0Y%3D&reserved=0
>
> George,
>
> Could you regenerate these patches with 'git format-patch' so that the authorship will be properly
> preserved? Thanks!
Certainly. Thank you for reviewing them.
Regards,
George
_______________________________________________
Gimp-print-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gimp-print-devel
0002-core-Use-correct-function-to-find-printer-list-lengt.patch
(text/x-patch, 1.1 KB)
From 927a1bb3e848f9bb5c6e15fe78526e295d76c9ab Mon Sep 17 00:00:00 2001 From: George Matsumura <[email protected]> Date: Sat, 16 Jul 2022 14:47:35 -0600 Subject: [PATCH 2/2] core: Use correct function to find printer list length By using stp_printer_model_count instead of stp_list_get_length, the list is created in the case when no modules were found and the list did not exist before. This prevents a segfault and prints a helpful warning message. --- src/main/printers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/printers.c b/src/main/printers.c index 0a35ca08..389d2bc6 100644 --- a/src/main/printers.c +++ b/src/main/printers.c @@ -966,7 +966,10 @@ compare_names(const void *n1, const void *n2) void stpi_find_duplicate_printers(void) { - size_t nelts = stp_list_get_length(printer_list); + size_t nelts = stp_printer_model_count(); + if (nelts == 0) + return; + const char **str_data = stp_zalloc(sizeof(const char *) * nelts); stp_list_item_t *printer_item = stp_list_get_start(printer_list); size_t i = 0; -- 2.37.1
0001-build-Move-expansion-of-pathnames-to-build-time.patch
(text/x-patch, 5.9 KB)
From ea816fc4f1e2650df27907d17345f07a27c02153 Mon Sep 17 00:00:00 2001 From: George Matsumura <[email protected]> Date: Sat, 16 Jul 2022 14:46:47 -0600 Subject: [PATCH 1/2] build: Move expansion of pathnames to build time This corrects errors in expansion encountered under the previous scheme, and is in line with autoconf recommendations. --- configure.ac | 82 +++++++---------------------------------------- scripts/global.mk | 2 +- 2 files changed, 13 insertions(+), 71 deletions(-) diff --git a/configure.ac b/configure.ac index 2b1cd098..dc0f8f67 100644 --- a/configure.ac +++ b/configure.ac @@ -671,81 +671,17 @@ GUTENPRINT_BASE_VERSION=${GUTENPRINT_MAJOR_VERSION}.${GUTENPRINT_MINOR_VERSION}. AH_TEMPLATE(GUTENPRINT_BASE_VERSION,, [Gutenprint base version]) AC_DEFINE_UNQUOTED(GUTENPRINT_BASE_VERSION, "${GUTENPRINT_BASE_VERSION}") -dnl Set PACKAGE_LOCALE_DIR in config.h -AH_TEMPLATE(PACKAGE_LOCALE_DIR,, [Package locale directory]) -if test "x${prefix}" = "xNONE"; then - AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, ["${ac_default_prefix}/share/locale"]) -else - AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, ["${prefix}/share/locale"]) -fi +PACKAGE_LOCALE_DIR="${prefix}/share/locale" -dnl Set PACKAGE_DATA_DIR in config.h. -AH_TEMPLATE(PACKAGE_DATA_DIR,, [Package data directory]) -if test "x${datadir}" = 'x${prefix}/share'; then - if test "x${prefix}" = "xNONE"; then - PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}" - else - PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}" - fi -elif test "x${datadir}" = 'x${datarootdir}'; then - if test "x${datarootdir}" = 'x${prefix}/share'; then - if test "x${prefix}" = "xNONE"; then - PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}" - else - PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}" - fi - else - PACKAGE_DATA_DIR="${datarootdir}/${PACKAGE}" - fi -else - PACKAGE_DATA_DIR="${datadir}/${PACKAGE}" -fi +PACKAGE_DATA_DIR="${datadir}/${PACKAGE}" -AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${PACKAGE_DATA_DIR}") - -dnl Set PACKAGE_LIB_DIR in config.h. -AH_TEMPLATE(PACKAGE_LIB_DIR,, [Package lib directory]) -if test "x${libdir}" = 'x${exec_prefix}/lib'; then - if test "x${exec_prefix}" = "xNONE"; then - if test "x${prefix}" = "xNONE"; then - PACKAGE_LIB_DIR="${ac_default_prefix}/lib/${PACKAGE}" - else - PACKAGE_LIB_DIR="${prefix}/lib/${PACKAGE}" - fi - else - PACKAGE_LIB_DIR="${exec_prefix}/lib/${PACKAGE}" - fi -else - PACKAGE_LIB_DIR="${libdir}/${PACKAGE}" -fi - -AC_DEFINE_UNQUOTED(PACKAGE_LIB_DIR, ["${PACKAGE_LIB_DIR}"]) - -dnl Set PACKAGE_BIN_DIR in config.h. -AH_TEMPLATE(PACKAGE_BIN_DIR,, [Package bin directory]) -if test "x${bindir}" = 'x${exec_prefix}/bin'; then - if test "x${exec_prefix}" = "xNONE"; then - if test "x${prefix}" = "xNONE"; then - PACKAGE_BIN_DIR="${ac_default_prefix}/bin" - else - PACKAGE_BIN_DIR="${prefix}/bin" - fi - else - PACKAGE_BIN_DIR="${exec_prefix}/bin" - fi -else - PACKAGE_BIN_DIR="${bindir}" -fi +PACKAGE_LIB_DIR="${libdir}/${PACKAGE}" -AC_DEFINE_UNQUOTED(PACKAGE_BIN_DIR, ["${PACKAGE_BIN_DIR}"]) +PACKAGE_BIN_DIR="${bindir}" -AH_TEMPLATE(PKGXMLDATADIR,, [Package XML data directory]) PKGXMLDATADIR="${PACKAGE_DATA_DIR}/${GUTENPRINT_RELEASE_VERSION}/xml" -AC_DEFINE_UNQUOTED(PKGXMLDATADIR, ["$PKGXMLDATADIR"], ) -AH_TEMPLATE(PKGMODULEDIR,, [Package module directory]) PKGMODULEDIR="${PACKAGE_LIB_DIR}/${GUTENPRINT_RELEASE_VERSION}/modules" -AC_DEFINE_UNQUOTED(PKGMODULEDIR, ["$PKGMODULEDIR"]) dnl Compiler flags if test x$ac_compiler_gnu = "xyes"; then @@ -1107,6 +1043,12 @@ AC_SUBST(GUTENPRINT_RELEASE_VERSION) AC_SUBST(LIBUSB_BACKEND_LIBDEPS) AC_SUBST(PKGROOT) AC_SUBST(MINIMAL_PRINTERS_TO_TEST) +AC_SUBST(PACKAGE_LOCALE_DIR) +AC_SUBST(PACKAGE_DATA_DIR) +AC_SUBST(PACKAGE_LIB_DIR) +AC_SUBST(PACKAGE_BIN_DIR) +AC_SUBST(PKGXMLDATADIR) +AC_SUBST(PKGMODULEDIR) dnl Optional architecture options to be applied after all autoconf tests dnl are done... @@ -1252,10 +1194,10 @@ echo " Installation prefix: $prefix" |tee -a config.su # Configure intentionally does not expand exec_prefix to allow make # to do so. echo " Exec prefix: `eval eval echo $exec_prefix` ($exec_prefix)" |tee -a config.summary -echo " Data directory: $PACKAGE_DATA_DIR" |tee -a config.summary +echo " Data directory: `eval eval echo $PACKAGE_DATA_DIR` ($PACKAGE_DATA_DIR)" |tee -a config.summary echo " Library directory: `eval eval echo $PACKAGE_LIB_DIR` ($PACKAGE_LIB_DIR)" |tee -a config.summary echo " Executable directory: `eval eval echo $PACKAGE_BIN_DIR` ($PACKAGE_BIN_DIR)" |tee -a config.summary -echo " XML data directory: $PKGXMLDATADIR" |tee -a config.summary +echo " XML data directory: `eval eval echo $PKGXMLDATADIR` ($PKGXMLDATADIR)" |tee -a config.summary echo " Module directory: `eval eval echo $PKGMODULEDIR` ($PKGMODULEDIR)" |tee -a config.summary echo " Install sample images: $INSTALL_SAMPLES" |tee -a config.summary echo |tee -a config.summary diff --git a/scripts/global.mk b/scripts/global.mk index c4054826..792b8b0d 100644 --- a/scripts/global.mk +++ b/scripts/global.mk @@ -6,7 +6,7 @@ #export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main #export STP_DATA_PATH = $(top_srcdir)/src/xml -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) -DPACKAGE_LOCALE_DIR=\"$(PACKAGE_LOCALE_DIR)\" -DPACKAGE_DATA_DIR=\"$(PACKAGE_DATA_DIR)\" -DPACKAGE_LIB_DIR=\"$(PACKAGE_LIB_DIR)\" -DPACKAGE_BIN_DIR=\"$(PACKAGE_BIN_DIR)\" -DPKGMODULEDIR=\"$(PKGMODULEDIR)\" -DPKGXMLDATADIR=\"$(PKGXMLDATADIR)\" LIBS = $(INTLLIBS) @LIBS@ -- 2.37.1