Mercurial > HandyFTP
changeset 126:a7da6b5e55da
GTK: Changes to use GResources to embed the images files into the binary.
Needed to create a resources.sh script similar to the finishup.sh script on
Mac.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Sun, 29 Nov 2020 02:34:34 -0600 |
parents | a68353fac6eb |
children | 8baca19f709d |
files | src/Makefile.in src/configure src/configure.in src/gtk/handyftp.gresource.xml src/gtk/resources.sh |
diffstat | 5 files changed, 137 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.in Mon Oct 05 23:41:59 2020 -0500 +++ b/src/Makefile.in Sun Nov 29 02:34:34 2020 -0600 @@ -5,10 +5,12 @@ CC = @CC@ RM = @RM@ CP = @CP@ +GRC = @GRC@ MAKE = @MAKE@ MKDIR = @MKDIR@ INSTALL = @INSTALL@ PREFIX = @prefix@ +GRESOURCE = @GRESOURCE@ TARGET = handyftp DISPLAYNAME = HandyFTP @@ -32,7 +34,14 @@ $(CC) $(CFLAGS) $(INCLUDES) -c $< resources.o: +ifeq ($(GRESOURCE),enabled) + -chmod +x gtk/resources.sh + -gtk/resources.sh + $(GRC) --generate-source --target=gresources.c gtk/handyftp.gresource.xml + $(CC) $(CFLAGS) $(INCLUDES) -c gresources.c -o resources.o +else $(CC) $(CFLAGS) $(INCLUDES) -c gtk/resources.c +endif $(TARGET): $(OBJECTS) resources.o $(CC) $(CFLAGS) $(INCLUDES) -o $(TARGET) $(OBJECTS) resources.o $(LDFLAGS) $(LIBS) @@ -44,10 +53,12 @@ -mac/installer.sh "$(DISPLAYNAME)" "$(TARGET)" clean: - $(RM) $(OBJECTS) resources.o $(TARGET) + $(RM) $(OBJECTS) resources.o gresources.c $(TARGET) + $(RM) -rf resources/ distclean: - $(RM) $(OBJECTS) resources.o $(TARGET) *~ os2/*~ win/*~ gtk/*~ config.cache config.log config.status Makefile config.h + $(RM) $(OBJECTS) resources.o gresources.c $(TARGET) *~ os2/*~ win/*~ gtk/*~ config.cache config.log config.status Makefile config.h + $(RM) -rf resources/ install: $(RM) -rf $(PREFIX)/share/$(TARGET) @@ -66,7 +77,7 @@ $(INSTALL) gtk/org.dbsoft.handyftp.desktop $(PREFIX)/share/applications/ $(INSTALL) ../readme.txt $(PREFIX)/share/$(TARGET) -resources.o: gtk/resources.c +resources.o: gtk/resources.c gtk/handyftp.gresource.xml handyftp.o: handyftp.c handyftp.h hftpextr.h site.h config.h datetime.o: datetime.c datetime.h
--- a/src/configure Mon Oct 05 23:41:59 2020 -0500 +++ b/src/configure Sun Nov 29 02:34:34 2020 -0600 @@ -621,6 +621,7 @@ ac_subst_vars='LTLIBOBJS LIBOBJS +GRESOURCE ARCH MKDIR MV @@ -643,6 +644,7 @@ build_vendor build_cpu build +GRC INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM @@ -1330,7 +1332,7 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-arch specify architecture: one of all, 32bit, 64bit, intel, ppc, ppc64, x86_64, i386 + --with-arch specify MacOS architecture: one of modern, all, 32bit, 64bit, intel, arm, ppc, ppc64, x86_64, i386 Some influential environment variables: CC C compiler command @@ -3160,6 +3162,45 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +# Extract the first word of "glib-compile-resources", so it can be a program name with args. +set dummy glib-compile-resources; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_GRC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$GRC"; then + ac_cv_prog_GRC="$GRC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_GRC="glib-compile-resources" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +GRC=$ac_cv_prog_GRC +if test -n "$GRC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GRC" >&5 +$as_echo "$GRC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + # Make sure we can run config.sub. @@ -3866,6 +3907,7 @@ LIBS=`dwindows-config --libs` CFLAGS=`dwindows-config --cflags` +GRESOURCE=`dwindows-config --gresource` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dw_main in -ldwindows" >&5 $as_echo_n "checking for dw_main in -ldwindows... " >&6; } @@ -4234,17 +4276,26 @@ ARCH="" ;; all) - ARCH="-arch ppc -arch ppc64 -arch x86_64 -arch i386" + ARCH="-arch ppc -arch ppc64 -arch x86_64 -arch i386 -arch arm64" ;; 32bit) ARCH="-arch ppc -arch i386" ;; 64bit) - ARCH="-arch ppc64 -arch x86_64" + ARCH="-arch ppc64 -arch x86_64 -arch arm64" ;; intel) ARCH="-arch i386 -arch x86_64" ;; + powerpc) + ARCH="-arch ppc -arch ppc64" + ;; + arm) + ARCH="-arch arm64" + ;; + modern) + ARCH="-arch x86_64 -arch arm64" + ;; *) ARCH="-arch $with_arch" ;; @@ -4270,6 +4321,8 @@ + + ac_config_files="$ac_config_files Makefile gtk/org.dbsoft.handyftp.desktop" cat >confcache <<\_ACEOF
--- a/src/configure.in Mon Oct 05 23:41:59 2020 -0500 +++ b/src/configure.in Sun Nov 29 02:34:34 2020 -0600 @@ -20,14 +20,17 @@ AC_PROG_INSTALL +AC_CHECK_PROG(GRC, glib-compile-resources, glib-compile-resources) + AC_SUBST(MAKE) +AC_SUBST(GRC) dnl Checks for system AC_CANONICAL_SYSTEM dnl ---------------------- check for '--with-arch' switch ----------------- AC_ARG_WITH(arch, - [ --with-arch specify architecture: one of all, 32bit, 64bit, intel, ppc, ppc64, x86_64, i386], + [ --with-arch specify MacOS architecture: one of modern, all, 32bit, 64bit, intel, arm, ppc, ppc64, x86_64, i386], [with_arch=$withval], [with_arch=no], ) @@ -39,6 +42,7 @@ LIBS=`dwindows-config --libs` CFLAGS=`dwindows-config --cflags` +GRESOURCE=`dwindows-config --gresource` AC_CHECK_LIB(dwindows, dw_main,LIBS="$LIBS",AC_MSG_ERROR(Dynamic Windows library not found. HandyFTP cannot build without it.)) @@ -72,17 +76,26 @@ ARCH="" ;; all) - ARCH="-arch ppc -arch ppc64 -arch x86_64 -arch i386" + ARCH="-arch ppc -arch ppc64 -arch x86_64 -arch i386 -arch arm64" ;; 32bit) ARCH="-arch ppc -arch i386" ;; 64bit) - ARCH="-arch ppc64 -arch x86_64" + ARCH="-arch ppc64 -arch x86_64 -arch arm64" ;; intel) ARCH="-arch i386 -arch x86_64" ;; + powerpc) + ARCH="-arch ppc -arch ppc64" + ;; + arm) + ARCH="-arch arm64" + ;; + modern) + ARCH="-arch x86_64 -arch arm64" + ;; *) ARCH="-arch $with_arch" ;; @@ -108,6 +121,8 @@ AC_SUBST(ARCH) +AC_SUBST(GRESOURCE) + AC_CONFIG_FILES([ Makefile gtk/org.dbsoft.handyftp.desktop ])
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gtk/handyftp.gresource.xml Sun Nov 29 02:34:34 2020 -0600 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/dbsoft/dwindows/"> + <file>resources/269.png</file> + <file>resources/349.png</file> + <file>resources/309.png</file> + <file>resources/335.png</file> + <file>resources/336.png</file> + <file>resources/288.png</file> + <file>resources/356.png</file> + <file>resources/346.png</file> + <file>resources/357.png</file> + <file>resources/155.png</file> + <file>resources/268.png</file> + <file>resources/365.png</file> + <file>resources/1300.png</file> + <file>resources/355.png</file> + <file>resources/290.png</file> + <file>resources/337.png</file> + <file>resources/353.png</file> + <file>resources/350.png</file> + <file>resources/338.png</file> + <file>resources/351.png</file> + </gresource> +</gresources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gtk/resources.sh Sun Nov 29 02:34:34 2020 -0600 @@ -0,0 +1,24 @@ +#!/bin/sh +mkdir -p "resources" + + cp -f mac/logo.png "resources/1300.png" + cp -f mac/handyftp.png "resources/155.png" + cp -f mac/exit.png "resources/288.png" + cp -f mac/connect.png "resources/335.png" + cp -f mac/disconnect.png "resources/336.png" + cp -f mac/queue.png "resources/337.png" + cp -f mac/unqueue.png "resources/338.png" + cp -f mac/flush.png "resources/346.png" + cp -f mac/save.png "resources/350.png" + cp -f mac/unsave.png "resources/351.png" + cp -f mac/admin.png "resources/349.png" + cp -f mac/change.png "resources/309.png" + cp -f mac/help.png "resources/268.png" + cp -f mac/about.png "resources/269.png" + cp -f mac/preferences.png "resources/290.png" + cp -f mac/remtab.png "resources/353.png" + cp -f mac/newtab.png "resources/355.png" + cp -f mac/FILE.png "resources/356.png" + cp -f mac/FOLDER.png "resources/357.png" + cp -f mac/LINK.png "resources/365.png" +