Skip to content

Commit d57e971

Browse files
committed
Implement --enable-windows-installer based on --enable-app-bundle
1 parent 4d9981d commit d57e971

File tree

5 files changed

+86
-4
lines changed

5 files changed

+86
-4
lines changed

Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ doc:
123123

124124
.PHONY: doc
125125

126+
if ENABLE_WINDOWS_INSTALLER
127+
nsis: install
128+
$(MAKE) -C data/nsis $@
129+
else
130+
nsis:
131+
@echo "You have to run './configure --enable-windows-installer' first!"; false
132+
endif
133+
.PHONY: nsis
134+
126135
.NOTPARALLEL: install
127136

128137
# remove pkgdatadir and docdir (if empty)

configure.ac

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,23 @@ ENABLE_AUTO([isatty], [support for isatty()],
713713
AC_SEARCH_LIBS([isatty], , , [have_isatty=no])
714714
])
715715

716+
dnl trying to mimic the default setting
717+
pkgdatadir='${datadir}/${PACKAGE}'
718+
719+
ENABLE_EXPLICIT([windows-installer], [creation of an installer for Windows],
720+
[
721+
AC_CHECK_PROG([have_nsis], [nsis], [yes], [no])
722+
AS_IF([test x$enable_app_bundle = xyes -o x$enable_app_bundle = x],
723+
[WINDOWS_INSTALLER=SoundScapeRenderer-$PACKAGE_VERSION],
724+
[WINDOWS_INSTALLER=$enable_windows_installer])
725+
726+
dnl WARNING: any user-specified --prefix, --bindir, ... is overwritten!
727+
dnl however, it can still be specified at make time (although kinda useless)!
728+
prefix=$(pwd)/windows-installer
729+
docdir=\${prefix}/Documentation
730+
pkgdatadir=\${prefix}/PkgData
731+
])
732+
716733
ENABLE_AUTO([browser-gui], [creation of HTML/JavaScript files for browser GUI],
717734
[
718735
AC_ARG_VAR([YARN], [Yarn package manager command])
@@ -734,14 +751,17 @@ ENABLE_AUTO([browser-gui], [creation of HTML/JavaScript files for browser GUI],
734751
])
735752
])
736753

754+
AC_SUBST(WINDOWS_INSTALLER)
755+
AC_SUBST(pkgdatadir)
756+
737757
AC_SUBST(OPT_FLAGS)
738758
AC_SUBST(PKG_FLAGS)
739759
AC_SUBST(WARNING_FLAGS)
740760
AC_SUBST(DEBUGGING_FLAGS)
741761

742762
dnl List of output files generated by AC_OUTPUT from their respective *.in files
743763
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile browser-gui/Makefile])
744-
AC_CONFIG_FILES([tests/Makefile data/Makefile])
764+
AC_CONFIG_FILES([tests/Makefile data/Makefile data/nsis/Makefile])
745765

746766
dnl AC_OUTPUT should be the last command (except maybe some status messages)
747767
dnl It generates and runs config.status, which in turn creates the Makefiles and
@@ -801,7 +821,13 @@ echo "| Network: legacy/WebSocket/FUDI ......... : $have_ip_interface/$have_webs
801821
echo "| Qt GUI/Browser GUI ..................... : $have_gui/$have_browser_gui"
802822
echo "|"
803823
echo "| Enable debugging/optimization .......... : $have_debugging/$have_optimization"
824+
AS_IF([test x$have_windows_installer = xyes],
825+
[
826+
echo "| Installer for Windows .................. : $WINDOWS_INSTALLER"
827+
],
828+
[
804829
echo "| Install prefix ......................... : $prefix"
830+
])
805831

806832
AS_IF([test x$have_ecasound = xyes -a x$have_ecasound_program != xyes],
807833
[
@@ -815,8 +841,20 @@ AS_IF([test x$have_manpages != xyes],
815841
echo "|> WARNING: help2man was not found!"
816842
echo "|> Disabling building of manpages"
817843
])
844+
AS_IF([test x$have_windows_installer = xyes -a x$have_nsis != xyes],
845+
[
846+
echo "|"
847+
echo "|> WARNING: NSIS was not found!"
848+
echo "|> It is needed for creating the Windows installer."
849+
])
818850

819851
echo "|"
820852
echo
853+
AS_IF([test x$have_windows_installer = xyes],
854+
[
855+
echo 'If everything looks OK, continue with "make" and "make nsis".'
856+
],
857+
[
821858
echo 'If everything looks OK, continue with "make" and "make install".'
859+
])
822860
echo

data/Makefile.am

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@
77

88
dist_bin_SCRIPTS = ssr
99

10+
if ENABLE_WINDOWS_INSTALLER
11+
SUBDIRS = nsis
12+
extrasdir = $(prefix)/Extras
13+
scenesdir = $(prefix)/Scenes
14+
15+
## these are always distributed, but only installed if ENABLE_APP_BUNDLE
16+
dist_scenes_DATA = \
17+
scenes/asdf2html.xsl \
18+
scenes/live_input.asd
19+
else
1020
extrasdir = $(pkgdatadir)
21+
endif
1122

1223
## stuff that will end up in $prefix/share/ssr/
1324
nobase_dist_pkgdata_DATA = \
@@ -33,7 +44,7 @@ nobase_dist_pkgdata_DATA = \
3344
## the whole directory is distributed, including browser GUI files
3445
EXTRA_DIST = websocket_resources
3546

36-
## stuff that will end up in $prefix/share/ssr/
47+
## stuff that will end up in $extrasdir
3748
nobase_dist_extras_DATA = \
3849
reproduction_setups/2.0.asd \
3950
reproduction_setups/2.1.asd \
@@ -85,17 +96,20 @@ dist_noinst_SCRIPTS = local_ssr.sh
8596
##dist-hook:
8697
## ...
8798

99+
# https://stackoverflow.com/q/63018330#comment111445661_63020485
100+
HASH := \#
101+
88102
# compute relative path between $(pkgdatadir) and $(extrasdir)
89103
REL_LINK_DIR = $(shell \
90104
target="${extrasdir}"; \
91105
common_part="${pkgdatadir}"; \
92106
if test "x$$target" = "x$$common_part"; then echo .; exit; fi; \
93107
back= ; \
94-
while test "x$${target\#$$common_part}" = "x$$target"; do \
108+
while test "x$${target$(HASH)$$common_part}" = "x$$target"; do \
95109
common_part="`dirname "$$common_part"`"; \
96110
back="../$$back" ; \
97111
done; \
98-
echo "$${back}$${target\#$$common_part/}")
112+
echo "$${back}$${target$(HASH)$$common_part/}")
99113

100114
# create symbolic links in the install directory (for default files) and
101115
# before that, remove old symbolic links

data/nsis/Makefile.am

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## This file will be processed by automake (which is called by autogen.sh) to
2+
## generate Makefile.in, which in turn will be processed by configure to
3+
## generate Makefile.
4+
5+
## comments starting with a single # are copied to Makefile.in (and afterwards
6+
## to Makefile), comments with ## are dropped.
7+
8+
## This file is only taken into account if --enable-windows-installer was chosen!
9+
if ENABLE_WINDOWS_INSTALLER
10+
11+
# create Windows installer
12+
nsis:
13+
@echo "TODO: run NSIS!"
14+
15+
.PHONY: nsis
16+
17+
endif

src/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ AM_CPPFLAGS += -I$(srcdir)/../apf
2525
AM_CPPFLAGS += -I$(srcdir)/../gml/include
2626
AM_CPPFLAGS += -I$(srcdir)/../rapidjson/include
2727

28+
if ENABLE_WINDOWS_INSTALLER
29+
AM_CPPFLAGS += -DSSR_DATA_DIR=\"PkgData\"
30+
else
2831
AM_CPPFLAGS += -DSSR_DATA_DIR="\"$(pkgdatadir)\""
32+
endif
2933

3034
## this is somehow needed for Solaris (or not?)
3135
AM_CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS

0 commit comments

Comments
 (0)