Author: cazfi
Date: Fri Oct 30 21:55:01 2015
New Revision: 30325

URL: http://svn.gna.org/viewcvs/freeciv?rev=30325&view=rev
Log:
Added building of separate Ruledit Windows Installer package.

See patch #6472

Added:
    trunk/win32/installer/create-freeciv-ruledit-nsi.sh
Modified:
    trunk/win32/Makefile.am
    trunk/win32/installer/Makefile

Modified: trunk/win32/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/win32/Makefile.am?rev=30325&r1=30324&r2=30325&view=diff
==============================================================================
--- trunk/win32/Makefile.am     (original)
+++ trunk/win32/Makefile.am     Fri Oct 30 21:55:01 2015
@@ -12,6 +12,7 @@
                installer/create-freeciv-gtk3-nsi.sh    \
                installer/create-freeciv-qt-nsi.sh      \
                installer/create-freeciv-sdl-nsi.sh     \
+               installer/create-freeciv-ruledit-nsi.sh \
                installer/freeciv-gtk2.cmd              \
                installer/freeciv-gtk3.cmd              \
                installer/freeciv-mp-gtk2.cmd           \

Modified: trunk/win32/installer/Makefile
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/win32/installer/Makefile?rev=30325&r1=30324&r2=30325&view=diff
==============================================================================
--- trunk/win32/installer/Makefile      (original)
+++ trunk/win32/installer/Makefile      Fri Oct 30 21:55:01 2015
@@ -26,7 +26,7 @@
 
 
 # by default build all installers
-all: gtk3-installer gtk2-installer sdl-installer qt-installer
+all: gtk3-installer gtk2-installer sdl-installer qt-installer ruledit-installer
 
 gtk3-installer:
        make GUI=gtk3 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit 
$(EXTRA_CONFIG)" wrap-gtk3
@@ -39,6 +39,9 @@
 
 qt-installer:
        make GUI=qt FCMP=qt wrap-qt
+
+ruledit-installer:
+       make wrap-ruledit
 
 snapshot:
        cd ../.. ; ./autogen.sh --no-configure-run
@@ -54,6 +57,14 @@
        cd build-$(GUI); ../../../configure --enable-client=$(GUI) 
--with-followtag="win32-S3_0" --enable-fcdb=sqlite3 --enable-fcmp=$(FCMP) 
$(EXTRA_CONFIG)
        # make
        make -C build-$(GUI)
+
+build-freeciv-ruledit:
+       # create build directory
+       mkdir -p build-ruledit
+       # configure
+       cd build-ruledit; ../../../configure --disable-client --disable-server 
--disable-fcmp --disable-freeciv-manual
+       # make
+       make -C build-ruledit
 
 build-freeciv-gtk3: build-freeciv-common
 
@@ -99,6 +110,25 @@
        # strip 'freeciv-ruledit' executable
        strip install-$(GUI)/freeciv-ruledit.exe
        cp freeciv-ruledit.cmd install-$(GUI)/
+
+install-ruledit-dir:
+       mkdir -p install-ruledit/share
+
+install-ruledit: install-ruledit-dir
+       # make install
+       make -C build-ruledit DESTDIR=`pwd`/install-ruledit install
+       # reorder directory layout
+       mv install-ruledit/usr/local/bin/* install-ruledit/
+       mv install-ruledit/usr/local/etc install-ruledit/
+       mv install-ruledit/usr/local/share/freeciv install-ruledit/data
+       mv install-ruledit/usr/local/share/locale install-ruledit/share/
+       mv install-ruledit/usr/local/share/doc install-ruledit/doc
+       # delete unneeded files
+       rm -r install-ruledit/usr
+       # strip 'freeciv-ruledit' executable
+       strip install-ruledit/freeciv-ruledit.exe
+       # add start menu files
+       cp freeciv-ruledit.cmd Freeciv.url install-ruledit/
 
 # install Freeciv environment
 
@@ -205,6 +235,15 @@
        cp -R /share/locale install-$(GUI)/share/
        find install-$(GUI)/share/locale -type f -not -name "freeciv*.mo" 
-delete
 
+install-env-ruledit:
+       # add DLLs
+       cp -R $(addprefix /bin/, $(COMMON_DLLS)) install-ruledit
+       cp -R $(addprefix /bin/, $(QT_DLLS)) install-ruledit
+       # add additional Qt files
+       cp -R /plugins install-ruledit/
+       cp -R /share/locale install-ruledit/share/
+       find install-ruledit/share/locale -type f -not -name 
"freeciv-ruledit.mo" -delete
+
 # build installer
 
 installer-common: clean-install-common install-freeciv-$(GUI) 
install-env-$(GUI)
@@ -216,6 +255,15 @@
        mkdir -p Output
        makensis Freeciv-$(FREECIV_VERSION)-$(GUI).nsi
 
+installer-ruledit: clean-install-ruledit install-ruledit install-env-ruledit
+       # extract Freeciv version
+       $(eval FREECIV_VERSION := $(shell ../../fc_version))
+       # create NSIS script
+       ./create-freeciv-ruledit-nsi.sh install-ruledit $(FREECIV_VERSION) > 
Freeciv-$(FREECIV_VERSION)-ruledit.nsi
+       # create installer executable
+       mkdir -p Output
+       makensis Freeciv-$(FREECIV_VERSION)-ruledit.nsi
+
 wrap-gtk3: build-freeciv-gtk3 installer-common
 
 wrap-gtk2: build-freeciv-gtk2 installer-common
@@ -223,6 +271,8 @@
 wrap-sdl: build-freeciv-sdl installer-common
 
 wrap-qt: build-freeciv-qt installer-common
+
+wrap-ruledit: build-freeciv-ruledit installer-ruledit
 
 
 # cleanup
@@ -230,15 +280,26 @@
 clean-build-common:
        rm -rf build-$(GUI)
 
+clean-build-ruledit:
+       rm -rf build-ruledit
+
 clean-install-common:
        rm -rf install-$(GUI)
+
+clean-install-ruledit:
+       rm -rf install-ruledit
 
 clean-installer-common:
        rm -f Output/Freeciv-*-$(GUI)-setup.exe
        rm -f Freeciv-*-$(GUI).nsi
+
+clean-installer-ruledit:
+       rm -f Output/Freeciv-*-ruledit-setup.exe
+       rm -f Freeciv-*-ruledit.nsi
 
 clean:
        make GUI=gtk3 clean-build-common clean-install-common 
clean-installer-common
        make GUI=gtk2 clean-build-common clean-install-common 
clean-installer-common
        make GUI=sdl clean-build-common clean-install-common 
clean-installer-common
        make GUI=qt clean-build-common clean-install-common 
clean-installer-common
+       make clean-build-ruledit clean-install-ruledit clean-installer-ruledit

Added: trunk/win32/installer/create-freeciv-ruledit-nsi.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/win32/installer/create-freeciv-ruledit-nsi.sh?rev=30325&view=auto
==============================================================================
--- trunk/win32/installer/create-freeciv-ruledit-nsi.sh (added)
+++ trunk/win32/installer/create-freeciv-ruledit-nsi.sh Fri Oct 30 21:55:01 2015
@@ -0,0 +1,325 @@
+#!/bin/sh
+
+# ./create-freeciv-ruledit.sh <Freeciv files directory> <version>
+
+cat <<EOF
+; Freeciv Windows installer script
+; some parts adapted from Wesnoth installer script
+
+SetCompressor /SOLID lzma
+
+!define APPNAME "Freeciv-ruledit"
+!define VERSION $2
+!define APPID "\${APPNAME}-\${VERSION}"
+
+!define MULTIUSER_EXECUTIONLEVEL Highest
+!define MULTIUSER_MUI
+!define MULTIUSER_INSTALLMODE_COMMANDLINE
+!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY 
"Software\\\${APPNAME}\\\${VERSION}"
+!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME ""
+!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY 
"Software\\\${APPNAME}\\\${VERSION}"
+!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ""
+!define MULTIUSER_INSTALLMODE_INSTDIR "\${APPNAME}-\${VERSION}"
+
+!include "MultiUser.nsh"
+!include "MUI2.nsh"
+!include "nsDialogs.nsh"
+
+;General
+
+Name "Freeciv Ruleset Editor \${VERSION}"
+OutFile "Output/\${APPNAME}-\${VERSION}-win32-setup.exe"
+
+;Variables
+
+Var STARTMENU_FOLDER
+Var DefaultLanguageCode
+Var LangName
+
+; Pages
+
+!insertmacro MUI_PAGE_WELCOME
+!insertmacro MUI_PAGE_LICENSE "$1\doc\freeciv\COPYING"
+!insertmacro MUI_PAGE_COMPONENTS
+Page custom DefaultLanguage DefaultLanguageLeave
+!insertmacro MULTIUSER_PAGE_INSTALLMODE
+!insertmacro MUI_PAGE_DIRECTORY
+
+;Start Menu Folder Page Configuration
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" 
+!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\\\${APPNAME}\\\${VERSION}"
+!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+!define MUI_STARTMENUPAGE_DEFAULTFOLDER "\$(^Name)"
+
+!insertmacro MUI_PAGE_STARTMENU "Application" \$STARTMENU_FOLDER
+!insertmacro MUI_PAGE_INSTFILES
+
+!define MUI_FINISHPAGE_RUN
+!define MUI_FINISHPAGE_RUN_FUNCTION RunFreecivRuledit
+!insertmacro MUI_PAGE_FINISH
+
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"
+
+EOF
+
+### required files ###
+
+cat <<EOF
+; The stuff to install
+Section "\${APPNAME} (required)"
+
+  SectionIn RO
+
+  SetOutPath \$INSTDIR
+EOF
+
+  # find files and directories to exclude from default installation
+
+  echo -n "  File /nonfatal /r "
+
+  # languages
+  echo -n "/x locale "
+
+  # rulesets
+  find $1/data -mindepth 1 -maxdepth 1 -name *.serv -printf %f\\n |
+  sed 's|.serv||' |
+  while read -r name
+  do
+  if test "x$name" != "xdefault" ; then
+  echo -n "/x $name.serv /x $name "
+  else
+  echo -n "/x $name.serv "
+  fi
+  done
+
+  echo "$1\\*.*"
+
+cat <<EOF
+
+  ; Write the installation path into the registry
+  WriteRegStr "SHCTX" SOFTWARE\\\${APPNAME}\\\${VERSION} "" "\$INSTDIR"
+
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  CreateDirectory "\$SMPROGRAMS\\\$STARTMENU_FOLDER"
+  CreateShortCut "\$SMPROGRAMS\\\$STARTMENU_FOLDER\Freeciv Ruleset Editor.lnk" 
"\$INSTDIR\freeciv-ruledit.cmd" "\$DefaultLanguageCode" 
"\$INSTDIR\freeciv-ruledit.exe" 0 SW_SHOWMINIMIZED
+EOF
+
+cat <<EOF
+
+  CreateShortCut "\$SMPROGRAMS\\\$STARTMENU_FOLDER\Uninstall.lnk" 
"\$INSTDIR\uninstall.exe"
+  CreateShortCut "\$SMPROGRAMS\\\$STARTMENU_FOLDER\Website.lnk" 
"\$INSTDIR\Freeciv.url"
+  !insertmacro MUI_STARTMENU_WRITE_END
+
+  ; Write the uninstall keys for Windows
+  WriteRegStr "SHCTX" 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\\\${APPID}" "DisplayName" 
"\$(^Name)"
+  WriteRegStr "SHCTX" 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\\\${APPID}" 
"UninstallString" '"\$INSTDIR\uninstall.exe"'
+  WriteRegDWORD "SHCTX" 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\\\${APPID}" "NoModify" 1
+  WriteRegDWORD "SHCTX" 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\\\${APPID}" "NoRepair" 1
+  WriteUninstaller "uninstall.exe"
+
+  SetOutPath \$INSTDIR
+SectionEnd
+
+EOF
+
+### rulesets ###
+
+cat <<EOF
+SectionGroup "Rulesets"
+
+EOF
+
+find $1/data -mindepth 1 -maxdepth 1 -name *.serv -printf %f\\n |
+sort |
+sed 's|.serv||' |
+while read -r name
+do
+if test -d $1/data/$name; then
+# 'default' directory is not optional
+if test "x$name" != "xdefault" ; then
+echo "  Section \"$name\""
+# Intentionally left .serv out. Ruledit does not use it.
+# This script does use it, though, to detect rulesets.
+echo "  SetOutPath \$INSTDIR\\data\\$name"
+echo "  File /r $1\\data\\$name\*.*"
+echo "  SetOutPath \$INSTDIR"
+echo "  SectionEnd"
+echo
+fi
+fi
+done
+
+cat <<EOF
+SectionGroupEnd
+
+EOF
+
+### additional languages ###
+
+cat <<EOF
+SectionGroup "Additional languages"
+
+EOF
+
+cat ../../bootstrap/langnames.txt |
+sort -k 2 |
+while read -r code name
+do
+if test -e $1/share/locale/$code/LC_MESSAGES/freeciv-ruledit.mo; then
+echo "  Section \"$name ($code)\""
+echo "  SetOutPath \$INSTDIR\\share\\locale\\$code"
+echo "  File /r $1\\share\\locale\\$code\*.*"
+echo "  SetOutPath \$INSTDIR"
+echo "  SectionEnd"
+echo
+fi
+done
+
+cat <<EOF
+SectionGroupEnd
+
+EOF
+
+cat <<EOF
+;--------------------------------
+;Installer Functions
+
+Function .onInit
+
+  !insertmacro MULTIUSER_INIT
+
+FunctionEnd
+
+Var DefaultLanguageDialog
+Var DefaultLanguageLabel
+Var DefaultLanguageDropList
+
+Function DefaultLanguage
+  !insertmacro MUI_HEADER_TEXT "Choose Default Language" ""
+
+  nsDialogs::Create 1018
+  Pop \$DefaultLanguageDialog
+
+  \${If} \$DefaultLanguageDialog == error
+    Abort
+  \${EndIf}
+
+  \${NSD_CreateLabel} 0 0 100% 30% \
+"If you want to run Freeciv Ruleset Editor in a language other than your 
Windows language or \
+if Freeciv's auto-detection of your Windows language does not work correctly, \
+you can select a specific language to be used by Freeciv Ruleset Editor here. 
Be sure \
+you haven't unmarked the installation of the corresponding language files \
+in the previous dialog. You can also change this setting later in the Freeciv 
Ruleset Editor \
+Start Menu shortcut properties."
+  Pop \$DefaultLanguageLabel
+
+  \${NSD_CreateDropList} 0 -60% 100% 13u ""
+  Pop \$DefaultLanguageDropList
+
+  \${NSD_CB_AddString} \$DefaultLanguageDropList "Autodetected"
+  \${NSD_CB_SelectString} \$DefaultLanguageDropList "Autodetected"
+  \${NSD_CB_AddString} \$DefaultLanguageDropList "US English (en_US)"
+EOF
+
+  cat ../../bootstrap/langnames.txt |
+  sort -k 2 |
+  while read -r code name
+  do
+  if test -e $1/share/locale/$code/LC_MESSAGES/freeciv-ruledit.mo; then
+  echo "  \${NSD_CB_AddString} \$DefaultLanguageDropList \"$name ($code)\""
+  fi
+  done
+
+cat <<EOF
+  nsDialogs::Show
+FunctionEnd
+
+Function DefaultLanguageLeave
+  \${NSD_GetText} \$DefaultLanguageDropList \$LangName
+EOF
+
+  echo "  \${If} \$LangName == \"Autodetected\""
+  echo "    StrCpy \$DefaultLanguageCode \"auto\""
+  echo "  \${EndIf}"
+  echo "  \${If} \$LangName == \"US English (en_US)\""
+  echo "    StrCpy \$DefaultLanguageCode \"en_US\""
+  echo "  \${EndIf}"
+
+  cat ../../bootstrap/langnames.txt |
+  while read -r code name
+  do
+    echo "  \${If} \$LangName == \"$name ($code)\""
+    echo "    StrCpy \$DefaultLanguageCode \"$code\""
+    echo "  \${EndIf}"
+  done
+
+cat <<EOF
+FunctionEnd
+
+Function RunFreecivRuledit
+  nsExec::Exec '"\$INSTDIR\freeciv-ruledit.cmd" \$DefaultLanguageCode'
+FunctionEnd
+
+EOF
+
+### uninstall section ###
+
+cat <<EOF
+; special uninstall section.
+Section "Uninstall"
+
+  ; remove files
+EOF
+
+find $1 -type f |
+grep -v '/$' |
+sed 's|[^/]*||' |
+tr '/' '\\' | while read -r name
+do
+echo "  Delete \"\$INSTDIR$name\""
+done
+
+find $1 -depth -type d |
+grep -v '/$' |
+sed 's|[^/]*||' |
+tr '/' '\\' | while read -r name
+do
+echo "  RMDir \"\$INSTDIR$name\""
+done
+
+cat <<EOF
+
+  ; MUST REMOVE UNINSTALLER, too
+  Delete "\$INSTDIR\uninstall.exe"
+
+  ; remove install directory, if empty
+  RMDir "\$INSTDIR"
+
+  ; remove shortcuts, if any.
+  !insertmacro MUI_STARTMENU_GETFOLDER "Application" \$STARTMENU_FOLDER
+  Delete "\$SMPROGRAMS\\\$STARTMENU_FOLDER\*.*"
+  RMDir "\$SMPROGRAMS\\\$STARTMENU_FOLDER"
+
+  ; remove registry keys
+  DeleteRegKey "SHCTX" 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\\\${APPID}"
+  DeleteRegKey /ifempty "SHCTX" SOFTWARE\\\${APPNAME}\\\${VERSION}
+  DeleteRegKey /ifempty "SHCTX" SOFTWARE\\\${APPNAME}
+SectionEnd
+EOF
+
+cat <<EOF
+;--------------------------------
+;Uninstaller Functions
+
+Function un.onInit
+
+  !insertmacro MULTIUSER_UNINIT
+
+FunctionEnd
+
+EOF


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to