Skip to content

Commit

Permalink
* Master/nsis.make: Generalize to install in other than Applications.
Browse files Browse the repository at this point in the history
* Master/rules.make: Remove nsis include for now
* nsi-app.template, Documentation/make.texi: updates.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@25771 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
fedor committed Dec 20, 2007
1 parent 2abb48e commit f2ab885
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 73 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2007-12-20 Adam Fedor <[email protected]>

* Master/nsis.make: Generalize to install in other than Applications.
* Master/rules.make: Remove nsis include for now
* nsi-app.template, Documentation/make.texi: updates.

2007-12-20 Nicola Pero <[email protected]>

* configure.ac: Emit a warning if GNUSTEP_MAKEFILES contains a
Expand Down
14 changes: 10 additions & 4 deletions Documentation/make.texi
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ build using static libraries instead, as in the above command.

Projects are divided into different types described below. To create a
project of a specific type, just include the particular makefile. For
example, to create an application, include this line in your make make
example, to create an application, include this line in your main make
file:

@example
Expand Down Expand Up @@ -486,13 +486,18 @@ on for most targets and into -F../MyPath flag for apple-apple-apple.
@subsection NSIS Installer (@file{nsis.make})

The NSIS make project provides rules for automatically generating NSIS
installers for Windows operating systems. You don't need to do anything
to take advantage of this - it is included automatically by the make system.
installers for Windows operating systems. In order to get this functionality,
include @file{Master/nsis.make} from the Makefiles directory in your
GNUmakefile.

@example
include $(GNUSTEP_MAKEFILES)/Master/nsis.make
@end example

To create an installer file by itself, run @code{make nsifile}. To
create the full installer executable, run @code{make nsis}. Note that in
order to do this, you must be either running on a Windows computer with
a release of the NSIS compiler (from @url{nsis.sourceforge.net}) or you
a release of the NSIS compiler (from @url{http://nsis.sourceforge.net}) or you
need to be using a cross-compiler and cross-compiled NSIS script compiler.
(NOTE: This does not currently work - you need to use the GUI NSIS compiler
to compile the installer scripts).
Expand All @@ -504,6 +509,7 @@ template with customized script instructions by creating a file called
@file{PACKAGE_NAME.nsi.in}, where @code{PACKAGE_NAME} is the same as the
name of your package (see below).

You also need to define several variables in your main make file.
Except for @code{PACKAGE_NAME}, which is required, all the following
variables are optional.

Expand Down
95 changes: 37 additions & 58 deletions Master/nsis.make
Original file line number Diff line number Diff line change
Expand Up @@ -52,98 +52,77 @@
# in your makefile.
MAKENSIS=makensis

# These are the GNUstep Installer locations, so we need to match these
# regardless of the local directories
NSI_SYSTEM_ROOT=\\\\GNUstep\\\\System
NSI_LOCAL_ROOT=\\\\GNUstep\\\\Local
#FIXME: What should this be?
NSI_USER_ROOT=\\\\GNUstep\\\\Local
NSI_DOMAIN=$(NSI_SYSTEM_ROOT)
# the GNUstep Windows Installer always puts things in, e.g. /GNUstep/System,
# so we need to match these regardless of the local filesystem layout
# Hackish way to get the installation dir/domain
NSI_DOMAIN=System
ifeq ($(GNUSTEP_INSTALLATION_DOMAIN), LOCAL)
NSI_DOMAIN=$(NSI_LOCAL_ROOT)
NSI_DOMAIN=Local
endif
# FIXME: What should this be on Windows?
ifeq ($(GNUSTEP_INSTALLATION_DOMAIN), USER)
NSI_DOMAIN=$(NSI_USER_ROOT)
NSI_DOMAIN=Local
endif
NSI_BASE=$(dir $(GNUSTEP_APPS))


#
# Internal targets
#

# If we have been called with something like
#
# make DESTDIR=/var/tmp/package-build nsilist=yes install
#
# we are being called inside the nsis installation stage, and we need
# to produce the file list from the installed files.
#
GNUSTEP_FILE_LIST = $(GNUSTEP_OBJ_DIR)/file-list
GNUSTEP_DELETE_LIST = $(GNUSTEP_OBJ_DIR)/delete-list
GNUSTEP_RMDIR_LIST = $(GNUSTEP_OBJ_DIR)/rmdir-list
ABS_OBJ_DIR=$(shell (cd "$(GNUSTEP_BUILD_DIR)"; pwd))/obj
GNUSTEP_FILE_LIST = $(ABS_OBJ_DIR)/package/file-list
GNUSTEP_DELETE_LIST = $(ABS_OBJ_DIR)/package/delete-list
GNUSTEP_RMDIR_LIST = $(ABS_OBJ_DIR)/package/rmdir-list
REL_INSTALL_DIR=$(GNUSTEP_OBJ_DIR)/package/$(NSI_BASE)

NSI_FILE_NAME=$(PACKAGE_NAME).nsi
;NSI_FILE=$(GNUSTEP_OBJ_DIR)/$(NSI_FILE_NAME)
NSI_FILE=$(NSI_FILE_NAME)
ifneq ($(APP_NAME),)
NSI_TEMPLATE=$(GNUSTEP_MAKEFILES)/nsi-app.template
NSI_INSTALL_DIR=$(GNUSTEP_APPS)
else
NSI_TEMPLATE=
endif
NSI_IN=$(PACKAGE_NAME).nsi.in

ifeq ($(nsilist),yes)
# Remove the old file list before installing, and initialize the new one.
before-install:: $(GNUSTEP_OBJ_DIR)
.PHONY: nsifile nsis nsis_package_install nsis_build_filelist

nsis_package_install:
$(ECHO_NOTHING)if [ -d $(ABS_OBJ_DIR)/package ]; then \
rm -rf $(ABS_OBJ_DIR)/package; fi;$(END_ECHO)
$(ECHO_NOTHING)$(MAKE) DESTDIR=$(ABS_OBJ_DIR)/package nsilist=yes install$(END_ECHO)

#
# Target to build up the file lists
#
nsis_build_filelist::
$(ECHO_NOTHING)rm -f $(GNUSTEP_FILE_LIST)$(END_ECHO)
$(ECHO_NOTHING)rm -f $(GNUSTEP_DELETE_LIST)$(END_ECHO)
$(ECHO_NOTHING)rm -f $(GNUSTEP_RMDIR_LIST)$(END_ECHO)

# Get the list of files inside DESTDIR
internal-after-install::
$(ECHO_NOTHING)cdir="nosuchdirectory"; \
for file in `$(TAR) Pcf - $(NSI_INSTALL_DIR) | $(TAR) t`; do \
wfile=`echo $$file | sed "s,$(NSI_INSTALL_DIR),," | tr '/' '\'`; \
wodir=`echo $(NSI_INSTALL_DIR) | tr '/' '\'`; \
for file in `$(TAR) Pcf - $(REL_INSTALL_DIR) | $(TAR) t`; do \
wfile=`echo $$file | sed "s,$(REL_INSTALL_DIR),," | tr '/' '\'`; \
wodir=`echo $(REL_INSTALL_DIR) | tr '/' '\'`; \
slashsuffix=`basename $${file}yes`; \
if [ "$$slashsuffix" = yes ]; then \
newdir=`dirname $$file`/`basename $$file`; \
else \
newdir=`dirname $$file`; \
fi; \
if [ "$$file" = "$(NSI_INSTALL_DIR)/" ]; then \
if [ "$$file" = "$(REL_INSTALL_DIR)/" ]; then \
:; \
elif [ -d "$$file" ]; then \
cdir=$$newdir; \
echo " RMDir \"\$$APPSDIR$$wfile\"" >> $(GNUSTEP_RMDIR_LIST); \
echo " SetOutPath \"\$$APPSDIR$$wfile\"" >> $(GNUSTEP_FILE_LIST); \
echo " RMDir \"\$$DOMDIR\\$$wfile\"" >> $(GNUSTEP_RMDIR_LIST); \
echo " SetOutPath \"\$$DOMDIR\\$$wfile\"" >> $(GNUSTEP_FILE_LIST); \
elif [ $$cdir != $$newdir ]; then \
cdir=$$newdir; \
wdir=`dirname $$file`; \
wdir=`echo $$wdir | sed "s,$(NSI_INSTALL_DIR),," | tr '/' '\'`; \
echo " SetOutPath \"\$$APPSDIR$$wdir\"" >> $(GNUSTEP_FILE_LIST); \
wdir=`echo $$wdir | sed "s,$(REL_INSTALL_DIR),," | tr '/' '\'`; \
echo " SetOutPath \"\$$DOMDIR\\$$wdir\"" >> $(GNUSTEP_FILE_LIST); \
echo " File \"$$wodir$$wfile\"" >> $(GNUSTEP_FILE_LIST); \
echo " Delete \"\$$APPSDIR$$wfile\"" >> $(GNUSTEP_DELETE_LIST); \
echo " Delete \"\$$DOMDIR\\$$wfile\"" >> $(GNUSTEP_DELETE_LIST); \
else \
echo " Delete \"\$$APPSDIR$$wfile\"" >> $(GNUSTEP_DELETE_LIST); \
echo " Delete \"\$$DOMDIR\\$$wfile\"" >> $(GNUSTEP_DELETE_LIST); \
echo " File \"$$wodir$$wfile\"" >> $(GNUSTEP_FILE_LIST); \
fi; \
done$(END_ECHO)

endif # nsilist == yes

# NB: The nsilist is automatically deleted when GNUSTEP_OBJ_DIR is
# deleted (that is, by make clean)

.PHONY: nsifile nsis nsis_package_install

nsis_package_install:
$(ECHO_NOTHING)if [ -d $(GNUSTEP_OBJ_DIR)/package ]; then \
rm -rf $(GNUSTEP_OBJ_DIR)/package; fi$(END_ECHO)
$(ECHO_NOTHING)$(MKDIRS) $(GNUSTEP_OBJ_DIR)/package$(END_ECHO)
$(ECHO_NOTHING)$(MAKE) DESTDIR=$(GNUSTEP_OBJ_DIR)/package nsilist=yes install$(END_ECHO)

#
# The user will type `make nsifile' to generate the nsifile
#
Expand All @@ -152,7 +131,7 @@ nsifile: $(NSI_FILE)
#
# This is the real target
#
$(NSI_FILE): $(GNUSTEP_OBJ_DIR) nsis_package_install
$(NSI_FILE): nsis_package_install nsis_build_filelist
$(ECHO_NOTHING)echo "Generating the nsi script..."$(END_ECHO)
$(ECHO_NOTHING)rm -f $@$(END_ECHO)
$(ECHO_NOTHING)rm -f ${GNUSTEP_RMDIR_LIST}.reverse$(END_ECHO)
Expand All @@ -175,5 +154,5 @@ $(NSI_FILE): $(GNUSTEP_OBJ_DIR) nsis_package_install
$(END_ECHO)

nsis: nsifile
;$(ECHO_NOTHING)echo "Generating the nsis installer..."$(END_ECHO)
;${MAKENSIS} $(NSI_FILE_NAME)
# $(ECHO_NOTHING)echo "Generating the nsis installer..."$(END_ECHO)
# ${MAKENSIS} $(NSI_FILE_NAME)
7 changes: 0 additions & 7 deletions Master/rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,3 @@ include $(GNUSTEP_MAKEFILES)/Master/rpm.make
#
#include $(GNUSTEP_MAKEFILES)/Master/deb.make <TODO>

#
# Rules for building NSIS installers
#
# TODO: Is it worth including this only on MS Windows ?
#
include $(GNUSTEP_MAKEFILES)/Master/nsis.make

12 changes: 8 additions & 4 deletions nsi-app.template
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ var ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN "$INSTDIR\GNUstep\@gs_domain@\Applications\${PRODUCT_NAME}.app\${PRODUCT_NAME}.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
Expand All @@ -51,21 +53,23 @@ InstallDir "C:\GNUstep"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Var APPSDIR
Var DOMDIR

Section "Main" SEC01
SetOverwrite try
StrCpy $APPSDIR "$INSTDIR@gs_domain@\Applications"
StrCpy $DOMDIR "$INSTDIR\GNUstep\@gs_domain@"
;@file_list@
SectionEnd

Section Uninstall
StrCpy $APPSDIR "$INSTDIR@gs_domain@\Applications"
StrCpy $DOMDIR "$INSTDIR\GNUstep\@gs_domain@"
;@delete_list@
;@rmdir_list@

Delete "$INSTDIR\Uninstall${PRODUCT_NAME}.exe"
!insertmacro MUI_STARTMENU_GETFOLDER Application $ICONS_GROUP
Delete "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall\Uninstall${PRODUCT_NAME}.lnk"
RMDir "$SMPROGRAMS\$ICONS_GROUP\Uninstall"
RMDir "$SMPROGRAMS\$ICONS_GROUP"

Expand All @@ -77,7 +81,7 @@ Section -AdditionalIcons
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP\Uninstall"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME}.lnk" "$APPSDIR\${PRODUCT_NAME}.app\${PRODUCT_NAME}.exe"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME}.lnk" "$DOMDIR\Applications\${PRODUCT_NAME}.app\${PRODUCT_NAME}.exe"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall\Uninstall${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall${PRODUCT_NAME}.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Expand Down

0 comments on commit f2ab885

Please sign in to comment.