From 140a84ba8ac1e6548ab63ff586cf214d87f727a4 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 28 Oct 2022 21:57:02 -0700 Subject: [PATCH] Auto-detect windows signing stuff Still build installers even without signing key Signed-off-by: Keith Packard --- altosui/Makefile.am | 10 +++++----- configure.ac | 20 ++++++++++++++++++++ micropeak/Makefile.am | 9 +++++---- telegps/Makefile.am | 9 +++++---- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/altosui/Makefile.am b/altosui/Makefile.am index c2df5de7..41f0d6ad 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -1,5 +1,4 @@ # location of code signing key, et al -CODEKEYDIR=~/altusmetrumllc/ssl.com JAVAROOT=classes AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked @@ -413,7 +412,8 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile $(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi Instdrv/NSIS/Includes/java.nsh -rm -f $@ makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi || (cat altos-windows.log && exit 1) - jsign --keystore $(CODEKEYDIR)/altus_metrum,_llc.p12 --alias 1 \ - --storetype PKCS12 --storepass `cat $(CODEKEYDIR)/password` \ - --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ - + if [ "$(HAVE_WINDOWS_KEY)" = "yes" ]; then \ + jsign --keystore "$(WINDOWSKEYFILE)" --alias 1 \ + --storetype PKCS12 --storepass `cat "$(WINDOWSKEYPASSFILE)"` \ + --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ ; \ + fi diff --git a/configure.ac b/configure.ac index d4164741..b0de2d55 100644 --- a/configure.ac +++ b/configure.ac @@ -200,6 +200,22 @@ else HAVE_GOOGLE_KEY="no" fi +AC_ARG_WITH(windows-key, AS_HELP_STRING([--with-windows-key=PATH], + [Set the file containing the Windows installer signing key (defaults to ~/altusmetrumllc/ssl.com/altus_metrum,_llc.p12)]), + [WINDOWSKEYFILE="$withval"], [WINDOWSKEYFILE=$HOME/altusmetrumllc/ssl.com/altus_metrum,_llc.p12]) + +AC_ARG_WITH(windows-key-pass, AS_HELP_STRING([--with-windows-key-pass=PATH], + [Set the file containing the Windows installer signing key password (defaults to ~/altusmetrumllc/ssl.com/password)]), + [WINDOWSKEYPASSFILE="$withval"], [WINDOWSKEYPASSFILE=$HOME/altusmetrumllc/ssl.com/password]) + +AC_CHECK_PROG(jsign, jsign, "yes", "no") + +if test -s "$WINDOWSKEYFILE" -a -s "$WINDOWSKEYPASSFILE" -a "$jsign" = yes; then + HAVE_WINDOWS_KEY="yes" +else + HAVE_WINDOWS_KEY="no" +fi + WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs" AC_SUBST(WARN_CFLAGS) @@ -210,6 +226,9 @@ AC_ARG_ENABLE(faketime, AS_HELP_STRING([--enable-faketime], AM_CONDITIONAL(FAKETIME, [test x$FAKETIME = xyes]) AC_SUBST(GOOGLEKEY) +AC_SUBST(WINDOWSKEYFILE) +AC_SUBST(WINDOWSKEYPASSFILE) +AC_SUBST(HAVE_WINDOWS_KEY) AC_PROG_CC AC_PROG_INSTALL @@ -585,6 +604,7 @@ echo " jfreechart..................: ${JFREECHART}" echo " jcommon.....................: ${JCOMMON}" echo " JVM include.................: ${JVM_INCLUDE}" echo " AltosDroid maps API key.....: ${HAVE_GOOGLE_KEY}" +echo " Windows installer key.......: ${HAVE_WINDOWS_KEY}" if test x${ANDROID_SDK} != "xno"; then echo "" echo " Android path" diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index 017f5348..bd938e25 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -1,5 +1,4 @@ # location of code signing key, et al -CODEKEYDIR=~/altusmetrumllc/ssl.com JAVAROOT=classes AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked @@ -348,9 +347,11 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(WINDOWS_DIST): $(WINDOWS_FILES) micropeak-windows.nsi -rm -f $@ makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi || (cat micropeak-windows.log && exit 1) - jsign --keystore $(CODEKEYDIR)/altus_metrum,_llc.p12 --alias 1 \ - --storetype PKCS12 --storepass `cat $(CODEKEYDIR)/password` \ - --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ + if [ "$(HAVE_WINDOWS_KEY)" = "yes" ]; then \ + jsign --keystore "$(WINDOWSKEYFILE)" --alias 1 \ + --storetype PKCS12 --storepass `cat "$(WINDOWSKEYPASSFILE)"` \ + --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ ; \ + fi Manifest.txt: Makefile echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@ diff --git a/telegps/Makefile.am b/telegps/Makefile.am index 067df0c7..9388f3ba 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -1,5 +1,4 @@ # location of code signing key, et al -CODEKEYDIR=~/altusmetrumllc/ssl.com JAVAROOT=classes AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked @@ -340,9 +339,11 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile $(WINDOWS_DIST): $(WINDOWS_FILES) telegps-windows.nsi -rm -f $@ makensis -Otelegps-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" telegps-windows.nsi || (cat telegps-windows.log && exit 1) - jsign --keystore $(CODEKEYDIR)/altus_metrum,_llc.p12 --alias 1 \ - --storetype PKCS12 --storepass `cat $(CODEKEYDIR)/password` \ - --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ + if [ "$(HAVE_WINDOWS_KEY)" = "yes" ]; then \ + jsign --keystore "$(WINDOWSKEYFILE)" --alias 1 \ + --storetype PKCS12 --storepass `cat "$(WINDOWSKEYPASSFILE)"` \ + --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ ; \ + fi Manifest.txt: Makefile echo 'Main-Class: org.altusmetrum.telegps.TeleGPS' > $@ -- 2.30.2