DELTA
SVN   ÈnÈn€Èn#!/bin/sh

# ./create-freeciv-sdl2-nsi.sh <Freeciv files directory> <version>

cat <<EOF
; Freeciv Windows installer script
; some parts adapted from Wesnoth installer script

SetCompressor /SOLID lzma

!define APPNAME "Freeciv"
!define VERSION $2
!define GUI_ID sdl2
!define GUI_NAME SDL2
!define APPID "\${APPNAME}-\${VERSION}-\${GUI_ID}"

!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\\\${APPNAME}\\\${VERSION}\\\${GUI_ID}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME ""
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\\\${APPNAME}\\\${VERSION}\\\${GUI_ID}"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ""
!define MULTIUSER_INSTALLMODE_INSTDIR "\${APPNAME}-\${VERSION}-\${GUI_ID}"

!include "MultiUser.nsh"
!include "MUI2.nsh"
!include "nsDialogs.nsh"

;General

Name "\${APPNAME} \${VERSION} (\${GUI_NAME} client)"
OutFile "Output/\${APPNAME}-\${VERSION}-win32-\${GUI_ID}-setup.exe"

;Variables

Var STARTMENU_FOLDER
Var DefaultLanguageCode
Var LangName

; Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "$1\doc\freeciv\installer\COPYING.installer"
!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}\\\${GUI_ID}" 
!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 RunFreeciv
!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 "

  # soundsets
  find $1/data -mindepth 1 -maxdepth 1 -name *.soundspec -printf %f\\n |
  sed 's|.soundspec||' |
  while read -r name
  do
  echo -n "/x $name.soundspec /x $name "
  done

  # CJK fonts
  echo -n "/x COPYING.fireflysung "
  echo -n "/x fireflysung.ttf "
  echo -n "/x COPYING.sazanami "
  echo -n "/x sazanami-gothic.ttf "
  echo -n "/x COPYING.UnDotum "
  echo -n "/x UnDotum.ttf "

  echo "$1\\*.*"

cat <<EOF

  ; Write the installation path into the registry
  WriteRegStr "SHCTX" SOFTWARE\\\${APPNAME}\\\${VERSION}\\\${GUI_ID} "" "\$INSTDIR"

  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  CreateDirectory "\$SMPROGRAMS\\\$STARTMENU_FOLDER"
  CreateShortCut "\$SMPROGRAMS\\\$STARTMENU_FOLDER\Freeciv Server.lnk" "\$INSTDIR\freeciv-server.cmd" "\$DefaultLanguageCode" "\$INSTDIR\freeciv-server.exe" 0 SW_SHOWMINIMIZED
  CreateShortCut "\$SMPROGRAMS\\\$STARTMENU_FOLDER\Freeciv Modpack Installer.lnk" "\$INSTDIR\freeciv-mp-gtk3.cmd" "\$DefaultLanguageCode" "\$INSTDIR\freeciv-mp-gtk3.exe" 0 SW_SHOWMINIMIZED
  CreateShortCut "\$SMPROGRAMS\\\$STARTMENU_FOLDER\Freeciv.lnk" "\$INSTDIR\freeciv-sdl2.cmd" "\$DefaultLanguageCode" "\$INSTDIR\freeciv-sdl2.exe" 0 SW_SHOWMINIMIZED
  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

### soundsets ###

cat <<EOF
SectionGroup "Soundsets"

EOF

find $1/data -mindepth 1 -maxdepth 1 -name *.soundspec -printf %f\\n |
sort |
sed 's|.soundspec||' |
while read -r name
do
if test -d $1/data/$name; then
echo "  Section \"$name\""
echo "  SetOutPath \$INSTDIR\\data"
echo "  File /r $1\data\\$name.soundspec"
echo "  SetOutPath \$INSTDIR\\data\\$name"
echo "  File /r $1\\data\\$name\*.*"
echo "  SetOutPath \$INSTDIR"
echo "  SectionEnd"
echo
fi
done

cat <<EOF
SectionGroupEnd

EOF

### additional languages ###

cat <<EOF
SectionGroup "Additional languages (translation %)"

EOF

cat ../../bootstrap/langstat_freeciv.txt |
sort -k 2 |
while read -r code prct name
do
if test -e $1/share/locale/$code/LC_MESSAGES/freeciv.mo; then
echo "  Section \"$name ($code) $prct\""
echo "  SetOutPath \$INSTDIR\\share\\locale\\$code"
echo "  File /r $1\\share\\locale\\$code\*.*"

# install special fonts for CJK locales
if [ "$name" = "zh_CN" ]; then
echo "  SetOutPath \$INSTDIR\\data\\themes\\gui-sdl2\\human"
echo "  File /r $1\\data\\themes\\gui-sdl2\\human\\COPYING.fireflysung"
echo "  File /r $1\\data\\themes\\gui-sdl2\\human\\fireflysung.ttf"
fi
if [ "$name" = "ja" ]; then
echo "  SetOutPath \$INSTDIR\\data\\themes\\gui-sdl2\\human"
echo "  File /r $1\\data\\themes\\gui-sdl2\\human\\COPYING.sazanami"
echo "  File /r $1\\data\\themes\\gui-sdl2\\human\\sazanami-gothic.ttf"
fi
if [ "$name" = "ko" ]; then
echo "  SetOutPath \$INSTDIR\\data\\themes\\gui-sdl2\\human"
echo "  File /r $1\\data\\themes\\gui-sdl2\\human\\COPYING.UnDotum"
echo "  File /r $1\\data\\themes\\gui-sdl2\\human\\UnDotum.ttf"
fi

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 play Freeciv 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 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 \
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/langstat_freeciv.txt |
  sort -k 2 |
  while read -r code prct name
  do
  if test -e $1/share/locale/$code/LC_MESSAGES/freeciv.mo; then
  echo "  \${NSD_CB_AddString} \$DefaultLanguageDropList \"$name ($code) $prct\""
  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/langstat_freeciv.txt |
  while read -r code prct name
  do
    echo "  \${If} \$LangName == \"$name ($code) $prct\""
    echo "    StrCpy \$DefaultLanguageCode \"$code\""
    echo "  \${EndIf}"
  done

cat <<EOF
FunctionEnd

Function RunFreeciv
  nsExec::Exec '"\$INSTDIR\freeciv-sdl2.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}\\\${GUI_ID}
  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
ENDREP
DELTA
SVN   TT€T@echo off
if %1 NEQ auto set LANG=%1
start freeciv-sdl2.exe %2 %3 %4 %5 %6 %7 %8 %9
ENDREP
DELTA 31934 683 20
SVN  E ƒ? „ ‚/ƒƒ Š…,sdl2dl2ENDREP
DELTA 31898 60 38
SVN  ËWÕbT‰8 ` ‡ „$g ‚…|€_ J‡}™ ˆtˆF ‰‘€„+ &š Šn§D€u ƒA³€ F·;€d _·š ‹j¸a” …TÄ/ ‚"É56-02-032-installer:
	make GUI=sdl2 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-sdl--enable-sdl-mixer=sdl1.22: install-freeciv-common
	# add CJK fonts
	cp /opt/fireflysung-1.3.0/fireflysung.ttf install-sdl2/data/themes/gui-sdl2/human/
	cp /opt/fireflysung-1.3.0/COPYRIGHT install-sdl2/data/themes/gui-sdl2/human/COPYING.fireflysung
	cp /opt/sazanami-20040629/sazanami-gothic.ttf install-sdl2/data/themes/gui-sdl2/human/
	cp /opt/sazanami-20040629/README install-sdl2/data/themes/gui-sdl2/human/COPYING.sazanami
	cp /opt/un-fonts/UnDotum.ttf install-sdl2/data/themes/gui-sdl2/human/
	cp /opt/un-fonts/COPYING install-sdl2/data/themes/gui-sdl2/human/COPYING.UnDotumGTK3_DLLS := \
	SDL2.dll \
	SDL2_mixer.dll

install-env-gtk3: install-env-default-fcmp
	# add DLLs
	cp -R $(addprefix /bin/, $(GTK3_DLLS)) install-$(GUI)

GTK2_DLLS := \
	libgdk-win32-2.0-0.dll \
	libgtk-win32-2.0-0.dll \
	SDL2.dll \
	SDL2_mixer2_DLLS := \
	libpng16-16.dll \
	libSDL2_gfx-1-0-0.dll \
	SDL2.dll \
	SDL2_mixer.dll \
	SDL2_image.dll \
	SDL2_ttf.dll

install-env-sdl22_DLLS)) install-$(GUI)
	
SDL_DLLS := \
	libpng12-0.dll \
	libSDL_gfx-15.dll \
	SDL.dll \
	SDL_mixer \
	SDL2.dll \
	SDL2_mixer2: build-freeciv-sdlENDREP
id: 3g1.5qi.r32098/10850
type: file
pred: 3g1.5qi.r31934/14562
count: 15
text: 32098 9461 34 2062 316632548589e6049d1febbf60865e61
props: 12670 97345 34 0 25e6c2f7558b7484000d4d090dea5b92
cpath: /branches/S2_6/win32/Makefile.am
copyroot: 27474 /branches/S2_6

id: fyq.5qi.r32098/11110
type: file
pred: fyq.5qi.r31898/127
count: 34
text: 32098 9521 1304 10978 acd40dfbd0d6afbe5b69a02f27a6dde5
cpath: /branches/S2_6/win32/installer/Makefile
copyroot: 27474 /branches/S2_6

id: 2dnx.5qi.r32098/11321
type: file
count: 0
text: 32098 0 9340 9326 7b7d8f8abf8c1f9ee2fd3d0916b59042
cpath: /branches/S2_6/win32/installer/create-freeciv-sdl2-nsi.sh
copyroot: 27474 /branches/S2_6

id: 2dnz.5qi.r32098/11521
type: file
count: 0
text: 32098 9353 95 84 a6363d508ca09c22bcb6418fe1e331c5
cpath: /branches/S2_6/win32/installer/freeciv-sdl2.cmd
copyroot: 27474 /branches/S2_6

PLAIN
K 11
Freeciv.url
V 25
file fyo.5ck.r21474/21952
K 8
Makefile
V 25
file fyq.5qi.r32098/11110
K 28
create-freeciv-gtk-qt-nsi.sh
V 24
file v92.5ua.r31719/8600
K 26
create-freeciv-gtk2-nsi.sh
V 24
file fyr.5ck.r27084/2073
K 26
create-freeciv-gtk3-nsi.sh
V 24
file v94.5ck.r27084/2531
K 24
create-freeciv-qt-nsi.sh
V 24
file 1h04.5ck.r27086/596
K 29
create-freeciv-ruledit-nsi.sh
V 25
file 21qf.5qi.r31719/8863
K 25
create-freeciv-sdl-nsi.sh
V 24
file fys.5qi.r31719/9092
K 26
create-freeciv-sdl2-nsi.sh
V 26
file 2dnx.5qi.r32098/11321
K 16
freeciv-gtk2.cmd
V 24
file fyt.5ck.r26997/1955
K 16
freeciv-gtk3.cmd
V 24
file v95.5ck.r26997/2252
K 19
freeciv-mp-gtk2.cmd
V 23
file fyu.5n2.r26997/697
K 19
freeciv-mp-gtk3.cmd
V 24
file fyu.5n3.r26997/1027
K 17
freeciv-mp-qt.cmd
V 24
file 1h06.5ck.r27086/425
K 14
freeciv-qt.cmd
V 24
file 1h07.5ck.r27086/776
K 19
freeciv-ruledit.cmd
V 24
file 1itv.5ck.r27378/977
K 15
freeciv-sdl.cmd
V 24
file fyv.5ck.r26997/1360
K 16
freeciv-sdl2.cmd
V 26
file 2dnz.5qi.r32098/11521
K 18
freeciv-server.cmd
V 24
file fyw.5ck.r26997/1655
K 8
licenses
V 24
dir 2api.5qi.r31719/9669
END
ENDREP
id: fym.5qi.r32098/12831
type: dir
pred: fym.5qi.r31898/1333
count: 41
text: 32098 11710 1108 0 8f1ddd3f1048bd55706a756e7ebac27f
cpath: /branches/S2_6/win32/installer
copyroot: 27474 /branches/S2_6

PLAIN
K 11
Makefile.am
V 25
file 3g1.5qi.r32098/10850
K 10
client.ico
V 23
file 2ev.5ck.r22609/426
K 13
clienticon.rc
V 22
file 3g2.0.r13125/6677
K 9
installer
V 24
dir fym.5qi.r32098/12831
K 15
installer_msys2
V 23
dir fym.5uc.r32082/9805
K 6
mp.ico
V 24
file 72x.5ck.r19955/7192
K 9
mpicon.rc
V 24
file 72y.5ck.r19955/7402
K 10
server.ico
V 22
file 2ey.5ck.r22609/95
K 13
servericon.rc
V 23
file 3g3.0.r12679/13778
END
ENDREP
id: 2eu.5qi.r32098/13458
type: dir
pred: 2eu.5qi.r32082/10457
count: 78
text: 32098 13030 415 0 e03eeb3298835a2d41d7f5917aa50c9d
props: 12365 0 48 0 b9a57a7aba6d25f821a6f26036518d8d
cpath: /branches/S2_6/win32
copyroot: 27474 /branches/S2_6

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r27270/69307
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 22
file 1h.5qi.r29455/952
K 9
ChangeLog
V 26
file 6l.5qi.r31298/7507168
K 7
INSTALL
V 22
file 6.5qi.r31740/1317
K 11
Makefile.am
V 22
file 59.5qi.r31920/516
K 4
NEWS
V 24
file 6m.5ck.r25634/30702
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 22
dir 8.5qi.r32091/19817
K 10
autogen.sh
V 24
file 12o.5qi.r31740/1559
K 9
bootstrap
V 23
dir 2p5.5qi.r32074/2154
K 6
client
V 22
dir d.5qi.r32091/24657
K 6
common
V 22
dir p.5qi.r32093/10243
K 12
configure.ac
V 24
file 149.5qi.r32074/2402
K 4
data
V 21
dir w.5qi.r32095/4705
K 12
dependencies
V 23
dir 2yu.5qi.r31823/9339
K 3
doc
V 23
dir k7.5qi.r32091/33988
K 10
fc_version
V 25
file 2lo.5qj.r32091/34229
K 11
gen_headers
V 24
dir 1hsw.5qi.r31867/7150
K 3
lua
V 24
dir 2c5p.5qi.r31920/4972
K 2
m4
V 23
dir 12p.5qi.r31934/8566
K 7
scripts
V 23
dir 2yo.5qi.r31853/1104
K 6
server
V 22
dir z.5qi.r32093/16021
K 5
tests
V 22
dir 2g9.5qi.r31521/645
K 5
tools
V 23
dir 4pj.5qp.r32080/2676
K 12
translations
V 23
dir t0a.5qi.r31733/2917
K 7
utility
V 22
dir 1c.5qi.r32067/4588
K 3
vms
V 25
dir u9.5ck.r21528/1396085
K 5
win32
V 24
dir 2eu.5qi.r32098/13458
END
ENDREP
id: 3.5qi.r32098/14911
type: dir
pred: 3.5qi.r32095/6158
count: 20483
text: 32098 13700 1198 0 c0d8ce7dbf577a1bab97bc1ee292116d
props: 28037 14463 292 0 9e1d5de0253c723466868990c52c129f
cpath: /branches/S2_6
copyroot: 27474 /branches/S2_6

PLAIN
K 5
S1_14
V 21
dir 3.21.r18109/18803
K 4
S2_0
V 21
dir 3.10x.r21862/4178
K 4
S2_1
V 22
dir 3.59e.r20026/11014
K 4
S2_2
V 21
dir 3.5cy.r21861/5036
K 4
S2_3
V 21
dir 3.5f2.r29458/5135
K 4
S2_4
V 22
dir 3.5ii.r30401/87429
K 4
S2_5
V 21
dir 3.5kv.r32096/5797
K 6
S2_5_3
V 23
dir 3.5ut.r31805/553797
K 4
S2_6
V 22
dir 3.5qi.r32098/14911
K 11
freeciv-web
V 22
dir 3.5bl.r13594/14918
END
ENDREP
id: 1.0.r32098/15545
type: dir
pred: 1.0.r32096/6427
count: 10924
text: 32098 15151 381 0 67c17e55592daffd68eae3c801c97c83
cpath: /branches
copyroot: 0 /

PLAIN
K 8
branches
V 20
dir 1.0.r32098/15545
K 4
tags
V 19
dir 2.0.r31807/7857
K 5
trunk
V 22
dir 3.5ck.r32097/14920
K 7
website
V 20
dir 3ge.0.r31885/802
END
ENDREP
id: 0.0.r32098/15866
type: dir
pred: 0.0.r32097/15309
count: 32098
text: 32098 15700 153 0 3c1cf1f549cf9d426a36e074e9edb9d8
cpath: /
copyroot: 0 /

3g1.5qi.t32097-1 modify true false /branches/S2_6/win32/Makefile.am

fyq.5qi.t32097-1 modify true false /branches/S2_6/win32/installer/Makefile

_4.5qi.t32097-1 add true false /branches/S2_6/win32/installer/create-freeciv-sdl2-nsi.sh

_6.5qi.t32097-1 add true false /branches/S2_6/win32/installer/freeciv-sdl2.cmd


15866 16014
