Skip to content

Commit

Permalink
Implement --enable-windows-installer based on --enable-app-bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Jun 11, 2023
1 parent 4d9981d commit 211fd44
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 4 deletions.
9 changes: 9 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ doc:

.PHONY: doc

if ENABLE_WINDOWS_INSTALLER
nsis: install
$(MAKE) -C data/nsis $@
else
nsis:
@echo "You have to run './configure --enable-windows-installer' first!"; false
endif
.PHONY: nsis

.NOTPARALLEL: install

# remove pkgdatadir and docdir (if empty)
Expand Down
40 changes: 39 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,23 @@ ENABLE_AUTO([isatty], [support for isatty()],
AC_SEARCH_LIBS([isatty], , , [have_isatty=no])
])

dnl trying to mimic the default setting
pkgdatadir='${datadir}/${PACKAGE}'

ENABLE_EXPLICIT([windows-installer], [creation of an installer for Windows],
[
AC_CHECK_PROG([have_nsis], [nsis], [yes], [no])
AS_IF([test x$enable_windows_installer = xyes -o x$enable_windows_installer = x],
[WINDOWS_INSTALLER=SoundScapeRenderer-$PACKAGE_VERSION],
[WINDOWS_INSTALLER=$enable_windows_installer])
dnl WARNING: any user-specified --prefix, --bindir, ... is overwritten!
dnl however, it can still be specified at make time (although kinda useless)!
prefix=$(pwd)/windows-installer
docdir=\${prefix}/Documentation
pkgdatadir=\${prefix}/PkgData
])

ENABLE_AUTO([browser-gui], [creation of HTML/JavaScript files for browser GUI],
[
AC_ARG_VAR([YARN], [Yarn package manager command])
Expand All @@ -734,14 +751,17 @@ ENABLE_AUTO([browser-gui], [creation of HTML/JavaScript files for browser GUI],
])
])

AC_SUBST(WINDOWS_INSTALLER)
AC_SUBST(pkgdatadir)

AC_SUBST(OPT_FLAGS)
AC_SUBST(PKG_FLAGS)
AC_SUBST(WARNING_FLAGS)
AC_SUBST(DEBUGGING_FLAGS)

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

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

AS_IF([test x$have_ecasound = xyes -a x$have_ecasound_program != xyes],
[
Expand All @@ -815,8 +841,20 @@ AS_IF([test x$have_manpages != xyes],
echo "|> WARNING: help2man was not found!"
echo "|> Disabling building of manpages"
])
AS_IF([test x$have_windows_installer = xyes -a x$have_nsis != xyes],
[
echo "|"
echo "|> WARNING: NSIS was not found!"
echo "|> It is needed for creating the Windows installer."
])

echo "|"
echo
AS_IF([test x$have_windows_installer = xyes],
[
echo 'If everything looks OK, continue with "make" and "make nsis".'
],
[
echo 'If everything looks OK, continue with "make" and "make install".'
])
echo
20 changes: 17 additions & 3 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@

dist_bin_SCRIPTS = ssr

if ENABLE_WINDOWS_INSTALLER
SUBDIRS = nsis
extrasdir = $(prefix)/Extras
scenesdir = $(prefix)/Scenes

## these are always distributed, but only installed if ENABLE_WINDOWS_INSTALLER
dist_scenes_DATA = \
scenes/asdf2html.xsl \
scenes/live_input.asd
else
extrasdir = $(pkgdatadir)
endif

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

## stuff that will end up in $prefix/share/ssr/
## stuff that will end up in $extrasdir
nobase_dist_extras_DATA = \
reproduction_setups/2.0.asd \
reproduction_setups/2.1.asd \
Expand Down Expand Up @@ -85,17 +96,20 @@ dist_noinst_SCRIPTS = local_ssr.sh
##dist-hook:
## ...

# https://stackoverflow.com/q/63018330#comment111445661_63020485
HASH := \#

# compute relative path between $(pkgdatadir) and $(extrasdir)
REL_LINK_DIR = $(shell \
target="${extrasdir}"; \
common_part="${pkgdatadir}"; \
if test "x$$target" = "x$$common_part"; then echo .; exit; fi; \
back= ; \
while test "x$${target\#$$common_part}" = "x$$target"; do \
while test "x$${target$(HASH)$$common_part}" = "x$$target"; do \
common_part="`dirname "$$common_part"`"; \
back="../$$back" ; \
done; \
echo "$${back}$${target\#$$common_part/}")
echo "$${back}$${target$(HASH)$$common_part/}")

# create symbolic links in the install directory (for default files) and
# before that, remove old symbolic links
Expand Down
17 changes: 17 additions & 0 deletions data/nsis/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## This file will be processed by automake (which is called by autogen.sh) to
## generate Makefile.in, which in turn will be processed by configure to
## generate Makefile.

## comments starting with a single # are copied to Makefile.in (and afterwards
## to Makefile), comments with ## are dropped.

## This file is only taken into account if --enable-windows-installer was chosen!
if ENABLE_WINDOWS_INSTALLER

# create Windows installer
nsis:
@echo "TODO: run NSIS!"

.PHONY: nsis

endif
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ AM_CPPFLAGS += -I$(srcdir)/../apf
AM_CPPFLAGS += -I$(srcdir)/../gml/include
AM_CPPFLAGS += -I$(srcdir)/../rapidjson/include

if ENABLE_WINDOWS_INSTALLER
AM_CPPFLAGS += -DSSR_DATA_DIR=\"PkgData\"
else
AM_CPPFLAGS += -DSSR_DATA_DIR="\"$(pkgdatadir)\""
endif

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

0 comments on commit 211fd44

Please sign in to comment.