Add: create bundles via CPack

CPack works closely together with CMake to do the right thing in
terms of bundling (called 'package'). This generates all the
packaging we need, and some more.
desync-debugging
Patric Stout 5 years ago committed by glx22
parent 56d54cf60e
commit b7643b1d36

@ -224,3 +224,5 @@ endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
include(CreateRegression)
create_regression()
include(InstallAndPackage)

@ -0,0 +1,12 @@
# Make the current version available to CPack
set(CPACK_PACKAGE_VERSION "@REV_VERSION@")
# Name the output file with the correct version
string(REPLACE "#CPACK_PACKAGE_VERSION#" "@REV_VERSION@" CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
if (CPACK_BUNDLE_PLIST_SOURCE)
# Rewrite the Info.plist.in to contain the correct version
file(READ ${CPACK_BUNDLE_PLIST_SOURCE} INFO_PLIST_CONTENT)
string(REPLACE "#CPACK_PACKAGE_VERSION#" "@REV_VERSION@" INFO_PLIST_CONTENT "${INFO_PLIST_CONTENT}")
file(WRITE ${CPACK_BUNDLE_PLIST} "${INFO_PLIST_CONTENT}")
endif (CPACK_BUNDLE_PLIST_SOURCE)

@ -0,0 +1,109 @@
# If requested, use FHS layout; otherwise fall back to a flat layout.
if (OPTION_INSTALL_FHS)
set(BINARY_DESTINATION_DIR "bin")
set(DATA_DESTINATION_DIR "share/games/openttd")
set(DOCS_DESTINATION_DIR "share/doc/openttd")
set(MAN_DESTINATION_DIR "share/man/openttd")
else (OPTION_INSTALL_FHS)
set(BINARY_DESTINATION_DIR ".")
set(DATA_DESTINATION_DIR ".")
set(DOCS_DESTINATION_DIR ".")
set(MAN_DESTINATION_DIR ".")
endif (OPTION_INSTALL_FHS)
install(TARGETS openttd
RUNTIME
DESTINATION ${BINARY_DESTINATION_DIR}
COMPONENT Runtime
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/lang
${CMAKE_BINARY_DIR}/baseset
${CMAKE_SOURCE_DIR}/bin/ai
${CMAKE_SOURCE_DIR}/bin/game
${CMAKE_SOURCE_DIR}/bin/scripts
DESTINATION ${DATA_DESTINATION_DIR}
COMPONENT language_files)
install(FILES
${CMAKE_SOURCE_DIR}/COPYING.md
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/changelog.txt
${CMAKE_SOURCE_DIR}/docs/multiplayer.md
${CMAKE_SOURCE_DIR}/known-bugs.txt
DESTINATION ${DOCS_DESTINATION_DIR}
COMPONENT docs)
# A Linux manual only makes sense when using FHS. Otherwise it is a very odd
# file with little context to what it is.
if (OPTION_INSTALL_FHS)
install(FILES
${CMAKE_SOURCE_DIR}/docs/openttd.6
DESTINATION ${MAN_DESTINATION_DIR}
COMPONENT manual)
endif (OPTION_INSTALL_FHS)
# TODO -- Media files
# TODO -- Menu files
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(ARCHITECTURE "amd64")
else (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCHITECTURE)
endif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
# Windows is a bit more annoying to detect; using the size of void pointer
# seems to be the most robust.
if (WIN32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE "win64")
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE "win32")
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
endif (WIN32)
set(CPACK_SYSTEM_NAME "${ARCHITECTURE}")
set(CPACK_PACKAGE_NAME "openttd")
set(CPACK_PACKAGE_VENDOR "OpenTTD")
set(CPACK_PACKAGE_DESCRIPTION "OpenTTD")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenTTD")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.openttd.org/")
set(CPACK_PACKAGE_CONTACT "OpenTTD <info@openttd.org>")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenTTD")
set(CPACK_PACKAGE_CHECKSUM "SHA256")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.md")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_MONOLITHIC_INSTALL YES)
set(CPACK_PACKAGE_EXECUTABLES "openttd;OpenTTD")
set(CPACK_STRIP_FILES YES)
set(CPACK_OUTPUT_FILE_PREFIX "bundles")
if (APPLE)
set(CPACK_GENERATOR "Bundle")
include(PackageBundle)
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-macosx")
elseif (WIN32)
set(CPACK_GENERATOR "ZIP;NSIS")
include(PackageNSIS)
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-windows-${CPACK_SYSTEM_NAME}")
elseif (UNIX)
# With FHS, we can create deb/rpm/... Without it, they would be horribly broken
# and not work. The other way around is also true; with FHS they are not
# usable, and only flat formats work.
if (OPTION_INSTALL_FHS)
set(CPACK_GENERATOR "DEB")
include(PackageDeb)
else (OPTION_INSTALL_FHS)
set(CPACK_GENERATOR "TXZ")
endif (OPTION_INSTALL_FHS)
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${CPACK_SYSTEM_NAME}")
else ()
message(FATAL_ERROR "Unknown OS found for packaging; please consider creating a Pull Request to add support for this OS.")
endif ()
include(CPack)

@ -0,0 +1,24 @@
string(TIMESTAMP CURRENT_YEAR "%Y")
set(CPACK_BUNDLE_NAME "OpenTTD")
set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/os/macosx/openttd.icns")
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_SOURCE_DIR}/os/macosx/launch.sh")
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/os/macosx/splash.png")
# Create a temporary Info.plist.in, where we will fill in the version via
# CPackProperties.cmake.in. This because at this point in time the version
# is not yet known.
configure_file("${CMAKE_SOURCE_DIR}/os/macosx/Info.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist.in")
set(CPACK_BUNDLE_PLIST_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Info.plist.in")
# Delay fixup_bundle() till the install step; this makes sure all executables
# exists and it can do its job.
install(
CODE
"
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/openttd\" \"\" \"\")
"
DESTINATION .
COMPONENT Runtime)

@ -0,0 +1,4 @@
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${ARCHITECTURE}")
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
# TODO -- Fix depends
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.15)")

@ -0,0 +1,39 @@
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_HELP_LINK "${CPACK_PACKAGE_HOMEPAGE_URL}")
set(CPACK_NSIS_URL_INFO_ABOUT "${CPACK_PACKAGE_HOMEPAGE_URL}")
set(CPACK_NSIS_CONTACT "${CPACK_PACKAGE_CONTACT}")
# NSIS uses this for the icon in the top left of the installer
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/os/windows\\\\nsis-top.bmp")
# Set other icons and bitmaps for NSIS
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/os/windows\\\\openttd.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/os/windows\\\\openttd.ico")
set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${CMAKE_SOURCE_DIR}/os/windows\\\\nsis-welcome.bmp")
set(CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP "${CMAKE_SOURCE_DIR}/os/windows\\\\nsis-welcome.bmp")
# Use the icon of the application
set(CPACK_NSIS_INSTALLED_ICON_NAME "openttd.exe")
# Tell NSIS the binary will be in the root
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
# Add detail information on the NSIS installer executable. CPack doesn't
# support this out of the box, so we use CPACK_NSIS_DEFINES for this.
# \\\ are needed, because this value is generated in another CPack file,
# which is used. So one \ is to escape here, the second to escape in the
# CPack file, which we have to escape here (hence: 3 \).
set(CPACK_NSIS_DEFINES "
; Version Info
Var AddWinPrePopulate
VIProductVersion \\\"0.0.0.0\\\"
VIAddVersionKey \\\"ProductName\\\" \\\"OpenTTD Installer for Windows\\\"
VIAddVersionKey \\\"Comments\\\" \\\"Installs OpenTTD \\\${VERSION}\\\"
VIAddVersionKey \\\"CompanyName\\\" \\\"OpenTTD Developers\\\"
VIAddVersionKey \\\"FileDescription\\\" \\\"Installs OpenTTD \\\${VERSION}\\\"
VIAddVersionKey \\\"ProductVersion\\\" \\\"\\\${VERSION}\\\"
VIAddVersionKey \\\"InternalName\\\" \\\"InstOpenTTD\\\"
VIAddVersionKey \\\"FileVersion\\\" \\\"0.0.0.0\\\"
VIAddVersionKey \\\"LegalCopyright\\\" \\\" \\\"
"
)

@ -1,25 +0,0 @@
openttd (1.0.0~rc3-2) unstable; urgency=low
The openttd package has been moved from contrib into main. Since the
OpenGFX free graphics set has been packaged for Debian, one can now run
OpenTTD without needing any of the resources from the original game
(though the original resources are still supported).
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 18 Mar 2010 13:09:35 +0100
openttd (0.7.0-1) unstable; urgency=low
Handling of AI players has changed in 0.7.0. This package no longer
contains any AI players, so playing against the computer is not possible
out of the box any longer. However, you can easily download AI players
through the new "Content Downloading Service", after which playing with
computer players is possible.
Loading old savegames with computer players is supported (AI players will
be converted according to the current AI settings), but at this moment
there are no AIs that completely handle any existing infrastructure built
by the old AI, so starting a new game might be more fun (especially since
most of the new AIs are a lot less erratic).
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 13 Apr 2009 15:11:20 +0200

@ -1,41 +0,0 @@
OpenTTD for Debian
------------------
To properly play this game, you need a base graphics and sound set.
Currently, the graphics, sound and music files from the original
Transport Tycoon Deluxe game (Windows and DOS versions) are supported,
as well as the free graphics replacement set "OpenGFX", sound
replacement set "OpenSFX" (which is in non-free due to a restrictive
license) and the free music replacement set "OpenMSX".
Normally, installing the openttd package should automatically install
openttd-opengfx as well, allowing OpenTTD to run out of the box. If you
want sound, you'll have to enable non-free sources and install the
openttd-opensfx package manually (or install the original Transport
Tyccon Deluxe sound files).
The easiest way to install the OpenMSX music files is to use the in-game
content download system, which should offer the latest version of the
music files.
To find out how to install the original Transport Tycoon Deluxe graphics
sound files and music files, see readme.txt, section 4.1.
-Playing Music
In addition to installing a music set (see above), you'll also need
to install the timidity midi player, available in the timidity
package.
Remember that not all audio devices support multiple audiostreams
(music and sound), so you might have to use alsa software mixing or
pulseaudio.
-Scenarios
There are no scenarios included in this release. Scenarios can be
downloaded using OpenTTD's content service, which is available from
OpenTTD's main menu. If you have obtained a scenario through other
means, you can place it either in your ~/.openttd/scenario directory
or in the system-wide /usr/share/games/openttd/scenario directory.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 01 Feb 2010 10:42:11 +0100

File diff suppressed because it is too large Load Diff

@ -1,36 +0,0 @@
Source: openttd
Section: games
Priority: optional
Maintainer: Matthijs Kooijman <matthijs@stdin.nl>
Uploaders: Jordi Mallach <jordi@debian.org>
Build-Depends: debhelper (>= 7.0.50), libsdl2-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev
Standards-Version: 3.8.4
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/openttd.git
Vcs-Git: git://anonscm.debian.org/collab-maint/openttd.git
Homepage: http://www.openttd.org/
Package: openttd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: openttd-opengfx, x11-utils
Replaces: openttd-data
Conflicts: openttd-data
Suggests: openttd-opensfx, timidity, freepats
Description: reimplementation of Transport Tycoon Deluxe with enhancements
OpenTTD is a reimplementation of the Microprose game "Transport
Tycoon Deluxe" with lots of new features and enhancements.
.
OpenTTD is playable with the free graphics files from the openttd-opengfx
package and optional sound files from the openttd-opensfx package (which is in
non-free). Alternatively, OpenTTD can use the graphics files from the original
Transport Tycoon Deluxe game (See README.Debian on how to set this up).
Package: openttd-dbg
Architecture: any
Section: debug
Priority: extra
Depends: openttd (= ${binary:Version}), ${misc:Depends}
Description: debugging symbols for openttd
This package contains the debugging symbols for OpenTTD, the reimplementation
of the Micropose game "Transport Tycoon Deluxe" with lots of new features and
enhancements.

@ -1,106 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: OpenTTD
Upstream-Contact: info@openttd.org, #openttd on irc.oftc.net
Source: http://www.openttd.org
Files: *
Copyright: © 2004-2019 Ludvig Strigeous and others.
License: GPL-2.0
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2.0 as
published by the Free Software Foundation;
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in `/usr/share/common-licenses/GPL-2'.
Files: src/3rdparty/squirrel/*
Copyright: © 2003-2009 Alberto Demichelis
License: Zlib
Files: src/3rdparty/md5/*
Copyright: © 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
License: Zlib
License: Zlib
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in
a product, an acknowledgment in the product documentation would be
appreciated but is not required.
.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
.
3. This notice may not be removed or altered from any source
distribution.
Files: os/dos/exe2coff/*
Copyright: © 1998 DJ Delorie
License: GPL-2.0 with additional restrictions
This document is Copyright (C) DJ Delorie and may be distributed
verbatim, but changing it is not allowed.
.
Source code copyright DJ Delorie is distributed under the terms of the
GNU General Public Licence, with the following exceptions:
.
* Sources used to build crt0.o, gcrt0.o, libc.a, libdbg.a, and
libemu.a are distributed under the terms of the GNU Library General
Public License, rather than the GNU GPL.
.
* Any existing copyright or authorship information in any given source
file must remain intact. If you modify a source file, a notice to that
effect must be added to the authorship information in the source file.
.
* Runtime binaries, as provided by DJ in DJGPP, may be distributed
without sources ONLY if the recipient is given sufficient information
to obtain a copy of djgpp themselves. This primarily applies to
go32-v2.exe, emu387.dxe, and stubedit.exe.
.
* Runtime objects and libraries, as provided by DJ in DJGPP, when
linked into an application, may be distributed without sources ONLY
if the recipient is given sufficient information to obtain a copy of
djgpp themselves. This primarily applies to crt0.o and libc.a.
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in `/usr/share/common-licenses/GPL-2'.
Comment:
Given only the exe2coff.c file is distributed in the source distribution (and
nothing in Debian binary distribution), it seems only the 2nd condition
applies.
Files: os/dos/cwsdpmi/*
Source: http://homer.rice.edu/~sandmann/cwsdpmi/index.html
Copyright: © 1995-2000 Charles W Sandmann (sandmann@clio.rice.edu)
License: Custom binary-only license
This is release 5. The files in this binary distribution may be redistributed
under the GPL (with source) or without the source code provided:
.
* CWSDPMI.EXE or CWSDPR0.EXE are not modified in any way except via CWSPARAM.
.
* CWSDSTUB.EXE internal contents are not modified in any way except via
CWSPARAM or STUBEDIT. It may have a COFF image plus data appended to it.
.
* Notice to users that they have the right to receive the source code and/or
binary updates for CWSDPMI. Distributors should indicate a site for the
source in their documentation.
Comment:
Files are distributed as binary only, so the second option in the license
("without source code provided: ...") is applicable.

@ -1,13 +0,0 @@
[DEFAULT]
# Use pristine-tar
pristine-tar = True
[git-dch]
# We use metaheaders in commit messages.
meta = True
# Put git commit ids in the debian changelog.
id-length = 7
[git-import-orig]
# Use a custom commit message for upstream imports.
import-msg = New upstream release %(version)s.

@ -1,2 +0,0 @@
?package(openttd):needs="X11" section="Games/Simulation" title="OpenTTD"\
command="/usr/games/openttd" icon="/usr/share/pixmaps/openttd.32.xpm"

@ -1,28 +0,0 @@
#!/bin/sh
# This is a wrapper script that checks openttd's exit status and
# displays its stderr output
# Get a file to capture stderr to. Use the deprecated -t option, so this
# works on the old mktemp from the mktemp package (which has been
# replaced by the version from the coreutils package).
TMPFILE=`mktemp -t openttd.errout.XXXXXXXXX`
if [ ! -w "$TMPFILE" ]; then
xmessage "Could not create temporary file for error messages. Not starting OpenTTD."
exit 1;
fi
# Capture stderr
openttd "$@" 2> "$TMPFILE"
ERRCODE=$?
if [ "$ERRCODE" -ne 0 ]; then
CODEMSG="OpenTTD returned with error code $ERRCODE."
if [ -s "$TMPFILE" ]; then
MESSAGE="$CODEMSG The following error messages were produced:\n\n"
printf "$MESSAGE" | cat - "$TMPFILE" | fold -s | xmessage -file -
else
xmessage "$CODEMSG No error messages were produced."
fi
fi
rm -f "$TMPFILE"

@ -1,20 +0,0 @@
From: Matthijs Kooijman <matthijs@stdin.nl>
Subject: Use a wrapper script for running openttd
The wrapper script captures stderr from openttd and displays this in
case of an error. This patch makes the the .desktop file call the
wrapper instead of the openttd binary directly.
Index: media/openttd.desktop.in
===================================================================
--- a/media/openttd.desktop.in (revision 20124)
+++ b/media/openttd.desktop.in (working copy)
@@ -5,7 +5,7 @@
Version=1.1
Name=!!MENU_NAME!!
Icon=openttd
-Exec=!!TTD!!
+Exec=/usr/share/games/openttd/openttd-wrapper
Terminal=false
Categories=!!MENU_GROUP!!
Comment=A clone of Transport Tycoon Deluxe

@ -1 +0,0 @@
run-openttd-wrapper.patch

@ -1,50 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Makefile to build the openttd debian package.
# Use debhelper default for all targets (but some are overridden below).
%:
dh --parallel $@
DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
# This prevents linking uselessly to libicudata and silences a warning
# in the build process.
DEB_LDFLAGS_MAINT_APPEND="-Wl,-as-needed"
# Enable all hardening options (since openttd offers a network-listening
# service that handles untrusted data).
DEB_BUILD_MAINT_OPTIONS=hardening=+all
# Load buildflags (this uses dpkg-buildflags). Note that we don't export
# them, but instead pass them to ./configure explicitly.
include /usr/share/dpkg/buildflags.mk
# Pass custom options to configure. Since it's not autoconf but a custom
# script, some of the option names are slightly different. We also need
# to be explicit about the dependencies, in case we're not running in a
# clean build root.
override_dh_auto_configure:
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu-sort --with-liblzo2 --with-lzma --without-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
# Do some extra installation
override_dh_auto_install:
$(MAKE) install DO_NOT_INSTALL_CHANGELOG=1 DO_NOT_INSTALL_LICENSE=1
# Don't do testing. Because the OpenTTD Makefile always does dependency
# generation (even on invalid targets), dh_auto_test thinks there is a
# "test" target, while there isn't.
override_dh_auto_test:
# Call mrproper. Again, dh_auto_clean thinks there is a distclean
# target, while there isn't.
override_dh_auto_clean:
[ ! -f Makefile ] || $(MAKE) mrproper
# We want to strip the debug informatiton into the -dbg package.
override_dh_strip:
dh_strip --dbg-package=openttd-dbg

@ -1,5 +0,0 @@
version=3
options=downloadurlmangle=s/(.*)\/index.html$/\1\/openttd-\1-source.tar.gz/ \
http://master.binaries.openttd.org/releases/ \
(\d+(?:\.\d+)*)/index.html

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${CPACK_BUNDLE_NAME}</string>
<key>CFBundleExecutable</key>
<string>${CPACK_BUNDLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>#CPACK_PACKAGE_VERSION#, Copyright 2004-${CURRENT_YEAR} The OpenTTD team</string>
<key>CFBundleIconFile</key>
<string>${CPACK_BUNDLE_NAME}.icns</string>
<key>CFBundleIdentifier</key>
<string>org.openttd.openttd</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${CPACK_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>#CPACK_PACKAGE_VERSION#</string>
<key>CFBundleVersion</key>
<string>#CPACK_PACKAGE_VERSION#</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2004-${CURRENT_YEAR} The OpenTTD team</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

@ -0,0 +1,8 @@
#!/bin/sh
ROOT_DIR=$(dirname "$0")/..
export DYLD_LIBRARY_PATH=${ROOT_DIR}/Frameworks
cd ${ROOT_DIR}/Resources
exec ./openttd "$@"

@ -1,46 +0,0 @@
#!/bin/sh
# sets VERSION to the value if RELEASE if there are any,
# otherwise it sets VERSION to revision number
if [ "$3" ]; then
VERSION="$3"
else
VERSION="$2"
fi
date=`date +%Y`
# Generates Info.plist while applying $VERSION
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
\"http://www.apple.com/DTDs/Prop$
<plist version=\"1.0\">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>OpenTTD</string>
<key>CFBundleExecutable</key>
<string>openttd</string>
<key>CFBundleGetInfoString</key>
<string>$VERSION, Copyright 2004-$date The OpenTTD team</string>
<key>CFBundleIconFile</key>
<string>openttd.icns</string>
<key>CFBundleIdentifier</key>
<string>org.openttd.openttd</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>OpenTTD</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION</string>
<key>CFBundleVersion</key>
<string>$VERSION</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2004-$date The OpenTTD team</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>" > "$1"/Contents/Info.plist

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

@ -1,6 +0,0 @@
# the man page is in the subpackage data
addFilter("openttd.*: W: no-manual-page-for-binary openttd")
# no other package depends on this package, so this should not matter
addFilter("openttd.*: W: file-contains-date-and-time /usr/bin/openttd")
addFilter("openttd.*: W: file-contains-current-date /usr/bin/openttd")

@ -1,100 +0,0 @@
-------------------------------------------------------------------
Sun Mar 6 09:36:55 UTC 2011 - ammler@openttdcoop.org
- upstream update 1.1.0-RC2
* Feature: XZ/LZMA2 savegame support. New default reduces
savegame size by 10 to 30% with slightly more CPU usage.
(requires xz-devel)
* Feature: Remote administration
* Feature: a lot improvements with GUI
* Feature: Customizable hotkeys
* Sources for openttd.grf are pngs (requires grfcodec >= 5.1)
-------------------------------------------------------------------
Sun Nov 21 11:11:38 UTC 2010 - ammler@openttdcoop.org
- upstream update 1.0.5
* Fix: Reading (very) recently freed memory [CVE-2010-4168]
-------------------------------------------------------------------
Sun Oct 31 17:53:41 UTC 2010 - ammler@openttdcoop.org
- upstream update 1.0.4
* build openttd.grf from source
-------------------------------------------------------------------
Tue Aug 10 20:16:03 UTC 2010 - ammler@openttdcoop.org
- upstream update 1.0.3
-------------------------------------------------------------------
Wed Jun 23 11:42:59 UTC 2010 - Marcel Gmür <ammler@openttdcoop.org>
- upstream update 1.0.2
* Feature: Translated desktop shortcut comments (r19884)
* many minor Bugfixes
-------------------------------------------------------------------
Sat May 1 15:59:32 UTC 2010 - Marcel Gmür <ammler@openttdcoop.org>
- upstream update 1.0.1
* Fix: Leaking a file descriptor
* Fix a lot small bugs, like minor desync issues on Mulitplayer
- no strip on make
-------------------------------------------------------------------
Thu Apr 1 08:53:54 UTC 2010 - Marcel Gmür <ammler@openttdcoop.org>
- upstream update 1.0.0 (finally!)
* completely independent game but still working also
with ttd original gaphics, sounds and music
- Add: Recommends openmsx
- requires lzo2
-------------------------------------------------------------------
Fri Dec 18 2009 Marcel Gmür <ammler@openttdcoop.org> - 0.7.4
- support for different branches
- easy support for dedicated branch
- let openttd build system make the dektop file
- split the package to data and gui
- disable requires
-------------------------------------------------------------------
Thu Oct 01 2009 Marcel Gmür <ammler@openttdcoop.org> - 0.7.3
- disable libicu for RHEL4
-------------------------------------------------------------------
Sat Sep 26 2009 Marcel Gmür <ammler@openttdcoop.org> - 0.7.2
- no subfolder games for datadir
- cleanup: no post and postun anymore
- Recommends: opengfx (for suse and mandriva)
- add SUSE support
-------------------------------------------------------------------
Mon Oct 20 2008 Benedikt Brüggemeier <skidd13@openttd.org>
- Added libicu dependency
-------------------------------------------------------------------
Thu Sep 23 2008 Benedikt Brüggemeier <skidd13@openttd.org>
- Merged both versions of the spec file
-------------------------------------------------------------------
Fri Aug 29 2008 Jonathan Coome <maedhros@openttd.org>
- Rewrite spec file from scratch.
-------------------------------------------------------------------
Sat Aug 02 2008 Benedikt Brüggemeier <skidd13@openttd.org>
- Updated spec file
-------------------------------------------------------------------
Thu Mar 27 2008 Denis Burlaka <burlaka@yandex.ru>
- Universal spec file

@ -1,272 +0,0 @@
#
# spec file for package openttd
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007-2019 The OpenTTD developers
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: openttd
Version: 1.11.beta1
Release: 0
%define srcver 1.11.0-beta1
Summary: An open source reimplementation of Chris Sawyer's Transport Tycoon Deluxe
License: GPL-2.0
Group: Amusements/Games/Strategy/Other
Url: http://www.openttd.org
Source: http://binaries.openttd.org/releases/%{srcver}/%{name}-%{srcver}-source.tar.gz
%if 0%{?suse_version} || 0%{?mdkversion}
Recommends: %{name}-gui
%endif
BuildRequires: gcc-c++
BuildRequires: libpng-devel
BuildRequires: zlib-devel
%if 0%{?suse_version} || 0%{?mdkversion}
BuildRequires: update-alternatives
Requires: update-alternatives
%else
BuildRequires: chkconfig
Requires: chkconfig
%endif
%if 0%{?mdkversion}
BuildRequires: liblzma-devel
BuildRequires: liblzo-devel
%else
BuildRequires: lzo-devel
BuildRequires: xz-devel
%endif
# OBS workaround: needed by libdrm
%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
BuildRequires: kernel
%endif
# for lzma detection
%if 0%{?suse_version}
BuildRequires: pkg-config
%endif
# building openttd.grf is not required as it is a) part of source and
# b) required only, if you want to use the original set
%if 0%{?with_grfcodec}
BuildRequires: grfcodec
%endif
# Recommends would fit better but not well supported...
Requires: openttd-opengfx >= 0.4.2
Obsoletes: %{name}-data < %{version}
Provides: %{name}-data = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
with lots of new features and enhancements. To play the game you need either
the original data from the game or install the recommend subackages OpenGFX for
free graphics, OpenSFX for free sounds and OpenMSX for free music.
OpenTTD is licensed under the GNU General Public License version 2.0. For more
information, see the file 'COPYING.md' included with every release and source
download of the game.
%package gui
Summary: OpenTTD GUI/Client (requires SDL)
Group: Amusements/Games/Strategy/Other
Requires: %{name}
Conflicts: %{name}-dedicated
BuildRequires: SDL2-devel
BuildRequires: fontconfig-devel
%if 0%{?rhel_version} != 600
BuildRequires: libicu-devel
%endif
%if 0%{?rhel_version} || 0%{?fedora}
BuildRequires: freetype-devel
%endif
%if 0%{?suse_version} || 0%{?mdkversion}
BuildRequires: freetype2-devel
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%else
BuildRequires: desktop-file-utils
Requires: hicolor-icon-theme
%endif
%if 0%{?suse_version} || 0%{?mdkversion}
Recommends: openttd-openmsx
Recommends: openttd-opensfx
%endif
%description gui
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
with lots of new features and enhancements. To play the game you need either
the original data from the game or install the recommend subackages OpenGFX for
free graphics, OpenSFX for free sounds and OpenMSX for free music.
This subpackage provides the binary which needs SDL.
%package dedicated
Summary: OpenTTD Dedicated Server binary (without SDL)
Group: Amusements/Games/Strategy/Other
Requires: %{name}
Conflicts: %{name}-gui
%description dedicated
OpenTTD is a reimplementation of the Microprose game "Transport Tycoon Deluxe"
with lots of new features and enhancements. To play the game you need either
the original data from the game or the required package OpenGFX and OpenSFX.
This subpackage provides the binary without dependency of SDL.
%prep
%setup -qn openttd%{?branch:-%{branch}}-%{srcver}
# we build the grfs from sources but validate the result with the existing data
%if 0%{?with_grfcodec}
md5sum bin/data/* > validate.data
%endif
%build
# first, we build the dedicated binary and copy it to dedicated/
./configure \
--prefix-dir="%{_prefix}" \
--binary-dir="bin" \
--data-dir="share/%{name}" \
--enable-dedicated
make %{?_smp_mflags} BUNDLE_DIR="dedicated" bundle
# then, we build the common gui version which we install the usual way
./configure \
--prefix-dir="%{_prefix}" \
--binary-name="%{name}" \
--binary-dir="bin" \
--data-dir="share/%{name}" \
--doc-dir="share/doc/%{name}" \
--menu-name="OpenTTD%{?branch: %{branch}}" \
--menu-group="Game;StrategyGame;"
make %{?_smp_mflags}
%install
# install the dedicated binary
install -D -m0755 dedicated/openttd %{buildroot}%{_bindir}/%{name}-dedicated
# install the gui binary and rename to openttd-gui
make install INSTALL_DIR=%{buildroot}
mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}-gui
# we need a dummy target for /etc/alternatives/openttd
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/%{name}
ln -s -f /etc/alternatives/%{name} %{buildroot}%{_bindir}/%{name}
%if 0%{?suse_version}
%suse_update_desktop_file -r %{name} Game StrategyGame
%else
%if 0%{?fedora} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
desktop-file-install --dir=%{buildroot}%{_datadir}/applications \
--add-category=StrategyGame \
media/openttd.desktop
%endif
%endif
%if 0%{?with_grfcodec}
%check
md5sum -c validate.data
%endif
%post gui
/usr/sbin/update-alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-gui 10
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%post dedicated
/usr/sbin/update-alternatives --install %{_bindir}/%{name} %{name} %{_bindir}/%{name}-dedicated 0
%preun gui
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove %{name} %{_bindir}/%{name}-gui
fi
%preun dedicated
if [ "$1" = 0 ] ; then
/usr/sbin/update-alternatives --remove %{name} %{_bindir}/%{name}-dedicated
fi
%postun gui
if [ "$1" -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans gui
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
# we need a file in the main package so it will be made
%files
%defattr(-, root, root)
%dir %{_datadir}/doc/%{name}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/lang
%dir %{_datadir}/%{name}/baseset
%dir %{_datadir}/%{name}/scripts
%dir %{_datadir}/%{name}/ai
%dir %{_datadir}/%{name}/game
%{_datadir}/doc/%{name}/*
%{_datadir}/%{name}/lang/*
%{_datadir}/%{name}/baseset/*
%{_datadir}/%{name}/scripts/*
%{_datadir}/%{name}/ai/*
%{_datadir}/%{name}/game/*
%doc %{_mandir}/man6/%{name}.6.*
%files gui
%defattr(-, root, root)
%ghost %{_sysconfdir}/alternatives/%{name}
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}-gui
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/16x16
%dir %{_datadir}/icons/hicolor/16x16/apps
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/32x32/apps
%dir %{_datadir}/icons/hicolor/48x48
%dir %{_datadir}/icons/hicolor/48x48/apps
%dir %{_datadir}/icons/hicolor/64x64
%dir %{_datadir}/icons/hicolor/64x64/apps
%dir %{_datadir}/icons/hicolor/128x128
%dir %{_datadir}/icons/hicolor/128x128/apps
%dir %{_datadir}/icons/hicolor/256x256
%dir %{_datadir}/icons/hicolor/256x256/apps
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
%{_datadir}/icons/hicolor/64x64/apps/%{name}.png
%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%{_datadir}/pixmaps/%{name}.32.xpm
%files dedicated
%defattr(-, root, root)
%ghost %{_bindir}/%{name}
%ghost %{_sysconfdir}/alternatives/%{name}
%{_bindir}/%{name}-dedicated
%changelog

@ -1,4 +0,0 @@
@echo off
"c:\Program Files\NSIS\makensis.exe" /DVERSION_INCLUDE=version_win9x.txt install.nsi > win9x.log
"c:\Program Files\NSIS\makensis.exe" /DVERSION_INCLUDE=version_win32.txt install.nsi > win32.log
"c:\Program Files\NSIS\makensis.exe" /DVERSION_INCLUDE=version_win64.txt install.nsi > win64.log

@ -1,26 +0,0 @@
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=3
[Field 1]
Type=Groupbox
Text=Transport Tycoon Deluxe Installation location
Left=6
Right=294
Top=68
Bottom=100
[Field 2]
Type=DirRequest
Left=10
Right=290
Top=80
Bottom=92
[Field 3]
Type=Label
Left=17
Right=282
Top=6
Bottom=64

@ -1,744 +0,0 @@
# Version numbers to update
!define APPV_MAJOR 1
!define APPV_MINOR 11
!define APPV_MAINT 0
!define APPV_BUILD 0
!define APPV_EXTRA "-beta1"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
!define APPVERSIONINTERNAL "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}.${APPV_BUILD}" ; Define application version in X.X.X.X
!define INSTALLERVERSION ${APPV_MAJOR}${APPV_MINOR}${APPV_MAINT}${APPV_BUILD}
!include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define OPENGFX_BASE_VERSION "1.2.0"
!define OPENSFX_BASE_VERSION "0.8.0"
!define OPENMSX_BASE_VERSION "1.0.0"
!define MUI_ICON "..\..\..\media\openttd.ico"
!define MUI_UNICON "..\..\..\media\openttd.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "top.bmp"
ManifestDPIAware true
BrandingText "OpenTTD Installer"
SetCompressor LZMA
; Version Info
Var AddWinPrePopulate
VIProductVersion "${APPVERSIONINTERNAL}"
VIAddVersionKey "ProductName" "OpenTTD ${APPBITS}-bit Installer for Windows ${EXTRA_VERSION}"
VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "CompanyName" "OpenTTD Developers"
VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "ProductVersion" "${APPVERSION}"
VIAddVersionKey "InternalName" "InstOpenTTD-${APPARCH}"
VIAddVersionKey "FileVersion" "${APPVERSION}-${APPARCH}"
VIAddVersionKey "LegalCopyright" " "
; Main Install settings
Name "${APPNAMEANDVERSION} ${APPBITS}-bit for Windows ${EXTRA_VERSION}"
; NOTE: Keep trailing backslash!
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder"
OutFile "openttd-${APPVERSION}-${APPARCH}.exe"
CRCCheck force
ShowInstDetails show
ShowUninstDetails show
RequestExecutionLevel admin
Var SHORTCUTS
Var CDDRIVE
; Modern interface settings
!include "MUI2.nsh"
!include "InstallOptions.nsh"
!include "WinVer.nsh"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\..\COPYING.md"
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_COMPONENTS
;---------------------------------
; Custom page for finding TTDLX CD
Page custom SelectCDEnter SelectCDExit ": TTD folder"
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_DEFAULTFOLDER $SHORTCUTS
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKEY_LOCAL_MACHINE"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Shortcut Folder"
!insertmacro MUI_PAGE_STARTMENU "OpenTTD" $SHORTCUTS
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!"
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe"
!define MUI_FINISHPAGE_LINK "Visit the OpenTTD site for more information"
!define MUI_FINISHPAGE_LINK_LOCATION "${APPURLLINK}"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.md"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_WELCOMEFINISHPAGE_CUSTOMFUNCTION_INIT DisableBack
!insertmacro MUI_PAGE_FINISH
!define MUI_PAGE_HEADER_TEXT "Uninstall ${APPNAMEANDVERSION}"
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------------------------------------
; (Core) OpenTTD install section. Copies all internal game data
Section "!OpenTTD" Section1
; Make sure to be upgraded OpenTTD is not running
Call CheckOpenTTDRunning
; Overwrite files by default, but don't complain on failure
SetOverwrite try
SetShellVarContext all
; Define root variable relative to installer
!define PATH_ROOT "..\..\..\"
; Copy language files
SetOutPath "$INSTDIR\lang\"
File ${PATH_ROOT}bin\lang\english.lng
; Copy AI files
SetOutPath "$INSTDIR\ai\"
File ${PATH_ROOT}bin\ai\compat_*.nut
; Copy Game Script files
SetOutPath "$INSTDIR\game\"
File ${PATH_ROOT}bin\game\compat_*.nut
; Copy data files
SetOutPath "$INSTDIR\baseset\"
File ${PATH_ROOT}bin\baseset\*.grf
File ${PATH_ROOT}bin\baseset\*.obg
File ${PATH_ROOT}bin\baseset\*.obm
File ${PATH_ROOT}bin\baseset\*.obs
File ${PATH_ROOT}bin\baseset\opntitle.dat
; Copy the scripts
SetOutPath "$INSTDIR\scripts\"
File ${PATH_ROOT}bin\scripts\*.*
Push "$INSTDIR\scripts\README.md"
Call unix2dos
; Copy some documentation files
SetOutPath "$INSTDIR\docs\"
File ${PATH_ROOT}docs\multiplayer.md
Push "$INSTDIR\docs\multiplayer.md"
Call unix2dos
; Copy the rest of the stuff
SetOutPath "$INSTDIR\"
; Copy text files
File ${PATH_ROOT}changelog.txt
Push "$INSTDIR\changelog.txt"
Call unix2dos
File ${PATH_ROOT}COPYING.md
Push "$INSTDIR\COPYING.md"
Call unix2dos
File ${PATH_ROOT}README.md
Push "$INSTDIR\README.md"
Call unix2dos
File ${PATH_ROOT}known-bugs.txt
Push "$INSTDIR\known-bugs.txt"
Call unix2dos
; Copy executable
File /oname=openttd.exe ${BINARY_DIR}\openttd.exe
; Delete old files from the main dir. they are now placed in baseset/ and lang/
Delete "$INSTDIR\*.lng"
Delete "$INSTDIR\*.grf"
Delete "$INSTDIR\sample.cat"
Delete "$INSTDIR\ttd.exe"
Delete "$INSTDIR\data\opntitle.dat"
Delete "$INSTDIR\data\2ccmap.grf"
Delete "$INSTDIR\data\airports.grf"
Delete "$INSTDIR\data\autorail.grf"
Delete "$INSTDIR\data\canalsw.grf"
Delete "$INSTDIR\data\dosdummy.grf"
Delete "$INSTDIR\data\elrailsw.grf"
Delete "$INSTDIR\data\nsignalsw.grf"
Delete "$INSTDIR\data\openttd.grf"
Delete "$INSTDIR\data\roadstops.grf"
Delete "$INSTDIR\data\trkfoundw.grf"
Delete "$INSTDIR\data\openttdd.grf"
Delete "$INSTDIR\data\openttdw.grf"
Delete "$INSTDIR\data\orig_win.obg"
Delete "$INSTDIR\data\orig_dos.obg"
Delete "$INSTDIR\data\orig_dos_de.obg"
Delete "$INSTDIR\data\orig_win.obs"
Delete "$INSTDIR\data\orig_dos.obs"
Delete "$INSTDIR\data\no_sound.obs"
; Create the Registry Entries
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Comments" "Visit ${APPURLLINK}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayIcon" "$INSTDIR\openttd.exe,0"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayName" "OpenTTD ${APPVERSION}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion" "${APPVERSION}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "HelpLink" "${APPURLLINK}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" "$INSTDIR"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Publisher" "OpenTTD"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder" "$SHORTCUTS"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "URLInfoAbout" "${APPURLLINK}"
; This key sets the Version DWORD that new installers will check against
WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" ${INSTALLERVERSION}
!insertmacro MUI_STARTMENU_WRITE_BEGIN "OpenTTD"
CreateShortCut "$DESKTOP\OpenTTD.lnk" "$INSTDIR\openttd.exe"
CreateDirectory "$SMPROGRAMS\$SHORTCUTS"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\OpenTTD.lnk" "$INSTDIR\openttd.exe"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Readme.lnk" "$INSTDIR\README.md"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Changelog.lnk" "$INSTDIR\Changelog.txt"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Known-bugs.lnk" "$INSTDIR\known-bugs.txt"
CreateDirectory "$SMPROGRAMS\$SHORTCUTS\Docs"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Docs\Multiplayer.lnk" "$INSTDIR\docs\multiplayer.md"
CreateDirectory "$SMPROGRAMS\$SHORTCUTS\Scripts"
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Scripts\Readme.lnk" "$INSTDIR\scripts\README.md"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;--------------------------------------------------------------
; OpenTTD translation install section. Copies only translations
Section "OpenTTD translations" Section6
; Overwrite files by default, but don't complain on failure
SetOverwrite try
; Copy language files
SetOutPath "$INSTDIR\lang\"
File ${PATH_ROOT}bin\lang\*.lng
SectionEnd
;----------------------------------------------------------------------------------
; OpenGFX files install section. Downloads OpenGFX and installs it
Section "Download OpenGFX (free graphics set)" Section3
SetOverwrite try
NSISdl::download "http://binaries.openttd.org/installer/opengfx-${OPENGFX_BASE_VERSION}.7z" "$INSTDIR\baseset\opengfx.7z"
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Downloading of OpenGFX failed"
Goto Done
; Let's extract the files
SetOutPath "$INSTDIR\baseset\"
NSIS7z::Extract "$INSTDIR\baseset\opengfx.7z"
Delete "$INSTDIR\baseset\opengfx.7z"
SetOutPath "$INSTDIR\"
Done:
SectionEnd
;----------------------------------------------------------------------------------
; OpenSFX files install section. Downloads OpenSFX and installs it
Section "Download OpenSFX (free sound set)" Section4
SetOverwrite try
NSISdl::download "http://binaries.openttd.org/installer/opensfx-${OPENSFX_BASE_VERSION}.7z" "$INSTDIR\baseset\opensfx.7z"
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Downloading of OpenSFX failed"
Goto Done
; Let's extract the files
SetOutPath "$INSTDIR\baseset\"
NSIS7z::Extract "$INSTDIR\baseset\opensfx.7z"
Delete "$INSTDIR\baseset\opensfx.7z"
SetOutPath "$INSTDIR\"
Done:
SectionEnd
;----------------------------------------------------------------------------------
; OpenMSX files install section. Downloads OpenMSX and installs it
Section "Download OpenMSX (free music set)" Section5
SetOverwrite try
NSISdl::download "http://binaries.openttd.org/installer/openmsx-${OPENMSX_BASE_VERSION}.7z" "$INSTDIR\baseset\openmsx.7z"
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Downloading of OpenMSX failed"
Goto Done
; Let's extract the files
SetOutPath "$INSTDIR\baseset\"
NSIS7z::Extract "$INSTDIR\baseset\openmsx.7z"
Delete "$INSTDIR\baseset\openmsx.7z"
SetOutPath "$INSTDIR\"
Done:
SectionEnd
;----------------------------------------------------------------------------------
; TTDLX files install section. Copies all needed TTDLX files from CD or install dir
Section /o "Copy data from Transport Tycoon Deluxe CD-ROM" Section2
SetOverwrite try
; Let's copy the files with size approximation
SetOutPath "$INSTDIR\baseset"
CopyFiles "$CDDRIVE\gm\*.gm" "$INSTDIR\baseset\" 1028
CopyFiles "$CDDRIVE\gm.cat" "$INSTDIR\baseset\gm.cat" 415
CopyFiles "$CDDRIVE\sample.cat" "$INSTDIR\baseset\sample.cat" 1566
; Copy Windows files
CopyFiles "$CDDRIVE\trg1r.grf" "$INSTDIR\baseset\trg1r.grf" 2365
CopyFiles "$CDDRIVE\trgcr.grf" "$INSTDIR\baseset\trgcr.grf" 260
CopyFiles "$CDDRIVE\trghr.grf" "$INSTDIR\baseset\trghr.grf" 400
CopyFiles "$CDDRIVE\trgir.grf" "$INSTDIR\baseset\trgir.grf" 334
CopyFiles "$CDDRIVE\trgtr.grf" "$INSTDIR\baseset\trgtr.grf" 546
; Copy DOS files
CopyFiles "$CDDRIVE\trg1.grf" "$INSTDIR\baseset\trg1.grf" 2365
CopyFiles "$CDDRIVE\trgc.grf" "$INSTDIR\baseset\trgc.grf" 260
CopyFiles "$CDDRIVE\trgh.grf" "$INSTDIR\baseset\trgh.grf" 400
CopyFiles "$CDDRIVE\trgi.grf" "$INSTDIR\baseset\trgi.grf" 334
CopyFiles "$CDDRIVE\trgt.grf" "$INSTDIR\baseset\trgt.grf" 546
SetOutPath "$INSTDIR\"
SectionEnd
;-------------------------------------------
; Install the uninstaller (option is hidden)
Section -FinishSection
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} "Minimal OpenTTD installation in English. You need at least one of the game graphics and sound sets installed."
!insertmacro MUI_DESCRIPTION_TEXT ${Section6} "Translations of OpenTTD."
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Download the free OpenGFX game graphics set. This download is about 3 MiB."
!insertmacro MUI_DESCRIPTION_TEXT ${Section4} "Download the free OpenSFX game sound set. This download is about 10 MiB."
!insertmacro MUI_DESCRIPTION_TEXT ${Section5} "Download the free OpenMSX game music set. This download is about 200 KiB."
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Copies the game graphics, sounds and music from the Transport Tycoon Deluxe CD."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;-----------------------------------------------
; Uninstall section, deletes all installed files
Section "Uninstall"
SetShellVarContext all
IfFileExists "$INSTDIR\save" 0 NoRemoveSavedGames
MessageBox MB_YESNO|MB_ICONQUESTION \
"Remove the save game folders located at $\"$INSTDIR\save$\"?$\n \
If you choose Yes, your saved games will be deleted." \
IDYES RemoveSavedGames IDNO NoRemoveSavedGames
RemoveSavedGames:
Delete "$INSTDIR\save\autosave\*"
RMDir "$INSTDIR\save\autosave"
Delete "$INSTDIR\save\*"
RMDir "$INSTDIR\save"
NoRemoveSavedGames:
IfFileExists "$INSTDIR\scenario" 0 NoRemoveScen
MessageBox MB_YESNO|MB_ICONQUESTION \
"Remove the scenario folders located at $\"$INSTDIR\scenario$\"?$\n \
If you choose Yes, your scenarios will be deleted." \
IDYES RemoveScen IDNO NoRemoveScen
RemoveScen:
Delete "$INSTDIR\scenario\heightmap*"
RMDir "$INSTDIR\scenario\heightmap"
Delete "$INSTDIR\scenario\*"
RMDir "$INSTDIR\scenario"
NoRemoveScen:
; Remove from registry...
!insertmacro MUI_STARTMENU_GETFOLDER "OpenTTD" $SHORTCUTS
ReadRegStr $SHORTCUTS HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD"
; Delete self
Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts
Delete "$DESKTOP\OpenTTD.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\OpenTTD.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Uninstall.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Readme.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Changelog.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Known-bugs.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Docs\Multiplayer.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Docs\32bpp.lnk"
Delete "$SMPROGRAMS\$SHORTCUTS\Scripts\Readme.lnk"
; Clean up OpenTTD dir
Delete "$INSTDIR\changelog.txt"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\known-bugs.txt"
Delete "$INSTDIR\openttd.exe"
Delete "$INSTDIR\COPYING.md"
Delete "$INSTDIR\INSTALL.LOG"
Delete "$INSTDIR\crash.log"
Delete "$INSTDIR\crash.dmp"
Delete "$INSTDIR\openttd.cfg"
Delete "$INSTDIR\hs.dat"
Delete "$INSTDIR\cached_sprites.*"
Delete "$INSTDIR\save\autosave\network*.tmp" ; temporary network file
; AI files
Delete "$INSTDIR\ai\compat_*.nut"
; Game Script files
Delete "$INSTDIR\game\compat_*.nut"
; Baseset files
Delete "$INSTDIR\baseset\opntitle.dat"
Delete "$INSTDIR\baseset\openttd.grf"
Delete "$INSTDIR\baseset\orig_extra.grf"
Delete "$INSTDIR\baseset\orig_win.obg"
Delete "$INSTDIR\baseset\orig_dos.obg"
Delete "$INSTDIR\baseset\orig_dos_de.obg"
Delete "$INSTDIR\baseset\orig_win.obs"
Delete "$INSTDIR\baseset\orig_dos.obs"
Delete "$INSTDIR\baseset\no_sound.obs"
Delete "$INSTDIR\baseset\sample.cat"
Delete "$INSTDIR\baseset\trg1r.grf"
Delete "$INSTDIR\baseset\trghr.grf"
Delete "$INSTDIR\baseset\trgtr.grf"
Delete "$INSTDIR\baseset\trgcr.grf"
Delete "$INSTDIR\baseset\trgir.grf"
Delete "$INSTDIR\baseset\trg1.grf"
Delete "$INSTDIR\baseset\trgh.grf"
Delete "$INSTDIR\baseset\trgt.grf"
Delete "$INSTDIR\baseset\trgc.grf"
Delete "$INSTDIR\baseset\trgi.grf"
Delete "$INSTDIR\baseset\gm.cat"
Delete "$INSTDIR\baseset\gm-tto.cat"
Delete "$INSTDIR\baseset\*.gm"
Delete "$INSTDIR\data\sample.cat"
Delete "$INSTDIR\data\trg1r.grf"
Delete "$INSTDIR\data\trghr.grf"
Delete "$INSTDIR\data\trgtr.grf"
Delete "$INSTDIR\data\trgcr.grf"
Delete "$INSTDIR\data\trgir.grf"
Delete "$INSTDIR\data\trg1.grf"
Delete "$INSTDIR\data\trgh.grf"
Delete "$INSTDIR\data\trgt.grf"
Delete "$INSTDIR\data\trgc.grf"
Delete "$INSTDIR\data\trgi.grf"
Delete "$INSTDIR\gm\*.gm"
; Downloaded OpenGFX/OpenSFX/OpenMSX
Delete "$INSTDIR\baseset\opengfx\*"
RMDir "$INSTDIR\baseset\opengfx"
Delete "$INSTDIR\baseset\opensfx\*"
RMDir "$INSTDIR\baseset\opensfx"
Delete "$INSTDIR\baseset\openmsx\*"
RMDir "$INSTDIR\baseset\openmsx"
Delete "$INSTDIR\data\opengfx\*"
RMDir "$INSTDIR\data\opengfx"
Delete "$INSTDIR\data\opensfx\*"
RMDir "$INSTDIR\data\opensfx"
Delete "$INSTDIR\gm\openmsx\*"
RMDir "$INSTDIR\gm\openmsx"
; Language files
Delete "$INSTDIR\lang\*.lng"
; Scripts
Delete "$INSTDIR\scripts\*.*"
; Documentation
Delete "$INSTDIR\docs\*.*"
; Base sets for music
Delete "$INSTDIR\gm\orig_win.obm"
Delete "$INSTDIR\gm\orig_dos.obm"
Delete "$INSTDIR\gm\no_music.obm"
Delete "$INSTDIR\baseset\orig_win.obm"
Delete "$INSTDIR\baseset\orig_dos.obm"
Delete "$INSTDIR\baseset\no_music.obm"
; Remove remaining directories
RMDir "$SMPROGRAMS\$SHORTCUTS\Extras\"
RMDir "$SMPROGRAMS\$SHORTCUTS\Scripts\"
RMDir "$SMPROGRAMS\$SHORTCUTS\Docs\"
RMDir "$SMPROGRAMS\$SHORTCUTS"
RMDir "$INSTDIR\ai"
RMDir "$INSTDIR\game"
RMDir "$INSTDIR\data"
RMDir "$INSTDIR\baseset"
RMDir "$INSTDIR\gm"
RMDir "$INSTDIR\lang"
RMDir "$INSTDIR\scripts"
RMDir "$INSTDIR\docs"
RMDir "$INSTDIR"
SectionEnd
;------------------------------------------------------------
; Custom page function to find the TTDLX CD/install location
Function SelectCDEnter
SectionGetFlags ${Section2} $0
IntOp $1 $0 & 0x80 ; bit 7 set by upgrade, no need to copy files
IntCmp $1 1 DoneCD ; Upgrade doesn't need copy files
IntOp $0 $0 & 1
IntCmp $0 1 NoAbort
Abort
NoAbort:
GetTempFileName $R0
!insertmacro MUI_HEADER_TEXT "Locate TTD" "Setup needs the location of Transport Tycoon Deluxe in order to continue."
!insertmacro INSTALLOPTIONS_EXTRACT_AS "CDFinder.ini" "CDFinder"
ClearErrors
; Now, let's populate $CDDRIVE
ReadRegStr $R0 HKLM "SOFTWARE\Fish Technology Group\Transport Tycoon Deluxe" "HDPath"
IfErrors NoTTD
StrCmp $CDDRIVE "" 0 Populated
StrCpy $CDDRIVE $R0
Populated:
StrCpy $AddWinPrePopulate "Setup has detected your TTD folder. Don't change the folder. Simply press Next."
Goto TruFinish
NoTTD:
StrCpy $AddWinPrePopulate "Setup couldn't find TTD. Please enter the path where the graphics files from TTD are stored and press Next to continue."
TruFinish:
ClearErrors
!insertmacro INSTALLOPTIONS_WRITE "CDFinder" "Field 2" "State" $CDDRIVE ; TTDLX path
!insertmacro INSTALLOPTIONS_WRITE "CDFinder" "Field 3" "Text" $AddWinPrePopulate ; Caption
DoneCD:
; Initialize the dialog *AFTER* we've changed the text otherwise we won't see the changes
!insertmacro INSTALLOPTIONS_INITDIALOG "CDFinder"
!insertmacro INSTALLOPTIONS_SHOW
FunctionEnd
;----------------------------------------------------------------
; Custom page function when 'next' is selected for the TTDLX path
Function SelectCDExit
!insertmacro INSTALLOPTIONS_READ $CDDRIVE "CDFinder" "Field 2" "State"
; If trg1r.grf does not exist at the path, retry with DOS version
IfFileExists $CDDRIVE\trg1r.grf "" DosCD
IfFileExists $CDDRIVE\trgir.grf "" NoCD
IfFileExists $CDDRIVE\sample.cat hasCD NoCD
DosCD:
IfFileExists $CDDRIVE\TRG1.GRF "" NoCD
IfFileExists $CDDRIVE\TRGI.GRF "" NoCD
IfFileExists $CDDRIVE\SAMPLE.CAT hasCD NoCD
NoCD:
MessageBox MB_OK "Setup cannot continue without the Transport Tycoon Deluxe location!"
Abort
hasCD:
FunctionEnd
;-------------------------------------------------------------------------------
; Determine windows version, returns "win9x" if Win9x/Me/2000/XP SP2- or "winnt" for the rest on the stack
Function GetWindowsVersion
GetVersion::WindowsPlatformArchitecture
Pop $R0
IntCmp $R0 64 WinNT 0
ClearErrors
StrCpy $R0 "win9x"
${If} ${IsNT}
${If} ${IsWinXP}
${AndIf} ${AtLeastServicePack} 3
${OrIf} ${AtLeastWin2003}
GoTo WinNT
${EndIf}
${EndIf}
GoTo Done
WinNT:
StrCpy $R0 "winnt"
Done:
Push $R0
FunctionEnd
;-------------------------------------------------------------------------------
; Check whether we're not running an installer for 64 bits on 32 bits and vice versa
Function CheckProcessorArchitecture
GetVersion::WindowsPlatformArchitecture
Pop $R0
IntCmp $R0 64 Win64 0
ClearErrors
IntCmp ${APPBITS} 64 0 Done
MessageBox MB_YESNO|MB_ICONSTOP "You are trying to install the 64-bit OpenTTD on a 32-bit operating system. This is not going to work. Please download the correct version. Do you really want to continue?" IDYES Done IDNO Abort
GoTo Done
Win64:
ClearErrors
IntCmp ${APPBITS} 64 Done 0
MessageBox MB_YESNO|MB_ICONINFORMATION "You are trying to install the 32-bit OpenTTD on a 64-bit operating system. This is not advised, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDYES Done IDNO Abort
GoTo Done
Abort:
Quit
Done:
FunctionEnd
;-------------------------------------------------------------------------------
; Check whether we're not running an installer for NT on 9x and vice versa
Function CheckWindowsVersion
Call GetWindowsVersion
Pop $R0
StrCmp $R0 "win9x" 0 WinNT
ClearErrors
StrCmp ${APPARCH} "win9x" Done 0
MessageBox MB_YESNO|MB_ICONSTOP "You are trying to install the Windows XP SP3 and newer version on Windows 95, 98, ME, 2000, or XP without SP3. This will not work - please download the correct version. Do you really want to continue?" IDYES Done IDNO Abort
GoTo Done
WinNT:
ClearErrors
StrCmp ${APPARCH} "win9x" 0 Done
MessageBox MB_YESNO|MB_ICONEXCLAMATION "You are trying to install the Windows 95, 98, 2000 and XP without SP3 version on Windows XP SP3 or newer. This is not advised, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDYES Done IDNO Abort
Abort:
Quit
Done:
FunctionEnd
;-------------------------------------------------------------------------------
; Check whether OpenTTD is running
Function CheckOpenTTDRunning
IfFileExists "$INSTDIR\openttd.exe" 0 Done
Retry:
FindProcDLL::FindProc "openttd.exe"
Pop $R0
IntCmp $R0 1 0 Done
ClearErrors
Delete "$INSTDIR\openttd.exe"
IfErrors 0 Done
ClearErrors
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "OpenTTD is running. Please close it and retry." IDRETRY Retry
Abort
Done:
FunctionEnd
;-------------------------------------------------------------------------------
; strips all CRs
; and then converts all LFs into CRLFs
; (this is roughly equivalent to "cat file | dos2unix | unix2dos")
;
; usage:
; Push "infile"
; Call unix2dos
;
; beware that this function destroys $0 $1 $2
Function unix2dos
ClearErrors
Pop $2
Rename $2 $2.U2D
FileOpen $1 $2 w
FileOpen $0 $2.U2D r
Push $2 ; save name for deleting
IfErrors unix2dos_done
; $0 = file input (opened for reading)
; $1 = file output (opened for writing)
unix2dos_loop:
; read a byte (stored in $2)
FileReadByte $0 $2
IfErrors unix2dos_done ; EOL
; skip CR
StrCmp $2 13 unix2dos_loop
; if LF write an extra CR
StrCmp $2 10 unix2dos_cr unix2dos_write
unix2dos_cr:
FileWriteByte $1 13
unix2dos_write:
; write byte
FileWriteByte $1 $2
; read next byte
Goto unix2dos_loop
unix2dos_done:
; close files
FileClose $0
FileClose $1
; delete original
Pop $0
Delete $0.U2D
FunctionEnd
Var OLDVERSION
Var UninstallString
;-----------------------------------------------------------------------------------
; NSIS Initialize function, determine if we are going to install/upgrade or uninstall
Function .onInit
StrCpy $SHORTCUTS "OpenTTD"
SectionSetSize ${Section3} 6144
SectionSetSize ${Section4} 13312
SectionSetSize ${Section5} 1024
SectionSetFlags 0 17
; Starts Setup - let's look for an older version of OpenTTD
ReadRegDWORD $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version"
IfErrors ShowWelcomeMessage ShowUpgradeMessage
ShowWelcomeMessage:
ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version"
; In the event someone still has OpenTTD 0.1, this will detect that (that installer used a string instead of dword entry)
IfErrors FinishCallback
ShowUpgradeMessage:
IntCmp ${INSTALLERVERSION} $R8 VersionsAreEqual InstallerIsOlder WelcomeToSetup
WelcomeToSetup:
; An older version was found. Let's let the user know there's an upgrade that will take place.
ReadRegStr $OLDVERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion"
; Gets the older version then displays it in a message box
MessageBox MB_OK|MB_ICONINFORMATION \
"Welcome to ${APPNAMEANDVERSION} Setup.$\nThis will allow you to upgrade from version $OLDVERSION."
SectionSetFlags ${Section2} 0x80 ; set bit 7
SectionSetFlags ${Section3} 0x80 ; set bit 7
SectionSetFlags ${Section4} 0x80 ; set bit 7
SectionSetFlags ${Section5} 0x80 ; set bit 7
Goto FinishCallback
VersionsAreEqual:
ReadRegStr $UninstallString HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString"
IfFileExists "$UninstallString" "" FinishCallback
MessageBox MB_YESNO|MB_ICONQUESTION \
"Setup detected ${APPNAMEANDVERSION} on your system. This is the same version that this program will install.$\nAre you trying to uninstall it?" \
IDYES DoUninstall IDNO FinishCallback
DoUninstall: ; You have the same version as this installer. This allows you to uninstall.
Exec "$UninstallString"
Quit
InstallerIsOlder:
MessageBox MB_OK|MB_ICONSTOP \
"You have a newer version of ${APPNAME}.$\nSetup will now exit."
Quit
FinishCallback:
ClearErrors
Call CheckProcessorArchitecture
Call CheckWindowsVersion
FunctionEnd
; eof

@ -1,5 +0,0 @@
!define APPBITS 32 ; Define number of bits for the architecture
!define EXTRA_VERSION "XP SP3 and newer"
!define APPARCH "win32" ; Define the application architecture
!define BINARY_DIR "${PATH_ROOT}objs\win32\Release"
InstallDir "$PROGRAMFILES32\OpenTTD\"

@ -1,5 +0,0 @@
!define APPBITS 64 ; Define number of bits for the architecture
!define EXTRA_VERSION "XP and newer"
!define APPARCH "win64" ; Define the application architecture
!define BINARY_DIR "${PATH_ROOT}objs\x64\Release"
InstallDir "$PROGRAMFILES64\OpenTTD\"

@ -1,5 +0,0 @@
!define APPBITS 32 ; Define number of bits for the architecture
!define EXTRA_VERSION "95, 98, ME, 2000 and XP SP2 or older"
!define APPARCH "win9x" ; Define the application architecture
!define BINARY_DIR "${PATH_ROOT}objs\release"
InstallDir "$PROGRAMFILES32\OpenTTD\"

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Loading…
Cancel
Save