SuperTuxKart 1.5 upstream source (from official release tarball)

This commit is contained in:
Benjamin
2026-06-11 20:04:02 +02:00
commit 2957e51aaa
8551 changed files with 1801800 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
for track in abyss candela_city cocoa_temple cornfield_crossing fortmagma gran_paradiso_island greenvalley hacienda lighthouse mansion mines minigolf olivermath sandtrack scotland snowmountain snowtuxpeak stk_enterprise volcano_island xr591 zengarden; do
echo "Testing $track"
$1 --log=0 -R \
--aiNP=nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok \
--track=$track --difficulty=3 --type=1 --test-ai=2 \
--profile-laps=10 --no-graphics > stdout.$track
done
+203
View File
@@ -0,0 +1,203 @@
#!/bin/sh
#
# (C) 2018 Dawid Gan, under the GPLv3
#
# A script that builds Android APKs for all architectures
#
# The script assumes that you know what you are doing. It allows to generate all
# packages for Google Play Store with single command. If you just want to build
# STK for your own use, then use android/make.sh script instead.
export BUILD_TYPE=Beta
export PROJECT_VERSION=git20211004
export PROJECT_CODE=299
export STK_STOREPASS="xxx"
export STK_KEYSTORE="/path/to/stk.keystore"
export STK_ALIAS="alias"
check_error()
{
if [ $? -gt 0 ]; then
echo "Error ocurred."
exit
fi
}
clean()
{
echo "Clean everything"
rm -rf ./android/assets
rm -rf ./android-output
cd android
./make.sh clean
cd -
}
generate_assets()
{
echo "Generate assets"
if [ -d "./android/assets" ]; then
echo "Assets already found in ./android/assets"
return
fi
cd ./android
DECREASE_QUALITY=0 \
CONVERT_TO_JPG=0 \
ASSETS_PATHS="../android-output/assets-lq/data" \
./generate_assets.sh
if [ ! -f "./assets/files.txt" ]; then
echo "Error: Couldn't generate assets"
return
fi
if [ -f "./assets/data/supertuxkart.git" ]; then
mv "./assets/data/supertuxkart.git" \
"./assets/data/supertuxkart.$PROJECT_VERSION"
sed -i "s/data\/supertuxkart.git/data\/supertuxkart.$PROJECT_VERSION/g" \
"./assets/files.txt"
fi
cd -
}
generate_full_assets()
{
echo "Generate zip file with full assets"
if [ -f "./android-output/stk-assets.zip" ]; then
echo "Full assets already found in ./android-output/stk-assets.zip"
return
fi
cp -a ./android/generate_assets.sh ./android-output/
cd ./android-output/
ONLY_ASSETS=1 \
TRACKS="all" \
TEXTURE_SIZE=512 \
JPEG_QUALITY=95 \
PNG_QUALITY=95 \
PNGQUANT_QUALITY=95 \
SOUND_QUALITY=112 \
SOUND_MONO=0 \
SOUND_SAMPLE=44100 \
OUTPUT_PATH="assets-hq" \
./generate_assets.sh
if [ ! -f "./assets-hq/files.txt" ]; then
echo "Error: Couldn't generate full assets"
return
fi
cd ./assets-hq/data
zip -r ../../stk-assets.zip ./*
cd ../../
rm ./generate_assets.sh
if [ ! -f "./stk-assets.zip" ]; then
echo "Error: Couldn't generate full assets"
return
fi
FULL_ASSETS_SIZE=`du -b ./stk-assets.zip | cut -f1`
sed -i "s/stk_assets_size = .*\;/stk_assets_size = $FULL_ASSETS_SIZE\;/g" \
"../src/utils/download_assets_size.hpp"
cd ../
}
generate_lq_assets()
{
echo "Generate zip file with lq assets"
if [ -f "./android-output/stk-assets-lq.zip" ]; then
echo "Full assets already found in ./android-output/stk-assets-lq..zip"
return
fi
cp -a ./android/generate_assets.sh ./android-output/
cd ./android-output/
ONLY_ASSETS=1 \
OUTPUT_PATH="assets-lq" \
./generate_assets.sh
if [ ! -f "./assets-lq/files.txt" ]; then
echo "Error: Couldn't generate lq assets"
return
fi
cd ./assets-lq/data
zip -r ../../stk-assets-lq.zip ./*
cd ../../
rm ./generate_assets.sh
if [ ! -f "./stk-assets-lq.zip" ]; then
echo "Error: Couldn't generate lq assets"
return
fi
cd ../
}
# Handle clean command
if [ ! -z "$1" ] && [ "$1" = "clean" ]; then
clean
exit
fi
#Build packages
if [ ! -d "./android-output" ]; then
mkdir ./android-output
fi
generate_lq_assets
generate_full_assets
generate_assets
if [ -f "./android-output/SuperTuxKart-$PROJECT_VERSION.apk" ]; then
echo "Package for architecture $ARCH1 is already built"
#exit
fi
cd ./android
./make_deps.sh
check_error
./make.sh
cd -
if [ ! -f ./android/build/outputs/apk/release/android-release.apk ]; then
echo "Error: Couldn't build apk"
exit
fi
if [ ! -f ./android/build/outputs/bundle/release/android-release.aab ]; then
echo "Error: Couldn't build app bundle"
exit
fi
cp ./android/build/outputs/apk/release/android-release.apk \
./android-output/SuperTuxKart-$PROJECT_VERSION.apk
cp ./android/build/outputs/bundle/release/android-release.aab \
./android-output/SuperTuxKart-$PROJECT_VERSION.aab
SYMBOLS_PATH="./android/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib"
for arch in $(ls "$SYMBOLS_PATH"); do
cp "$SYMBOLS_PATH/$arch/libmain.so" \
./android-output/SuperTuxKart-$PROJECT_VERSION-$arch-libmain.so
cp "$SYMBOLS_PATH/$arch/libSDL2.so" \
./android-output/SuperTuxKart-$PROJECT_VERSION-$arch-libSDL2.so
done
+73
View File
@@ -0,0 +1,73 @@
#!/bin/sh
# Tested in Ubuntu Server 24.04.2 LTS
patch_file=$(mktemp)
cat << 'EOF' > "$patch_file"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af9769a..3279caf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,9 +131,7 @@ if (ISPC_CROSS)
message(STATUS "Using iOS SDK path ${ISPC_IOS_SDK_PATH}")
endif()
else()
- set(ISPC_WINDOWS_TARGET OFF)
set(ISPC_PS_TARGET OFF)
- set(ISPC_IOS_TARGET OFF)
if (ISPC_MACOS_TARGET AND NOT ISPC_MACOS_SDK_PATH)
message (FATAL_ERROR "Set ISPC_MACOS_SDK_PATH variable for cross compilation to MacOS e.g. /iusers/MacOSX10.14.sdk")
endif()
diff --git a/builtins/builtins-c-cpu.cpp b/builtins/builtins-c-cpu.cpp
index 140419c..65b4f8e 100644
--- a/builtins/builtins-c-cpu.cpp
+++ b/builtins/builtins-c-cpu.cpp
@@ -39,11 +39,11 @@
// In unistd.h we need the definition of sysconf and _SC_NPROCESSORS_ONLN used as its arguments.
// We should include unistd.h, but it doesn't really work well for cross compilation, as
// requires us to carry around unistd.h, which is not available on Windows out of the box.
-#include <unistd.h>
+//#include <unistd.h>
// Just for the reference: these lines are eventually included from unistd.h
-// #define _SC_NPROCESSORS_ONLN 58
-// long sysconf(int);
+ #define _SC_NPROCESSORS_ONLN 58
+ long sysconf(int);
#endif // !_MSC_VER
#endif // !WASM
diff --git a/cmake/GenerateBuiltins.cmake b/cmake/GenerateBuiltins.cmake
index f403b16..56961d6 100644
--- a/cmake/GenerateBuiltins.cmake
+++ b/cmake/GenerateBuiltins.cmake
@@ -253,6 +253,10 @@ function (get_target_flags os arch out)
if (${os} STREQUAL "macos")
# -isystem/iusers/MacOSX10.14.sdk.tar/MacOSX10.14.sdk/usr/include
set(include -isystem${ISPC_MACOS_SDK_PATH}/usr/include)
+ elseif (${os} STREQUAL "ios")
+ set(include -isystem${ISPC_IOS_SDK_PATH}/usr/include)
+ elseif (${os} STREQUAL "windows")
+ set(include -I/usr/include)
elseif(NOT ${debian_triple} STREQUAL "")
# When compiling on Linux, there are two way to support cross targets:
# - add "foreign" architecture to the set of supported architectures and install corresponding toolchain.
EOF
apt-get update
apt install -y build-essential llvm cmake clang m4 bison flex libtbb-dev libclang-18-dev libclang-cpp-dev gcc-multilib g++-multilib
cd /opt
wget https://github.com/supertuxkart/dependencies/releases/download/cctools/cctools-14.1.tar.xz
tar xf cctools-14.1.tar.xz
rm cctools-14.1.tar.xz
cd
git clone --branch v1.26.0 --depth=1 https://github.com/ispc/ispc
cd ispc
patch -p1 < "$patch_file"
rm "$patch_file"
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ispc -DISPC_CROSS=ON -DISPC_MACOS_TARGET=ON -DISPC_MACOS_SDK_PATH=/opt/cctools/sdk/MacOSX13.0.sdk -DISPC_IOS_SDK_PATH=/opt/cctools/sdk/iPhoneOS16.1.sdk -DISPC_INCLUDE_TESTS=OFF -DISPC_INCLUDE_EXAMPLES=OFF
make -j18
make install
cd /opt
tar -cJvf /ispc-cross-1.26.0.tar.xz ispc
+75
View File
@@ -0,0 +1,75 @@
#!/bin/sh
#
# Automate the build process on Linux based on
# http://supertuxkart.net/Build_STK_on_Linux
# CMake build type
BUILDTYPE=Debug
# Number of threads to use during compilation (make -j)
THREADS=`lscpu -p | grep -v '^#' | wc -l`
# Relative path to the root directory of this Git repository
REPOROOT=..
export LANG=C
if [ "$CI" = 'true' -a "$TRAVIS" = 'true' ]
then
THREADS=4
fi
CURRENTDIR=`pwd`
SCRIPTDIR=`dirname "$0"`
cd "$SCRIPTDIR"
cd "$REPOROOT"
rm -rf cmake_build
# One might want to do that to REALLY clean up
#git reset --hard
#git checkout master
#git pull
REVISION=`git rev-parse HEAD`
# If you had Git submodules:
#git submodule foreach git reset --hard
#git submodule foreach git checkout master
#git submodule foreach git pull
mkdir cmake_build
cd cmake_build
cmake .. -DCMAKE_BUILD_TYPE=$BUILDTYPE 2>&1
EXITCODE=$?
if [ $EXITCODE -ne 0 ]
then
echo
echo 'ERROR: CMAKE failed with exit code '"$EXITCODE"
echo 'Git revision: '"$REVISION"
cd "$CURRENTDIR"
exit $EXITCODE
fi
make VERBOSE=1 -j $THREADS 2>&1
EXITCODE=$?
if [ $EXITCODE -ne 0 ]
then
echo
echo 'ERROR: MAKE failed with exit code '"$EXITCODE"
echo 'Git revision: '"$REVISION"
cd "$CURRENTDIR"
exit $EXITCODE
fi
cd "$SCRIPTDIR"
echo
echo 'SUCCESS: Build succeeded.'
echo 'Git revision: '"$REVISION"
echo
#git status
#git submodule foreach git status
#git submodule foreach git rev-parse HEAD
#ls -l cmake_build/bin/supertuxkart
cd "$CURRENTDIR"
+198
View File
@@ -0,0 +1,198 @@
#!/usr/bin/env python
import os
import re
import struct
# Reads all texture names from the specified directory.
# Textures must end in jpg, png, or bmp.
# Returns a directory with the texture name as key.
def readAllTextures(dir, result):
if type(dir)==type([]):
for i in dir:
readAllTextures(i,result)
return
re_is_texture = re.compile("^.*\.(jpg|png|bmp)$")
for i in os.listdir(dir):
if re_is_texture.match(i):
result[i]=1
# -----------------------------------------------------------------------------
# Reads all texture names specified in a materials.xml file.
def readMaterialsXML(filename):
textures = {}
f = open(filename, "r")
# Crude RE instead of XML parsing
re_texture_name = re.compile("^ *<material name=\"([^\"]*)\"")
for i in f.readlines():
g = re_texture_name.match(i)
if g:
textures[g.groups(1)[0]] = 1
return textures
# -----------------------------------------------------------------------------
def getTexturesFromB3D(filename, textures):
f = open(filename, "r")
s = f.read(4)
if s!="BB3D":
print(filename,"is not a valid b3d file")
f.close()
return
start_texs = 12
f.seek(start_texs)
s = f.read(4)
if s!="TEXS":
print("Can not handle '%s' b3d file - ignored."%filename)
f.close()
return
n = struct.unpack("<i", f.read(4))[0] # Read end of section
n = n - start_texs - 4 # number of bytes to read in tex section
s = f.read(n)
i = 0
while i<n:
tex_name=""
while ord(s[i]):
tex_name = tex_name+s[i]
i=i+1
textures[tex_name] = 1
# Update the offst: add 1 byte string terminator,
# and 7 int/float values
i = i + 7*4 + 1
f.close()
return
# -----------------------------------------------------------------------------
# Reads all textures mentioned in a track.xml or kart.xml file (e.g. icons,
# screenshots, shadows)
def findTrackData(dir, textures, b3dfiles):
f = open(dir+"track.xml", "r")
if f:
r_screenshot = re.compile("^ *screenshot *= \"(.*)\" *$")
for i in f.readlines():
g = r_screenshot.match(i)
if g:
textures[g.group(1)] = 1
f.close()
f = open(dir+"scene.xml", "r")
if f:
r_model = re.compile(" model=\"((.*)\.b3d.?)\"")
for i in f.readlines():
g = r_model.search(i)
if g:
b3dfiles[g.groups(1)[0]] = 1
f.close()
# -----------------------------------------------------------------------------
def findKartData(dir, textures, b3dfiles):
f = open(dir+"scene.xml", "r")
if f:
r_model = re.compile(" model=\"((.*)\.b3d.?)\"")
for i in f.readlines():
g = r_model.search(i)
if g:
b3dfiles[g.groups(1)[0]] = 1
f.close()
return
else:
f = open(dir+"scene.xml", "r")
if not f: return
print("WARNING")
if 1:
print("WARNING - kart.xml not done yet")
f = open(dir+"kart.xml", "r")
if not f: return
r_screenshot = re.compile("^ *screenshot *= \"(.*)\" *$")
for i in f.readlines():
g = r_screenshot.match(i)
if g:
textures[g.group(1)] = 1
f.close()
return
# -----------------------------------------------------------------------------
# Checks if all textures for a specified track- or kart-directory
# are actually used.
def checkDir(dir, shared_textures):
# First read all *png/jpg/bmp files
# ---------------------------------
existing_textures = {}
readAllTextures(dir, existing_textures)
# Find all b3d files in the directory (print warnings for b3dz)
# -------------------------------------------------------------
b3d_files_in_dir = {}
for i in os.listdir(dir):
if i[-4:]==".b3d":
b3d_files_in_dir[i] = 1
elif i[-5:]==".b3dz":
print("Can't handle file '%s'."%i)
# Find all textures listed in materials.xml
# -----------------------------------------
materials = readMaterialsXML(dir+"/materials.xml")
# Find all textures in track.xml and kart.xml files
# -------------------------------------------------
used_textures = {}
used_b3d_files = {}
findTrackData(dir, used_textures, used_b3d_files)
#findKartData(dir, used_textures, used_b3d_files)
# 1) Check if there are any missing b3d files
# ===========================================
for i in used_b3d_files.keys():
if not b3d_files_in_dir.get(i):
print("File '%s' is missing."%(dir+i))
# 2) Check if there are any unnecessary b3d files
# ===============================================
for i in b3d_files_in_dir:
if not used_b3d_files.get(i):
print("File '%s' is not used."%i)
continue
del used_b3d_files[i]
# Load all textures used in this b3d file
getTexturesFromB3D(dir+i, used_textures)
# 3) Check if all textures used can be found
# ==========================================
for i in used_textures:
if not existing_textures.get(i)==1:
if not shared_textures.get(i):
print("Cannot find texture '%s'."%i)
continue
else:
del existing_textures[i]
for i in existing_textures:
print("Texture '%s' is not used anywhere."%(dir+i))
# Now check that all entries in materials.xml are indeed used and exist
# =============================================================================
if __name__=="__main__":
assets = "../stk-assets/"
shared_textures = {}
readAllTextures([assets+"textures",
assets+"/textures/deprecated"],
shared_textures)
for i in os.listdir(assets+"tracks"):
checkDir(assets+"tracks/"+i+"/", shared_textures)
break
#for i in os.listdir(assets+"karts"):
# checkDir(assets+"karts/"+i+"/", shared_textures)
+102
View File
@@ -0,0 +1,102 @@
#!/usr/bin/env python
import math
import sys
def usage():
print("Usage:")
print("compute_client_error.py -f time,x1[,x2,x3....] server-data client-data")
print("The files are expected to contain space separated fields. The")
print("-f options specifies first the column in which the world time")
print("is, followed by the list of columns to be compared.")
print("It computes for each data point in the client file the closest")
print("the two data points with the closest time stamp in the server")
print("and then interpolates the server position based on the client")
print("time between these positions. The difference between the")
print("intepolated position")
print()
print("Example:")
print("compute_client_error.py-multi -f 6,16,17,18 debug.server debug.client")
print(" to compute the differences between client and server for the")
print(" fields 16,17,18 (which atm is the velocity)")
sys.exit()
# -----------------------------------------------------------------------------
def readFile(name, fields):
f = open(name, "r")
result = []
for i in f.readlines():
if i[:6] == "Rewind":
continue
l = i.split()
try:
l_values = [ float(l[index]) for index in fields ]
except ValueError:
pass
result.append(l_values)
f.close()
return result
# -----------------------------------------------------------------------------
# Compares the client and server data. Each argument is a list of
# triplets containing (time, x, z) data.
#
def computeDifferences(server, client):
index_s = 0
count = 0
sum = 0.0
min = 999999.9
max = -1.0
for items in client:
time, x = items[0], items[1:]
# Find largest entry in server data that is <= client's time:
while index_s<len(server)-2:
t1 = server[index_s+1][0]
if t1>time: break
index_s += 1
#print "time", time, server[index_s][0], server[index_s+1][0]
t1,x1 = server[index_s ][0],server[index_s ][1:]
t2,x2 = server[index_s+1][0],server[index_s+1][1:]
f = (time-t1)/(t2-t1)
interp = []
error = 0
for i, x1_val in enumerate(x1):
x2_val = x2[i]
x_i = x1_val + f * (x2_val-x1_val)
interp.append(x_i)
error = error + (x[i]-x_i)**2
error = math.sqrt(error)
print(time, error)
if (error < min): min=error
if (error > max): max=error
count += 1
sum += error
print("sum %f count %d min %f average %f max %f" \
% (sum, count, min, sum/count, max))
# -----------------------------------------------------------------------------
if __name__=="__main__":
if len(sys.argv)==5 and sys.argv[1]=="-f":
fields = sys.argv[2]
del sys.argv[1:3]
else:
fields = ["6", "9", "11"]
if len(sys.argv)!=3:
usage()
# -1 to convert awk/gnuplot indices (starting with 1) to
# python indices (starting with 0)
field_indices = [int(item)-1 for item in fields.split(",")]
server_name = sys.argv[1]
client_name = sys.argv[2]
server = readFile(server_name, field_indices)
client = readFile(client_name, field_indices)
computeDifferences(server, client)
+284
View File
@@ -0,0 +1,284 @@
#!/usr/bin/env python3
#
# SuperTuxKart - a fun racing game with go-kart
# Copyright (C) 2006-2015 SuperTuxKart-Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# 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 program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This script creates code for the characteristics.
# It takes an argument that specifies what the output of the script should be.
# The output options can be seen by running this script without arguments.
# A more convenient version to update the code is to run update_characteristics.py
import sys
# Input data
# Each line contains a topic and the attributes of that topic.
# This model is used for the xml file and to access the kart properties in the code.
characteristics = """Suspension: stiffness, rest, travel, expSpringResponse(bool), maxForce
Stability: rollInfluence, chassisLinearDamping, chassisAngularDamping, downwardImpulseFactor, trackConnectionAccel, angularFactor(std::vector<float>/floatVector), smoothFlyingImpulse
Turn: radius(InterpolationArray), timeResetSteer, timeFullSteer(InterpolationArray)
Engine: power, maxSpeed, genericMaxSpeed, brakeFactor, brakeTimeIncrease, maxSpeedReverseRatio
Gear: switchRatio(std::vector<float>/floatVector), powerIncrease(std::vector<float>/floatVector)
Mass
Wheels: dampingRelaxation, dampingCompression
Jump: animationTime
Lean: max, speed
Anvil: duration, weight, speedFactor
Parachute: friction, duration, durationOther, durationRankMult, durationSpeedMult, lboundFraction, uboundFraction, maxSpeed
Friction: kartFriction
Bubblegum: duration, speedFraction, torque, fadeInTime, shieldDuration
Zipper: duration, force, speedGain, maxSpeedIncrease, fadeOutTime
Swatter: duration, distance, squashDuration, squashSlowdown
Plunger: bandMaxLength, bandForce, bandDuration, bandSpeedIncrease, bandFadeOutTime, inFaceTime
Startup: time(std::vector<float>/floatVector), boost(std::vector<float>/floatVector)
Rescue: duration, vertOffset, height
Explosion: duration, radius, invulnerabilityTime
Nitro: duration, engineForce, engineMult, consumption, smallContainer, bigContainer, maxSpeedIncrease, fadeOutTime, max
Slipstream: durationFactor, baseSpeed, length, width, innerFactor, minCollectTime, maxCollectTime, addPower, minSpeed, maxSpeedIncrease, fadeOutTime
Skid: increase, decrease, max, timeTillMax, visual, visualTime, revertVisualTime, minSpeed, timeTillBonus(std::vector<float>/floatVector), bonusSpeed(std::vector<float>/floatVector), bonusTime(std::vector<float>/floatVector), bonusForce(std::vector<float>/floatVector), physicalJumpTime, graphicalJumpTime, postSkidRotateFactor, reduceTurnMin, reduceTurnMax, enabled(bool)"""
""" A GroupMember is an attribute of a group.
In the xml files, a value will be assigned to it.
If the name of the attribute is 'value', the getter method will only
contain the group name and 'value' will be omitted (e.g. used for mass). """
class GroupMember:
def __init__(self, name, typeC, typeStr):
self.name = name
if name == "value":
self.getName = ""
else:
self.getName = name
self.typeC = typeC
self.typeStr = typeStr
""" E.g. power(std::vector<float>/floatVector)
or speed(InterpolationArray)
The default type is float
The name 'value' is special: Only the group name will be used to access
the member but in the xml file it will be still value (because we
need a name). """
def parse(content):
typeC = "float"
typeStr = typeC
name = content.strip()
pos = content.find("(")
end = content.find(")", pos)
if pos != -1 and end != -1:
name = content[:pos].strip()
pos2 = content.find("/", pos, end)
if pos2 != -1:
typeC = content[pos + 1:pos2].strip()
typeStr = content[pos2 + 1:end].strip()
else:
typeC = content[pos + 1:end].strip()
typeStr = typeC
return GroupMember(name, typeC, typeStr)
""" A Group has a base name and can contain GroupMembers.
In the xml files, a group is a tag. """
class Group:
def __init__(self, baseName):
self.baseName = baseName
self.members = []
""" Parses and adds a member to this group """
def addMember(self, content):
self.members.append(GroupMember.parse(content))
def getBaseName(self):
return self.baseName
""" E.g. engine: power, gears(std::vector<Gear>/Gears)
or mass(float) or only mass """
def parse(content):
pos = content.find(":")
if pos == -1:
group = Group(content)
group.addMember("value")
return group
else:
group = Group(content[:pos].strip())
for m in content[pos + 1:].split(","):
group.addMember(m)
return group
""" Creates a list of words from a titlecase string """
def toList(name):
result = []
cur = ""
for c in name:
if c.isupper() and len(cur) != 0:
result.append(cur)
cur = ""
cur += c.lower()
if len(cur) != 0:
result.append(cur)
return result
""" titleCase: true = result is titlecase
false = result has underscores """
def joinSubName(group, member, titleCase):
words = toList(group.baseName) + toList(member.getName)
first = True
if titleCase:
words = [w.title() for w in words]
return "".join(words)
else:
return "_".join(words)
# Functions to generate code
def createEnum(groups):
for g in groups:
print()
print(" // {0}".format(g.getBaseName().title()))
for m in g.members:
print(" {0},".format(joinSubName(g, m, False).upper()))
def createAcDefs(groups):
for g in groups:
print()
for m in g.members:
nameTitle = joinSubName(g, m, True)
nameUnderscore = joinSubName(g, m, False)
typeC = m.typeC
print(" {0} get{1}() const;".
format(typeC, nameTitle, nameUnderscore))
def createAcGetter(groups):
for g in groups:
for m in g.members:
nameTitle = joinSubName(g, m, True)
nameUnderscore = joinSubName(g, m, False)
typeC = m.typeC
result = "result"
print("""// ----------------------------------------------------------------------------
{3} AbstractCharacteristic::get{1}() const
{{
{0} result;
bool is_set = false;
process({2}, &result, &is_set);
if (!is_set)
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
getName({2}).c_str());
return {4};
}} // get{1}
""".format(m.typeC, nameTitle, nameUnderscore.upper(), typeC, result))
def createKpDefs(groups):
for g in groups:
print()
for m in g.members:
nameTitle = joinSubName(g, m, True)
nameUnderscore = joinSubName(g, m, False)
typeC = m.typeC
print(" {0} get{1}() const;".
format(typeC, nameTitle, nameUnderscore))
def createKpGetter(groups):
for g in groups:
for m in g.members:
nameTitle = joinSubName(g, m, True)
nameUnderscore = joinSubName(g, m, False)
typeC = m.typeC
result = "result"
print("""// ----------------------------------------------------------------------------
{1} KartProperties::get{0}() const
{{
return m_cached_characteristic->get{0}();
}} // get{0}
""".format(nameTitle, typeC))
def createGetType(groups):
for g in groups:
for m in g.members:
nameTitle = joinSubName(g, m, True)
nameUnderscore = joinSubName(g, m, False)
print(" case {0}:\n return TYPE_{1};".
format(nameUnderscore.upper(), "_".join(toList(m.typeStr)).upper()))
def createGetName(groups):
for g in groups:
for m in g.members:
nameTitle = joinSubName(g, m, True)
nameUnderscore = joinSubName(g, m, False).upper()
print(" case {0}:\n return \"{0}\";".
format(nameUnderscore))
def createLoadXml(groups):
for g in groups:
print(" if (const XMLNode *sub_node = node->getNode(\"{0}\"))\n {{".
format(g.baseName.lower()))
for m in g.members:
nameUnderscore = joinSubName(g, m, False)
nameMinus = "-".join(toList(m.name))
print(""" sub_node->get(\"{0}\",
&m_values[{1}]);""".
format(nameMinus, nameUnderscore.upper()))
print(" }\n")
# Dicionary that maps an argument string to a tupel of
# a generator function, a help string and a filename
functions = {
"enum": (createEnum, "List the enum values for all characteristics", "karts/abstract_characteristic.hpp"),
"acdefs": (createAcDefs, "Create the header function definitions", "karts/abstract_characteristic.hpp"),
"acgetter": (createAcGetter, "Implement the getters", "karts/abstract_characteristic.cpp"),
"getType": (createGetType, "Implement the getType function", "karts/abstract_characteristic.cpp"),
"getName": (createGetName, "Implement the getName function", "karts/abstract_characteristic.cpp"),
"kpdefs": (createKpDefs, "Create the header function definitions for the getters", "karts/kart_properties.hpp"),
"kpgetter": (createKpGetter, "Implement the getters", "karts/kart_properties.cpp"),
"loadXml": (createLoadXml, "Code to load the characteristics from an xml file", "karts/xml_characteristic.cpp"),
}
def main():
# Find out what to do
if len(sys.argv) != 2:
print("""Usage: ./create_kart_properties.py <operation>
Operations:""")
maxOperationLength = 0
maxDescriptionLength = 0
for o, f in functions.items():
l = len(o)
if l > maxOperationLength:
maxOperationLength = l
l = len(f[1])
if l > maxDescriptionLength:
maxDescriptionLength = l
formatString = " {{0:{0}}} {{1:{1}}} in {{2}}".format(maxOperationLength, maxDescriptionLength)
for o, f in functions.items():
print(formatString.format(o, f[1], f[2]))
return
task = sys.argv[1]
if task not in functions:
print("The wanted operation was not found. Please call this script without arguments to list available arguments.")
return
# Parse properties
groups = [Group.parse(line) for line in characteristics.split("\n")]
# Create the wanted code
functions[task][0](groups)
if __name__ == '__main__':
main()
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
echo "Searching for unused stkgui files"
echo "---------------------------------"
cd data/gui
l=""
for i in $(find . -iname "*.stkgui"); do
s=$(basename $i)
x=$(find ../../src/states_screens -type f -exec grep -H $s \{} \; | wc -l)
echo -n "."
if [ $x == "0" ]; then
l="$l $i"
fi
done
echo
for i in $l; do
echo "$i appears to be not used."
done
echo "done"
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env python3
# usage: generate-countries-table.py > countries.csv
# in sqlite3 terminal:
#
# .mode csv
# .headers off
# .separator ";"
# .import 'full path to countries.csv' 'v(database_version)_countries'
#
import csv
import os
import sys
TSV_FILE = '../data/country_names.tsv'
# Use another name in the country_code header if you want countries names in different language
READABLE_NAME = 'en'
# ord("🇦") - ord("A")
FLAG_OFFSET = 127397
if not os.path.exists(TSV_FILE):
print("File = {} does not exist.".format(TSV_FILE))
sys.exit(1)
with open(TSV_FILE, 'r') as tsvfile:
country = csv.DictReader(tsvfile, delimiter='\t', quotechar='"')
# Skip header
next(country)
for row in country:
country_code = row['country_code']
codepoints = [ord(x) + FLAG_OFFSET for x in country_code]
print('%s;%s;%s' % (country_code, chr(codepoints[0]) + chr(codepoints[1]), row[READABLE_NAME]))
+79
View File
@@ -0,0 +1,79 @@
#!/usr/bin/env python
# Usage: ./generate-country-names.py /path/to/openjdk-src/
# It should have make/data/cldr/common/main/*.xml for country names generation
import xml.dom.minidom
import sys
import os
country_translations = {}
def traverse(file, node, lang):
for e in node.childNodes:
if e.localName == None:
continue
if e.nodeName == "territory" and e.hasAttribute("type"):
country = e.getAttribute("type")
# Skip invalid country
if not (country[0] >= "A" and country[0] <= "Z") \
or country == "EZ" or country == "UN" or country == "XA" or country == "XB" or country == "ZZ":
continue
translation = ""
if country == "HK" or country == "MO" or country == "PS":
if e.hasAttribute("alt"):
translation = e.firstChild.nodeValue
elif not e.hasAttribute("alt"):
translation = e.firstChild.nodeValue
if translation == "":
continue
# Make sure no tab in translation
translation = translation.replace("\t", " ")
if not country in country_translations:
country_translations[country] = {}
country_translations[country][lang] = translation
traverse(file, e, lang)
lang_list = []
for file in os.listdir("../data/po"):
if file.endswith(".po"):
lang_list.append(os.path.splitext(file)[0].replace("_", "-"))
lang_list.sort()
real_lang_list = []
for lang in lang_list:
# Avoid fallback language except tranditional chinese
target_name = lang.split("-")[0]
if lang == "zh-TW":
target_name = "zh_Hant"
jdk_source = ' '.join(sys.argv[1:])
target_file = jdk_source + "/make/data/cldr/common/main/" + target_name + ".xml"
# Use english if no such translation
if not os.path.isfile(target_file):
continue
try:
doc = xml.dom.minidom.parse(target_file)
except Exception as ex:
print("============================================")
print("/!\\ Expat doesn't like ", file, "! Error=", type(ex), " (", ex.args, ")")
print("============================================")
traverse(file, doc, lang)
real_lang_list.append(lang)
f = open('../data/country_names.tsv', 'w')
f.write("country_code")
for language in real_lang_list:
f.write("\t")
f.write(language)
f.write("\n")
for country in country_translations.keys():
f.write(country)
for language in real_lang_list:
f.write("\t")
if language in country_translations[country].keys():
f.write(country_translations[country][language])
else:
f.write(country_translations[country]["en"])
f.write("\n")
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env python3
# usage: generate-ip-mappings.py
# 2 files ipv4.csv and ipv6.csv will be generated
# in sqlite3 terminal:
#
# .mode csv
# .import 'full path to ipv4.csv' ip_mapping
# .import 'full path to ipv6.csv' ipv6_mapping
#
# For query by ip:
# SELECT * FROM ip_mapping WHERE `ip_start` <= ip-in-decimal AND `ip_end` >= ip-in-decimal ORDER BY `ip_start` DESC LIMIT 1;
# SELECT * FROM ipv6_mapping WHERE `ip_start` <= upperIPv6("ipv6_addr") AND `ip_end` >= upperIPv6("ipv6_addr") ORDER BY `ip_start` DESC LIMIT 1;
import socket
import struct
import csv
import os
import sys
# import zipfile
# import urllib.request
def ip2int(addr):
return struct.unpack("!I", socket.inet_aton(addr))[0]
# Keep only the upper 64bit, as we only need that for geolocation
def ipv62int64(addr):
hi, lo = struct.unpack('!QQ', socket.inet_pton(socket.AF_INET6, addr))
return hi
CSV_WEB_LINK = 'https://download.db-ip.com/free/dbip-city-lite-2025-01.csv.gz'
CSV_FILE = 'dbip-city-lite-2025-01.csv'
if not os.path.exists(CSV_FILE):
print("File = {} does not exist. Download it from = {} ".format(CSV_FILE, CSV_WEB_LINK))
sys.exit(1)
# Format: 1.0.0.0,1.0.0.255,OC,AU,Queensland,"South Brisbane",-27.4748,153.017
with open(CSV_FILE, 'r') as csvfile, open('ipv4.csv', 'w') as ipv4, open('ipv6.csv', 'w') as ipv6:
iplist = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in iplist:
# Skip reserved range
if row[3] == "ZZ":
continue
# Skip empty latitude and longitude
if row[6] == "" or row[7] == "":
continue
if row[0].find(':') == -1:
ipv4_line = True
else:
ipv4_line = False
if ipv4_line:
ip_start = ip2int(row[0])
ip_end = ip2int(row[1])
else:
ip_start = ipv62int64(row[0])
ip_end = ipv62int64(row[1])
# Some IPv6 entries are duplicated after removing the lower 64bit
if ip_start == ip_end:
continue
# Sqlite doesn't support unsigned int 64
_int64_max = pow(2, 63) - 1
if ip_start > _int64_max or ip_end > _int64_max:
continue
latitude = float(row[6])
longitude = float(row[7])
country = row[3]
if ipv4_line:
print('%d,%d,%f,%f,%s' % (ip_start, ip_end, latitude, longitude, country), file = ipv4)
else:
print('%d,%d,%f,%f,%s' % (ip_start, ip_end, latitude, longitude, country), file = ipv6)
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
grep -a "^\[verbose \] physicsafter" $1
+92
View File
@@ -0,0 +1,92 @@
import Image as img
import numpy as np
import pylab as pl
n = 3
GridI, GridJ = np.meshgrid(np.linspace(-1, 1, n), np.linspace(-1, 1, n))
img = np.ones((n,n))
# constant factor of Ylm
c00 = 0.282095
c1minus1 = 0.488603
c10 = 0.488603
c11 = 0.488603
c2minus2 = 1.092548
c2minus1 = 1.092548
c21 = 1.092548
c20 = 0.315392
c22 = 0.546274
def computeYmlOnGrid(Xgrid, Ygrid, Zgrid):
"compute Yml from Y00 to Y22 on Xgrid/Ygrid/Zgrid"
norm = np.sqrt(Xgrid * Xgrid + Ygrid * Ygrid + Zgrid * Zgrid)
Xg = Xgrid / norm
Yg = Ygrid / norm
Zg = Zgrid / norm
Y00 = c00
Y1minus1 = c1minus1 * Yg
Y10 = c10 * Zg
Y11 = c11 * Xg
Y2minus2 = c2minus2 * Xg * Yg
Y2minus1 = c2minus1 * Yg * Zg
Y21= c21 * Xg * Zg
Y20 = c20 * (3 * Zg * Zg - 1)
Y22 = c22 * (Xg * Xg - Yg * Yg)
return (Y00, Y1minus1, Y10, Y11, Y2minus2, Y2minus1, Y20, Y21, Y22)
# From http://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/
def areaToPoint(x, y):
return np.arctan2(x * y, np.sqrt(x * x + y * y + 1))
def getSolidAngleGrid(Xgrid, Ygrid):
"Compute solid angles using Xgrid/Ygrid/Zgrid texel position"
(step, _) = np.shape(Xgrid)
x0 = Xgrid - (1. / step)
x1 = Xgrid + (1. / step)
y0 = Ygrid - (1. / step)
y1 = Ygrid + (1. / step)
return areaToPoint(x0,y0) - areaToPoint(x1, y0) - areaToPoint(x0, y1) + areaToPoint(x1, y1)
def computeCoefficients():
"Compute coefficient SH00 to SH22 for monochromatic img"
FaceGrid = [(np.ones((n,n)), -GridI, -GridJ), #GL_TEXTURE_CUBE_MAP_POSITIVE_X
(-1 * np.ones((n,n)), -GridI, GridJ), #GL_TEXTURE_CUBE_MAP_NEGATIVE_X
(GridJ, np.ones((n,n)), GridI), #GL_TEXTURE_CUBE_MAP_POSITIVE_Y
(GridJ, -1 * np.ones((n,n)), -GridI), #GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
(GridJ, GridI, np.ones((n,n))), #GL_TEXTURE_CUBE_MAP_POSITIVE_Z
(GridJ, -GridI, -1 * np.ones((n,n)))] #GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
incomingIrradiance = getSolidAngleGrid(GridI, GridJ)
SH00 = 0
SH1minus1 = 0
SH10 = 0
SH11 = 0
SH2minus2 = 0
SH2minus1 = 0
SH20 = 0
SH21 = 0
SH22 = 0
for (Xgrid, Ygrid, Zgrid) in FaceGrid:
(Y00, Y1minus1, Y10, Y11, Y2minus2, Y2minus1, Y20, Y21, Y22) = computeYmlOnGrid(Xgrid, Ygrid, Zgrid)
SH00 += np.sum(Y00 * incomingIrradiance * img)
SH1minus1 += np.sum(Y1minus1 * incomingIrradiance * img)
SH10 += np.sum(Y10 * incomingIrradiance * img)
SH11 += np.sum(Y11 * incomingIrradiance * img)
SH2minus2 += np.sum(Y2minus2 * incomingIrradiance * img)
SH2minus1 += np.sum(Y2minus1 * incomingIrradiance * img)
SH20 += np.sum(Y20 * incomingIrradiance * img)
SH21 += np.sum(Y21 * incomingIrradiance * img)
SH22 += np.sum(Y22 * incomingIrradiance * img)
return (SH00, SH1minus1, SH10, SH2minus2, SH2minus1, SH20, SH21, SH22)
print(computeCoefficients())
#res = []
#for (Xd, Yd, Zd) in FaceGrid:
# res.append(computeYmlOnGrid(Xd, Yd, Zd))
#I = img.open("C:/Users/vljn_000/Documents/GitHub/stk-assets/textures/ants.png")
#m = np.array(I)
#print(type(m))
#pl.imshow(m)
+797
View File
@@ -0,0 +1,797 @@
#!/bin/sh
#
# (C) 2020 Dawid Gan, under the Holy Hedgehog License (do whatever you want)
#
# This is a build script that creates STK linux package.
#
# To run the script you need debootstrap and schroot packages, and working
# chroot environment.
#
# The build environment can be created using debootstrap:
#
# debootstrap --arch i386 --components=main \
# jessie ./chroot-jessie32 http://ftp.debian.org/debian
#
# debootstrap --arch amd64 --components=main \
# jessie ./chroot-jessie64 http://ftp.debian.org/debian
#
#
# Here is example configuration for schroot:
# /etc/schroot/chroot.d/chroot-jessie32.conf
#
# [chroot-jessie32]
# description=Debian Jessie
# personality=linux32
# directory=/path/to/chroot-jessie32
# root-users=deve
# type=directory
# users=deve
#
#
# /etc/schroot/chroot.d/chroot-jessie64.conf
#
# [chroot-jessie64]
# description=Debian Jessie 64-bit
# #personality=linux32
# directory=/path/to/chroot-jessie64
# root-users=deve
# type=directory
# users=deve
#
#
# Packages that are needed to compile all STK dependencies have to be installed
# manually inside both chroot directories.
export DIRNAME="$(dirname "$(readlink -f "$0")")"
######################## CONFIG ########################
export STK_VERSION="git`date +%Y%m%d`"
export THREADS_NUMBER=`nproc`
export SCHROOT_32BIT_NAME="chroot-buster32"
export SCHROOT_64BIT_NAME="chroot-buster64"
export SCHROOT_ARMV7_NAME="chroot-buster-armhf"
export SCHROOT_ARM64_NAME="chroot-buster-arm64"
export SCHROOT_RISCV_NAME="chroot-trixie-riscv64"
export STKCODE_DIR="$DIRNAME/.."
export STKASSETS_DIR="$STKCODE_DIR/../supertuxkart-assets"
export OPENGLRECORDER_DIR="$STKCODE_DIR/../libopenglrecorder"
export STKEDITOR_DIR="$STKCODE_DIR/../supertuxkart-editor"
export BLACKLIST_LIBS="ld-linux libbsd.so libc.so libdl.so libdrm libexpat \
libGL libgl libm.so libmvec.so libpthread libresolv \
librt.so libX libxcb libxshm \
libEGL libgbm libwayland libffi bcm_host libvc"
export BUILD_DIR="build-linux"
export DEPENDENCIES_DIR="$STKCODE_DIR/dependencies-linux"
export STK_INSTALL_DIR="$STKCODE_DIR/build-linux-install"
export STATIC_GCC=1
# Use it if you build STK with Debian Jessie
export ENABLE_JESSIE_HACKS=1
########################################################
# A helper function that checks if error ocurred
check_error()
{
if [ $? -gt 0 ]; then
echo "Error ocurred."
exit
fi
}
write_run_game_sh()
{
if [ -z "$1" ]; then
return
fi
export INSTALL_DIR=$1
export FILE="$INSTALL_DIR/run_game.sh"
echo '#!/bin/sh' > "$FILE"
echo '' >> "$FILE"
echo 'export DIRNAME="$(dirname "$(readlink -f "$0")")"' >> "$FILE"
echo 'export SYSTEM_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"' >> "$FILE"
echo '' >> "$FILE"
echo 'export SUPERTUXKART_DATADIR="$DIRNAME"' >> "$FILE"
echo 'export SUPERTUXKART_ASSETS_DIR="$DIRNAME/data/"' >> "$FILE"
echo '' >> "$FILE"
echo 'cd "$DIRNAME"' >> "$FILE"
echo '' >> "$FILE"
echo 'export LD_LIBRARY_PATH="$DIRNAME/lib:$LD_LIBRARY_PATH"' >> "$FILE"
echo '"$DIRNAME/bin/supertuxkart" "$@"' >> "$FILE"
echo '' >> "$FILE"
}
build_stk()
{
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
export ARCH_OPTION="$1"
export STK_CMAKE_FLAGS="$2"
export DEPENDENCIES_DIR="$DEPENDENCIES_DIR-$ARCH_OPTION"
export BUILD_DIR="$BUILD_DIR-$ARCH_OPTION"
export INSTALL_DIR="$DEPENDENCIES_DIR/dependencies"
export INSTALL_LIB_DIR="$INSTALL_DIR/lib"
export INSTALL_INCLUDE_DIR="$INSTALL_DIR/include"
export PKG_CONFIG_PATH="$INSTALL_LIB_DIR/pkgconfig"
export CFLAGS="-I$INSTALL_INCLUDE_DIR"
export CPPFLAGS="-I$INSTALL_INCLUDE_DIR"
export LDFLAGS="-Wl,-rpath,$INSTALL_LIB_DIR -L$INSTALL_LIB_DIR"
export PATH="$INSTALL_DIR/bin:$PATH"
if [ "$STATIC_GCC" -gt 0 ]; then
LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
fi
cd "$STKCODE_DIR"
mkdir -p "$DEPENDENCIES_DIR"
# CMake
if [ ! -f "$DEPENDENCIES_DIR/cmake.stamp" ]; then
echo "Compiling CMake"
git clone --depth 1 -b v3.24.1 https://github.com/Kitware/CMake.git "$DEPENDENCIES_DIR/cmake"
cd "$DEPENDENCIES_DIR/cmake"
./bootstrap --prefix="$INSTALL_DIR" \
--parallel=$THREADS_NUMBER \
-- -DCMAKE_USE_OPENSSL=0 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/cmake.stamp"
fi
# ISPC
if [ ! -f "$DEPENDENCIES_DIR/ispc.stamp" ]; then
if [ "$ARCH_OPTION" = "x86_64" ]; then
echo "Downloading ISPC"
mkdir -p "$DEPENDENCIES_DIR/ispc"
cd "$DEPENDENCIES_DIR/ispc"
ISPC_VERSION="v1.18.0"
wget https://github.com/ispc/ispc/releases/download/$ISPC_VERSION/ispc-$ISPC_VERSION-linux.tar.gz -O ispc.tar.gz
check_error
tar -xzf "ispc.tar.gz"
check_error
cp "$DEPENDENCIES_DIR/ispc/ispc-$ISPC_VERSION-linux/bin/ispc" "$INSTALL_DIR/bin/"
fi
touch "$DEPENDENCIES_DIR/ispc.stamp"
fi
# Zlib
if [ ! -f "$DEPENDENCIES_DIR/zlib.stamp" ]; then
echo "Compiling zlib"
mkdir -p "$DEPENDENCIES_DIR/zlib"
cp -a -f "$DEPENDENCIES_DIR/../lib/zlib/"* "$DEPENDENCIES_DIR/zlib"
cd "$DEPENDENCIES_DIR/zlib"
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DINSTALL_PKGCONFIG_DIR="$PKG_CONFIG_PATH" &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/zlib.stamp"
fi
# Libpng
if [ ! -f "$DEPENDENCIES_DIR/libpng.stamp" ]; then
echo "Compiling libpng"
mkdir -p "$DEPENDENCIES_DIR/libpng"
mkdir -p "$DEPENDENCIES_DIR/libpng/lib"
cp -a -f "$DEPENDENCIES_DIR/../lib/libpng/"* "$DEPENDENCIES_DIR/libpng"
cd "$DEPENDENCIES_DIR/libpng"
./configure --prefix="$INSTALL_DIR" &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/libpng.stamp"
fi
# Freetype bootstrap
if [ ! -f "$DEPENDENCIES_DIR/freetype_bootstrap.stamp" ]; then
echo "Compiling freetype bootstrap"
mkdir -p "$DEPENDENCIES_DIR/freetype/build"
cp -a -f "$DEPENDENCIES_DIR/../lib/freetype/"* "$DEPENDENCIES_DIR/freetype"
cd "$DEPENDENCIES_DIR/freetype/build"
cmake .. -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DBUILD_SHARED_LIBS=1 \
-DFT_DISABLE_HARFBUZZ=1 \
-DFT_DISABLE_BZIP2=1 \
-DFT_DISABLE_BROTLI=1 \
-DFT_REQUIRE_ZLIB=1 \
-DFT_REQUIRE_PNG=1 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/freetype_bootstrap.stamp"
fi
# Harfbuzz
if [ ! -f "$DEPENDENCIES_DIR/harfbuzz.stamp" ]; then
echo "Compiling harfbuzz"
mkdir -p "$DEPENDENCIES_DIR/harfbuzz"
cp -a -f "$DEPENDENCIES_DIR/../lib/harfbuzz/"* "$DEPENDENCIES_DIR/harfbuzz"
cd "$DEPENDENCIES_DIR/harfbuzz"
./autogen.sh
./configure --prefix="$INSTALL_DIR" \
--with-freetype=yes \
--with-glib=no \
--with-gobject=no \
--with-cairo=no \
--with-fontconfig=no \
--with-icu=no \
--with-graphite2=no &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/harfbuzz.stamp"
fi
# Freetype
if [ ! -f "$DEPENDENCIES_DIR/freetype.stamp" ]; then
echo "Compiling freetype"
mkdir -p "$DEPENDENCIES_DIR/freetype/build"
cp -a -f "$DEPENDENCIES_DIR/../lib/freetype/"* "$DEPENDENCIES_DIR/freetype"
cd "$DEPENDENCIES_DIR/freetype/build"
rm -rf ./*
cmake .. -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DBUILD_SHARED_LIBS=1 \
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=1 \
-DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=1 \
-DFT_REQUIRE_HARFBUZZ=1 \
-DFT_DISABLE_BZIP2=1 \
-DFT_DISABLE_BROTLI=1 \
-DFT_REQUIRE_ZLIB=1 \
-DFT_REQUIRE_PNG=1 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/freetype.stamp"
fi
# Openal
if [ ! -f "$DEPENDENCIES_DIR/openal.stamp" ]; then
echo "Compiling openal"
mkdir -p "$DEPENDENCIES_DIR/openal"
cp -a -f "$DEPENDENCIES_DIR/../lib/openal/"* "$DEPENDENCIES_DIR/openal"
if [ "$ENABLE_JESSIE_HACKS" -gt 0 ]; then
JESSIE_HACK="-DHAVE_LIBATOMIC=0"
fi
cd "$DEPENDENCIES_DIR/openal"
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DALSOFT_UTILS=0 \
-DALSOFT_EXAMPLES=0 \
-DALSOFT_TESTS=0 \
-DALSOFT_BACKEND_SNDIO=0 \
$JESSIE_HACK &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/openal.stamp"
fi
# MbedTLS
if [ ! -f "$DEPENDENCIES_DIR/mbedtls.stamp" ]; then
echo "Compiling mbedtls"
mkdir -p "$DEPENDENCIES_DIR/mbedtls"
cp -a -f "$DEPENDENCIES_DIR/../lib/mbedtls/"* "$DEPENDENCIES_DIR/mbedtls"
cd "$DEPENDENCIES_DIR/mbedtls"
if [ "$ARCH_OPTION" = "x86" ]; then
sed -i 's/#define MBEDTLS_AESNI_C//g' "$DEPENDENCIES_DIR/mbedtls/include/mbedtls/mbedtls_config.h"
fi
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DUSE_SHARED_MBEDTLS_LIBRARY=1 \
-DENABLE_TESTING=0 \
-DENABLE_PROGRAMS=0 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/mbedtls.stamp"
fi
# Curl
if [ ! -f "$DEPENDENCIES_DIR/curl.stamp" ]; then
echo "Compiling curl"
mkdir -p "$DEPENDENCIES_DIR/curl"
cp -a -f "$DEPENDENCIES_DIR/../lib/curl/"* "$DEPENDENCIES_DIR/curl"
cd "$DEPENDENCIES_DIR/curl"
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DBUILD_TESTING=0 \
-DBUILD_CURL_EXE=0 \
-DCURL_USE_MBEDTLS=1 \
-DCURL_USE_OPENSSL=0 \
-DCURL_USE_LIBSSH=0 \
-DCURL_USE_LIBSSH2=0 \
-DCURL_USE_GSSAPI=0 \
-DCURL_USE_LIBPSL=0 \
-DUSE_ZLIB=1 \
-DUSE_NGHTTP2=0 \
-DUSE_QUICHE=0 \
-DUSE_LIBIDN2=0 \
-DHTTP_ONLY=1 \
-DCURL_CA_BUNDLE=none \
-DCURL_CA_PATH=none \
-DENABLE_THREADED_RESOLVER=1 &&
make -j$THREADS_NUMBER &&
make install
check_error
rm -rf "$INSTALL_DIR/lib/cmake/CURL"
touch "$DEPENDENCIES_DIR/curl.stamp"
fi
# Libjpeg
if [ ! -f "$DEPENDENCIES_DIR/libjpeg.stamp" ]; then
echo "Compiling libjpeg"
mkdir -p "$DEPENDENCIES_DIR/libjpeg"
cp -a -f "$DEPENDENCIES_DIR/../lib/libjpeg/"* "$DEPENDENCIES_DIR/libjpeg"
cd "$DEPENDENCIES_DIR/libjpeg"
chmod a+x ./configure
ASM_NASM=yasm \
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/libjpeg.stamp"
fi
# Libogg
if [ ! -f "$DEPENDENCIES_DIR/libogg.stamp" ]; then
echo "Compiling libogg"
mkdir -p "$DEPENDENCIES_DIR/libogg"
cp -a -f "$DEPENDENCIES_DIR/../lib/libogg/"* "$DEPENDENCIES_DIR/libogg"
cd "$DEPENDENCIES_DIR/libogg"
./autogen.sh
./configure --prefix="$INSTALL_DIR" &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/libogg.stamp"
fi
# Libvorbis
if [ ! -f "$DEPENDENCIES_DIR/libvorbis.stamp" ]; then
echo "Compiling libvorbis"
mkdir -p "$DEPENDENCIES_DIR/libvorbis"
cp -a -f "$DEPENDENCIES_DIR/../lib/libvorbis/"* "$DEPENDENCIES_DIR/libvorbis"
cd "$DEPENDENCIES_DIR/libvorbis"
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DBUILD_SHARED_LIBS=1 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/libvorbis.stamp"
fi
# Shaderc
if [ ! -f "$DEPENDENCIES_DIR/shaderc.stamp" ]; then
echo "Compiling shaderc"
mkdir -p "$DEPENDENCIES_DIR/shaderc"
cp -a -f "$DEPENDENCIES_DIR/../lib/shaderc/"* "$DEPENDENCIES_DIR/shaderc"
cd "$DEPENDENCIES_DIR/shaderc"
if [ ! -f "$DEPENDENCIES_DIR/shaderc-deps.stamp" ]; then
./utils/git-sync-deps
check_error
touch "$DEPENDENCIES_DIR/shaderc-deps.stamp"
fi
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DCMAKE_C_FLAGS="-fpic -O3" \
-DCMAKE_CXX_FLAGS="-fpic -O3" \
-DSHADERC_SKIP_INSTALL=1 \
-DCMAKE_BUILD_TYPE=Release \
-DSHADERC_SKIP_TESTS=1 \
-DSHADERC_SKIP_EXAMPLES=1 \
-DSPIRV_HEADERS_SKIP_INSTALL=1 \
-DSPIRV_HEADERS_SKIP_EXAMPLES=1 \
-DSKIP_SPIRV_TOOLS_INSTALL=1 \
-DSPIRV_SKIP_TESTS=1 \
-DSPIRV_SKIP_EXECUTABLES=1 \
-DENABLE_GLSLANG_BINARIES=0 \
-DENABLE_CTEST=0 &&
make -j$THREADS_NUMBER &&
cp "$DEPENDENCIES_DIR/shaderc/libshaderc/libshaderc"* "$INSTALL_DIR/lib/" &&
cp -a -f "$DEPENDENCIES_DIR/shaderc/libshaderc/include/"* "$INSTALL_DIR/include/"
check_error
touch "$DEPENDENCIES_DIR/shaderc.stamp"
fi
# ASTC-encoder
if [ ! -f "$DEPENDENCIES_DIR/astc-encoder.stamp" ]; then
echo "Compiling astc-encoder"
mkdir -p "$DEPENDENCIES_DIR/astc-encoder"
cp -a -f "$DEPENDENCIES_DIR/../lib/astc-encoder/"* "$DEPENDENCIES_DIR/astc-encoder"
cd "$DEPENDENCIES_DIR/astc-encoder"
sed -i '/-Werror/d' Source/cmake_core.cmake
sed -i 's|${ASTC_TARGET}-static|astcenc|g' Source/cmake_core.cmake
if [ "$ARCH_OPTION" = "armv7" ]; then
ASTC_CMAKE_FLAGS=""
ASTC_CFLAGS="-mfpu=neon"
elif [ "$ARCH_OPTION" = "arm64" ]; then
ASTC_CMAKE_FLAGS="-DISA_NEON=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
elif [ "$ARCH_OPTION" = "x86" ]; then
#ASTC_CMAKE_FLAGS="-DISA_SSE2=ON"
ASTC_CMAKE_FLAGS=""
elif [ "$ARCH_OPTION" = "x86_64" ]; then
ASTC_CMAKE_FLAGS="-DISA_SSE41=ON"
fi
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
$ASTC_CMAKE_FLAGS \
-DCMAKE_C_FLAGS="-fpic -O3 -g $ASTC_CFLAGS" \
-DCMAKE_CXX_FLAGS="-fpic -O3 -g $ASTC_CFLAGS" \
-DNO_INVARIANCE=ON -DCLI=OFF &&
make -j$THREADS_NUMBER &&
cp "$DEPENDENCIES_DIR/astc-encoder/Source/libastcenc-native-static.a" "$INSTALL_DIR/lib/" &&
cp "$DEPENDENCIES_DIR/astc-encoder/Source/astcenc.h" "$INSTALL_DIR/include/"
check_error
touch "$DEPENDENCIES_DIR/astc-encoder.stamp"
fi
# Wayland
if [ ! -f "$DEPENDENCIES_DIR/wayland.stamp" ]; then
echo "Compiling wayland"
mkdir -p "$DEPENDENCIES_DIR/wayland"
cp -a -f "$DEPENDENCIES_DIR/../lib/wayland/"* "$DEPENDENCIES_DIR/wayland"
cd "$DEPENDENCIES_DIR/wayland"
meson --prefix="$INSTALL_DIR" -Ddocumentation=false build &&
ninja -C build -j$THREADS_NUMBER &&
ninja -C build install
check_error
touch "$DEPENDENCIES_DIR/wayland.stamp"
fi
# SDL2
if [ ! -f "$DEPENDENCIES_DIR/sdl2.stamp" ]; then
echo "Compiling SDL2"
mkdir -p "$DEPENDENCIES_DIR/sdl2"
cp -a -f "$DEPENDENCIES_DIR/../lib/sdl2/"* "$DEPENDENCIES_DIR/sdl2"
cd "$DEPENDENCIES_DIR/sdl2"
./configure --prefix="$INSTALL_DIR" --disable-audio &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/sdl2.stamp"
fi
# Libvpx
if [ ! -f "$DEPENDENCIES_DIR/libvpx.stamp" ]; then
echo "Compiling libvpx"
mkdir -p "$DEPENDENCIES_DIR/libvpx"
cp -a -f "$DEPENDENCIES_DIR/../lib/libvpx/"* "$DEPENDENCIES_DIR/libvpx"
cd "$DEPENDENCIES_DIR/libvpx"
./configure --prefix="$INSTALL_DIR" \
--enable-shared &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/libvpx.stamp"
fi
# Libbluetooth
if [ ! -f "$DEPENDENCIES_DIR/bluez.stamp" ]; then
echo "Compiling libbluetooth"
mkdir -p "$DEPENDENCIES_DIR/bluez"
cp -a -f "$DEPENDENCIES_DIR/../lib/bluez/"* "$DEPENDENCIES_DIR/bluez"
cd "$DEPENDENCIES_DIR/bluez"
./bootstrap
./configure --prefix="$INSTALL_DIR" \
--enable-library \
--disable-debug \
--disable-systemd \
--disable-tools \
--disable-obex \
--disable-cups \
--disable-client \
--disable-datafiles \
--disable-monitor \
--disable-udev &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/bluez.stamp"
fi
# Sqlite
if [ ! -f "$DEPENDENCIES_DIR/sqlite.stamp" ]; then
echo "Compiling sqlite"
mkdir -p "$DEPENDENCIES_DIR/sqlite"
cp -a -f "$DEPENDENCIES_DIR/../lib/sqlite/"* "$DEPENDENCIES_DIR/sqlite"
sed -i s/' STATIC '/' SHARED '/g "$DEPENDENCIES_DIR/sqlite/CMakeLists.txt"
cd "$DEPENDENCIES_DIR/sqlite"
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DINSTALL_PKGCONFIG_DIR="$PKG_CONFIG_PATH" \
-DENABLE_READLINE=0 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/sqlite.stamp"
fi
# Openglrecorder
if [ ! -f "$DEPENDENCIES_DIR/openglrecorder.stamp" ]; then
echo "Compiling openglrecorder"
mkdir -p "$DEPENDENCIES_DIR/openglrecorder"
cp -a -f "$OPENGLRECORDER_DIR/"* "$DEPENDENCIES_DIR/openglrecorder"
cd "$DEPENDENCIES_DIR/openglrecorder"
cmake . -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
-DBUILD_PULSE_WO_DL=0 &&
make -j$THREADS_NUMBER &&
make install
check_error
touch "$DEPENDENCIES_DIR/openglrecorder.stamp"
fi
# Supertuxkart
mkdir -p "$STKCODE_DIR/$BUILD_DIR"
cd "$STKCODE_DIR/$BUILD_DIR"
if [ -f "$INSTALL_DIR/bin/ispc" ]; then
HAS_ISPC=1
else
HAS_ISPC=0
fi
cmake .. -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
-DUSE_SYSTEM_ANGELSCRIPT=0 \
-DUSE_SYSTEM_ENET=0 \
-DUSE_SYSTEM_WIIUSE=0 \
-DUSE_SYSTEM_SQUISH=0 \
-DUSE_SYSTEM_MCPP=0 \
-DUSE_CRYPTO_OPENSSL=0 \
-DENABLE_WAYLAND_DEVICE=0 \
-DBC7_ISPC=$HAS_ISPC \
-DCMAKE_DISABLE_FIND_PACKAGE_Fontconfig=1 \
$STK_CMAKE_FLAGS &&
make -j$THREADS_NUMBER
check_error
# Stk editor
# mkdir -p "$STKEDITOR_DIR/$BUILD_DIR"
# cd "$STKEDITOR_DIR/$BUILD_DIR"
# cmake .. -DCMAKE_FIND_ROOT_PATH="$INSTALL_DIR" \
# -DSTATIC_ZLIB=1 \
# -DSTATIC_PHYSFS=1 \
# -DCMAKE_DISABLE_FIND_PACKAGE_Fontconfig=1 \
# $STK_CMAKE_FLAGS &&
# make -j$THREADS_NUMBER
# check_error
}
copy_libraries()
{
if [ -z "$1" ] || [ -z "$2" ]; then
return
fi
export ARCH_OPTION="$1"
export LIB_INSTALL_DIR="$2"
export DEPENDENCIES_DIR="$DEPENDENCIES_DIR-$ARCH_OPTION"
export BUILD_DIR="$BUILD_DIR-$ARCH_OPTION"
if [ -z "$DEPENDENCIES_DIR" ] || [ -z "$BUILD_DIR" ] || [ -z "$LIB_INSTALL_DIR" ]; then
return
fi
LIBRARIES_LIST=`LD_LIBRARY_PATH="$DEPENDENCIES_DIR/dependencies/lib" \
ldd "$STKCODE_DIR/$BUILD_DIR/bin/supertuxkart" | \
cut -d">" -f2 | cut -d"(" -f1 | grep "\.so"`
for FILE in $LIBRARIES_LIST; do
BLACKLISTED=0
for BLACKLIST_LIB in $BLACKLIST_LIBS; do
if [ `echo "$FILE" | grep -c "$BLACKLIST_LIB"` -gt 0 ]; then
BLACKLISTED=1
break
fi
done
if [ $BLACKLISTED -eq 1 ]; then
continue
fi
if [ -f "$FILE" ]; then
echo " Copying $FILE"
cp -L "$FILE" "$LIB_INSTALL_DIR"
fi
done
}
test_package()
{
if [ -z "$1" ]; then
return
fi
PACKAGE_DIR="$1"
BINARY_ARCH="$2"
if [ `objdump -a "$PACKAGE_DIR/bin/supertuxkart" | grep -c "$BINARY_ARCH"` -eq 0 ]; then
echo "Error: bin/supertuxkart is not $BINARY_ARCH"
exit 1
fi
# if [ `objdump -a "$PACKAGE_DIR/bin/supertuxkart-editor" | grep -c "$BINARY_ARCH"` -eq 0 ]; then
# echo "Error: bin/supertuxkart-editor is not $BINARY_ARCH"
# exit 1
# fi
if [ `LD_LIBRARY_PATH="$PACKAGE_DIR/lib" ldd "$PACKAGE_DIR/bin/supertuxkart" | grep -c "not found"` -gt 0 ]; then
echo "Error: bin/supertuxkart has some missing libraries"
exit 1
fi
# if [ `ldd "$PACKAGE_DIR/bin/supertuxkart-editor" | grep -c "not found"` -gt 0 ]; then
# echo "Error: bin/supertuxkart-editor has some missing libraries"
# exit 1
# fi
LD_LIBRARY_PATH="$PACKAGE_DIR/lib" "$PACKAGE_DIR/bin/supertuxkart" --version
if [ $? -ne 0 ]; then
echo "Error: Couldn't start bin/supertuxkart"
exit 1
fi
}
create_package()
{
SCHROOT_NAME="$1"
ARCH="$2"
BINARY_ARCH="$3"
echo "Building $ARCH version..."
schroot -c $SCHROOT_NAME -- "$0" build_stk "$ARCH" "-DDEBUG_SYMBOLS=1"
if [ ! -f "$STKCODE_DIR/$BUILD_DIR-$ARCH/bin/supertuxkart" ]; then
echo "Couldn't build $ARCH version."
exit 1
fi
echo "Prepare package..."
STK_PACKAGE_DIR="$STK_INSTALL_DIR/SuperTuxKart-$STK_VERSION-linux-$ARCH"
if [ -f "$STK_PACKAGE_DIR" ]; then
rm -rf "$STK_PACKAGE_DIR"
fi
mkdir -p "$STK_PACKAGE_DIR"
mkdir -p "$STK_PACKAGE_DIR/bin"
mkdir -p "$STK_PACKAGE_DIR/lib"
schroot -c $SCHROOT_NAME -- "$0" copy_libraries "$ARCH" "$STK_PACKAGE_DIR/lib"
find "$STK_PACKAGE_DIR/lib" -type f -exec strip -s {} \;
if [ "$STATIC_GCC" -eq 0 ]; then
mv "$STK_PACKAGE_DIR/lib/libgcc_s.so.1" "$STK_PACKAGE_DIR/lib/libgcc_s.so.1-orig"
mv "$STK_PACKAGE_DIR/lib/libstdc++.so.6" "$STK_PACKAGE_DIR/lib/libstdc++.so.6-orig"
fi
write_run_game_sh "$STK_PACKAGE_DIR"
cp "$STKCODE_DIR/$BUILD_DIR-$ARCH/bin/supertuxkart" "$STK_INSTALL_DIR/supertuxkart-$STK_VERSION-linux-$ARCH-symbols"
# cp "$STKEDITOR_DIR/$BUILD_DIR-$ARCH/bin/supertuxkart-editor" "$STK_INSTALL_DIR/supertuxkart-editor-$STK_VERSION-linux-$ARCH-symbols"
cp -a "$STKCODE_DIR/$BUILD_DIR-$ARCH/bin/supertuxkart" "$STK_PACKAGE_DIR/bin/"
# cp -a "$STKEDITOR_DIR/$BUILD_DIR-$ARCH/bin/supertuxkart-editor" "$STK_PACKAGE_DIR/bin/"
cp -a "$STKCODE_DIR/data/." "$STK_PACKAGE_DIR/data"
# cp -a "$STKASSETS_DIR/editor" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/karts" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/library" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/models" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/music" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/sfx" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/textures" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/tracks" "$STK_PACKAGE_DIR/data/"
cp -a "$STKASSETS_DIR/licenses.txt" "$STK_PACKAGE_DIR/data/"
strip --strip-debug "$STK_PACKAGE_DIR/bin/supertuxkart"
# strip --strip-debug "$STK_PACKAGE_DIR/bin/supertuxkart-editor"
find "$STK_PACKAGE_DIR/bin" -type f -exec chrpath -d {} \;
find "$STK_PACKAGE_DIR/lib" -type f -exec chrpath -d {} \;
chmod a+rwx "$STK_PACKAGE_DIR" -R
find "$STK_PACKAGE_DIR" -type f -exec chmod a-x {} \;
find "$STK_PACKAGE_DIR/bin" -type f -exec chmod a+x {} \;
chmod a+x "$STK_PACKAGE_DIR/run_game.sh"
schroot -c $SCHROOT_NAME -- "$0" test_package "$STK_PACKAGE_DIR" "$BINARY_ARCH"
# Compress package
echo "Compress package..."
cd "$STK_INSTALL_DIR"
tar -czf "SuperTuxKart-$STK_VERSION-linux-$ARCH.tar.gz" "SuperTuxKart-$STK_VERSION-linux-$ARCH"
cd -
}
# Handle clean command
if [ ! -z "$1" ] && [ "$1" = "clean" ]; then
rm -rf "$DEPENDENCIES_DIR-"*
rm -rf "$STKCODE_DIR/$BUILD_DIR-"*
# rm -rf "$STKEDITOR_DIR/$BUILD_DIR-"*
rm -rf "$STK_INSTALL_DIR"
exit 0
fi
# Handle build_stk command (internal only)
if [ ! -z "$1 " ] && [ "$1" = "build_stk" ]; then
build_stk "$2" "$3"
exit 0
fi
# Handle copy_libraries command (internal only)
if [ ! -z "$1 " ] && [ "$1" = "copy_libraries" ]; then
copy_libraries "$2" "$3"
exit 0
fi
# Handle test_package command (internal only)
if [ ! -z "$1 " ] && [ "$1" = "test_package" ]; then
test_package "$2" "$3"
exit 0
fi
# Building STK
create_package "$SCHROOT_32BIT_NAME" "x86" "elf32-i386"
create_package "$SCHROOT_64BIT_NAME" "x86_64" "elf64-x86-64"
create_package "$SCHROOT_ARMV7_NAME" "armv7" "elf32-littlearm"
create_package "$SCHROOT_ARM64_NAME" "arm64" "elf64-littleaarch64"
create_package "$SCHROOT_RISCV_NAME" "riscv64" "elf64-littleriscv"
echo "Success."
+70
View File
@@ -0,0 +1,70 @@
#!/bin/bash
# Start an STK client with:
# --log=0 --stdout=client --online --logbuffer=100000
# Add "--history=2" if you want to use a replay.
# Start a server with:
# --log=0 --stdout=server --lan-server=lan-server --no-graphics --online --logbuffer=100000
# Remove --no-graphics if you also want to see the graphics on the server
# Then do a race, and stop/abort on the client. Wait a long time for
# the log file to be flushed!!! The server will trigger flushing its
# log buffer when the client disconnects as well. So wait for both
# 'server' and 'client' files to stay unchanged.
# First extract the phsyicsafter lines, which contain physics
# information to evaluate client/server consistency.
cat server | grep physicsafter > xx.s
cat client | grep physicsafter > xx.c
# Each log line done during a rewind will start with 'Rewind '. The
# space at the beginning changes the column numbers used in gnuplot
# for each field (as a result rewind lines are not plotted by default)
# Removing the space means that rewind data will be plotted as well
cat xx.c | sed 's/Rewind /Rewind/' >xx.cc
# Now compute the error per client timestep. The parametrs are:
# -f which fields to use: first field is the world time, then one
# or more fields. The script will compute for each client frame the
# earliest immediate previous and next data from the server at the
# client time. Based on those two data points it will interpolate
# the data of the server at the client time, and compute the
# distance between client and server.
# For column numbers check the xx.s files: each name contains the
# column numbers in (), e.g.:
# xyz(9-11) 0.1 0.2 0.3
# This indicates that the column 9-11 in the file are the xyz position
# It saves column counting if the heading is kept up to date
# Comparison of (physical) position used in STK:
~/stk-code/tools/compute_client_error.py -f 6,9,10,11 xx.s xx.cc >pos
# Comparison of physical position at the end of the last full
# bullet time step (i.e. multple of 1/120).
~/stk-code/tools/compute_client_error.py -f 6,12,13,14 xx.s xx.cc >phys-pos
# Comparison of velocity
~/stk-code/tools/compute_client_error.py -f 6,16,17,18 xx.s xx.cc >v
# Comparison of steering
~/stk-code/tools/compute_client_error.py -f 6,20 xx.s xx.cc >steering
# Useful gnuplot commands:
# Plot the path taken for client and server (use xx.c instead of xx.cc not
# remove rewinds):
# plot "xx.cc" u 9:11 w lp lw 2, "xx.s" u 9:11 w lp, "recorded/xx.c" u 9:11 w lp
# Plot steering values used:
# a=20; plot "xx.cc" u 6:a w lp lw 2, "xx.s" u 6:a w lp, "recorded/xx.c" u 6:a w lp
# Change a=XX if you want to display a different value
#
# It can be useful to plot the time step size:
# plot "xx.s" u 6:7 w lp, "xx.cc" u 6:7 w lp
# and also to check that the game time is in sync between client and server:
# Field 29 is the real time clock, so they can be compared if you are running
# on the same machine. So this shows what the game clock is at a given real
# time. Note that the client must be somewhat ahead of the server!
# plot "xx.cc" u 29:6 w lp lw 2, "xx.s" u 29:6 w lp
+112
View File
@@ -0,0 +1,112 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# 2014, By konstin (http://github/konstin)
# 2015, Modified by leyyin
#
# Removes all trailing whitespaces and replaces all tabs with four spaces, the
# files with a given extension in a recursively searched directory.
# It can also count the number of code lines excluding comments and blank
# lines.
#
# Tested with python 2.7 and python 3
import os
import argparse
import sys
def main(directory, is_statistics, is_dry_run, extensions, comments_start):
lines_total = 0
lines_comments = 0
file_counter = 0
files_affected = 0
for dir_path, _, file_names in os.walk(directory):
if is_statistics:
file_counter += len(file_names)
for file_name in file_names:
_, file_extension = os.path.splitext(file_name)
# File does not have an extension
if not file_extension:
continue
# Not a valid extension. Note: extensions have in the 0 position a dot, eg: '.hpp', '.cpp'
if file_extension[1:] not in extensions:
continue
if is_statistics:
files_affected += 1
# Read whole file
path_file = os.path.join(dir_path, file_name)
with open(path_file, 'r') as f:
lines = f.readlines()
if is_statistics:
lines_total += len(lines)
# Scan lines
is_modified = False
for i, line in enumerate(lines):
original_line = line
# Replace tabs with four spaces
line = line.replace('\t', ' ')
line_rstrip = line.rstrip()
if line_rstrip: # Don't de-indent empty lines
line = line_rstrip + '\n'
# Count the number of comments
if is_statistics:
line_lstrip = line.lstrip()
if any([line_lstrip.startswith(c) for c in comments_start]):
lines_comments += 1
# Indicate that we want to write to the current file
if original_line != line:
lines[i] = line # Replace original line
if not is_modified:
is_modified = True
# Write back modified lines
if not is_dry_run and is_modified:
with open(path_file, 'w') as f:
f.writelines(lines)
if is_statistics:
print('Total number of files in {0}: {1}'.format(directory, file_counter))
print('Total number of files affected in {0}: {1}'.format(directory, files_affected))
print('Lines in total: {0}'.format(lines_total))
print(' empty/comments: {0}'.format(lines_comments))
print('↳ excluding comments and blank lines: {0}'.format(lines_total - lines_comments), end='\n' * 2)
print('Finished.')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Remove whitespace from C/C++ files.')
parser.add_argument('directory', default='../src', nargs='?',
help='the directory where all the source files are located. (default: %(default)s)')
parser.add_argument('--dry-run', dest='dry_run', action='store_true',
help='do a dry run. Do not modify/write any files. (default: %(default)s)')
parser.add_argument('--statistics', dest='statistics', action='store_true',
help='display statistics (count files and lines if enabled). On by default.')
parser.add_argument('--no-statistics', dest='statistics', action='store_false', help='do not display statistics.')
parser.add_argument('--extensions', default=["cpp", "hpp", "c", "h"], nargs='+',
help='set file extensions. Eg: --extensions cpp hpp (default: %(default)s).')
parser.add_argument('--comments-start', default=['//', '/*', '*'], nargs='+',
help='set how line comments start. Eg: --comments-start // \'*\'. (default: %(default)s).')
parser.set_defaults(statistics=True)
parser.set_defaults(dry_run=False)
args = parser.parse_args()
if not os.path.exists(args.directory):
print('ERROR: The directory {0} does not exist'.format(args.directory))
sys.exit(1)
print(args)
main(args.directory, args.statistics, args.dry_run, args.extensions, args.comments_start)
+25
View File
@@ -0,0 +1,25 @@
@echo off
if %PROCESSOR_ARCHITECTURE%==x86 (
Pushd %~dp0\stk-code\build-i686\bin\
supertuxkart.exe
popd
)
if %PROCESSOR_ARCHITECTURE%==AMD64 (
Pushd %~dp0\stk-code\build-x86_64\bin\
supertuxkart.exe
popd
)
if %PROCESSOR_ARCHITECTURE%==ARM64 (
Pushd %~dp0\stk-code\build-aarch64\bin\
supertuxkart.exe
popd
)
if %PROCESSOR_ARCHITECTURE%==ARM (
Pushd %~dp0\stk-code\build-armv7\bin\
supertuxkart.exe
popd
)
+401
View File
@@ -0,0 +1,401 @@
#!/bin/sh
#
# (C) 2018 Dawid Gan, under the GPLv3
#
# A script that manages STK servers
#
export SELF_PID=$$
export BASENAME="$(basename "$0")"
export DIRNAME="$(dirname "$(readlink -f "$0")")"
export DATETIME="$(date +%Y%m%d%H%M%S)"
############## General info ##############
# Usage:
#
# Start all servers and close the script:
# run_server.sh start
#
# Start all servers and keep the script running and testing if servers are
# alive:
# run_server.sh startdaemon
#
# Stop all servers and close the running daemon:
# run_server.sh stop
#
# By default the script works with following directories structure
# --- stk-server/
# ----- data/
# ----- supertuxkart
# ----- run_server.sh
################# Config #################
### General ###
# Server name, make sure that it's unique
export SERVER_NAME="STK Server"
# Login for STK account
export LOGIN="xxx"
# Password for STK account
export PASS="yyy"
### Paths ###
# A path for STK server binary file
export CMD="$DIRNAME/supertuxkart"
# A path in which "data" directory is placed
export SUPERTUXKART_DATADIR="$DIRNAME"
# A path for STK assets
export SUPERTUXKART_ASSETS_DIR="$DIRNAME/data/"
# A path to config template for additional options
export CONFIG_FILE="$DIRNAME/config_template.xml"
# A path to server config template for additional options
export SERVER_CONFIG="$DIRNAME/server_config_template.xml"
# A path for configuration files
export HOME="/tmp/stk-server/.config"
# A path where logs will be saved
export STDOUT_DIR="/tmp/stk-server/"
### Daemon mode ###
# How often the script should check if servers are alive
export SLEEP_TIME=300
# How many times the script should try to recreate servers
export MAX_CREATION_RETRIES=100
# Determines if the script should parse stdout.log files to see if servers are
# alive. Set it to 0 to disable.
export CHECK_SERVERS=0
# A path to the application that can be used to show GUI messages when error
# ocurred, server crashed etc. Atm. it will only work with xmessage/gxmessage.
# Zenity and other apps need additional args.
export MESSAGE_CMD="/usr/bin/xmessage"
# Max number of messages that can be showed at the same time. Set it to 0 to
# disable.
export MAX_MESSAGES=3
##########################################
show_message()
{
export MESSAGE="$1"
if [ -z "$MESSAGE" ]; then
return
fi
echo "$MESSAGE"
if [ ! -x "$MESSAGE_CMD" ]; then
return
fi
if [ ! -z "$TERM" ] && [ "$TERM" != "dumb" ]; then
return
fi
if [ $(pidof -x "$MESSAGE_CMD" | wc -w) -ge $MAX_MESSAGES ]; then
return
fi
"$MESSAGE_CMD" "$MESSAGE" &
}
run_servers()
{
echo "Info: Run servers"
"$CMD" --ranked \
--owner-less \
--disable-polling \
--max-players=8 \
--min-players=2 \
--difficulty=3 \
--mode=0 \
--port=2760 \
--wan-server="$SERVER_NAME Ranked" \
--stdout="$DATETIME-normal.log" \
--stdout-dir="$STDOUT_DIR" \
--no-console-log \
--no-firewalled-server \
--log=0 &> /dev/null &
sleep 5
#~ "$CMD" --no-ranked \
#~ --owner-less \
#~ --disable-polling \
#~ --max-players=8 \
#~ --min-players=2 \
#~ --difficulty=2 \
#~ --mode=3 \
#~ --soccer-goals \
#~ --port=2761 \
#~ --wan-server="$SERVER_NAME Soccer" \
#~ --stdout="$DATETIME-soccer.log" \
#~ --stdout-dir="$STDOUT_DIR" \
#~ --no-console-log \
#~ --no-firewalled-server \
#~ --log=0 &> /dev/null &
#~ sleep 5
#~ "$CMD" --no-ranked \
#~ --owner-less \
#~ --disable-polling \
#~ --max-players=8 \
#~ --min-players=2 \
#~ --difficulty=2 \
#~ --mode=2 \
#~ --battle-mode=0 \
#~ --port=2762 \
#~ --wan-server="$SERVER_NAME FFA" \
#~ --stdout="$DATETIME-ffa.log" \
#~ --stdout-dir="$STDOUT_DIR" \
#~ --no-console-log \
#~ --no-firewalled-server \
#~ --log=0 &> /dev/null &
#~ sleep 5
#~ "$CMD" --no-ranked \
#~ --owner-less \
#~ --disable-polling \
#~ --max-players=8 \
#~ --min-players=2 \
#~ --difficulty=2 \
#~ --mode=2 \
#~ --battle-mode=1 \
#~ --port=2763 \
#~ --wan-server="$SERVER_NAME CTF" \
#~ --stdout="$DATETIME-ctf.log" \
#~ --stdout-dir="$STDOUT_DIR" \
#~ --no-console-log \
#~ --no-firewalled-server \
#~ --log=0 &> /dev/null &
#~ sleep 5
"$CMD" --no-ranked \
--no-owner-less \
--disable-polling \
--max-players=8 \
--min-players=2 \
--difficulty=2 \
--mode=3 \
--soccer-goals \
--port=2761 \
--wan-server="$SERVER_NAME Custom" \
--stdout="$DATETIME-custom.log" \
--stdout-dir="$STDOUT_DIR" \
--no-console-log \
--no-firewalled-server \
--log=0 &> /dev/null &
sleep 5
"$CMD" --no-ranked \
--no-owner-less \
--disable-polling \
--max-players=8 \
--min-players=2 \
--difficulty=2 \
--mode=2 \
--battle-mode=1 \
--port=2762 \
--wan-server="$SERVER_NAME Custom 2" \
--stdout="$DATETIME-custom2.log" \
--stdout-dir="$STDOUT_DIR" \
--no-console-log \
--no-firewalled-server \
--log=0 &> /dev/null &
sleep 5
}
init_servers()
{
echo "Info: Init servers"
mkdir -p "$STDOUT_DIR"
"$CMD" --init-user \
--login="$LOGIN" \
--password="$PASS" \
--stdout="$DATETIME-init.log" \
--stdout-dir="$STDOUT_DIR" \
--no-console-log \
--log=0 &> /dev/null
sleep 5
find "$HOME/.config/supertuxkart" -mindepth 1 -maxdepth 1 -type d -exec cp "$CONFIG_FILE" "{}/config.xml" \;
find "$HOME/.config/supertuxkart" -mindepth 1 -maxdepth 1 -type d -exec cp "$SERVER_CONFIG" "{}/server_config.xml" \;
}
stop_servers()
{
echo "Info: Stop servers"
for PID in $(pidof -x "$CMD"); do
echo "Info: Killing the STK server $PID"
kill -15 $PID
done
sleep 10
for PID in $(pidof -x "$CMD"); do
echo "Info: Force killing the STK server $PID"
kill -9 $PID
done
}
check_servers()
{
export SUCCESS=1
for FILE in $(find "$STDOUT_DIR" -type f -name "$DATETIME-*.log"); do
echo "Info: Check file: $FILE"
FILE_BEGIN=$(cat "$FILE" | head -n100)
if [ $(echo $FILE_BEGIN | grep -c "Done saving user, leaving") -gt 0 ]; then
echo "Info: Check server: Servers successfully initialized"
elif [ $(echo $FILE_BEGIN | grep "Server" | grep -c "is now online.") -gt 0 ]; then
echo "Info: Check server: Servers successfully created"
elif [ $(echo $FILE_BEGIN | grep -c "Specified server already exists.") -gt 0 ]; then
show_message "Error: Check server: Specified server already exists"
SUCCESS=0
else
show_message "Error: Check server: Unknown error"
SUCCESS=0
fi
FILE_END=$(cat "$FILE" | tail -n50)
if [ $(echo $FILE_END | grep -c "Session not valid. Please sign in.") -gt 0 ]; then
show_message "Error: Check server: Session not valid"
SUCCESS=0
# elif [ $(echo $FILE_END | grep curl_easy_perform | grep -c "Timeout was reached") -gt 0 ]; then
# show_message "Error: Check server: Timeout was reached"
# SUCCESS=0
fi
done
return $SUCCESS
}
start()
{
if [ ! -z $(pidof -x "$DIRNAME/$BASENAME" -o $SELF_PID) ]; then
show_message "Error: The script is already started"
exit
fi
if [ ! -z $(pidof -s -x "$CMD") ]; then
show_message "Error: Some servers are already running"
exit
fi
if [ ! -f "$CMD" ]; then
show_message "Error: Couldn't find STK executable in CMD: $CMD"
exit
fi
if [ ! -d "$SUPERTUXKART_DATADIR/data" ]; then
show_message "Error: Couldn't find data directory in SUPERTUXKART_DATADIR: $SUPERTUXKART_DATADIR"
exit
fi
if [ ! -d "$SUPERTUXKART_ASSETS_DIR/tracks" ]; then
show_message "Error: Couldn't find assets directories in SUPERTUXKART_ASSETS_DIR: $SUPERTUXKART_ASSETS_DIR"
exit
fi
init_servers
run_servers
if [ $CHECK_SERVERS -eq 1 ]; then
check_servers
fi
echo "Info: Servers started"
}
startdaemon()
{
start
export SERVERS_COUNT=$(pidof -x "$CMD" | wc -w)
export SERVER_OK=1
export LOOP=0
while [ $LOOP -lt $MAX_CREATION_RETRIES ]; do
if [ $(pidof -x "$CMD" | wc -w) -lt $SERVERS_COUNT ]; then
SERVER_OK=0
fi
if [ $SERVER_OK -eq 1 ] && [ $CHECK_SERVERS -eq 1 ]; then
check_servers
SERVER_OK=$?
fi
if [ $SERVER_OK -eq 0 ]; then
show_message "Error: Some servers don't work, restart is needed"
stop_servers
DATETIME="$(date +%Y%m%d%H%M%S)"
init_servers
run_servers
SERVERS_COUNT=$(pidof -x "$CMD" | wc -w)
SERVER_OK=1
LOOP=$(($LOOP + 1))
fi
sleep $SLEEP_TIME
done
$MESSAGE_CMD "Error: Closing STK server"
}
stop()
{
for PID in $(pidof -x "$DIRNAME/$BASENAME" -o $SELF_PID); do
echo "Info: Killing the $BASENAME script $PID"
kill -9 $PID
done
stop_servers
}
if [ "$1" = "startdaemon" ] && [ "$2" != "disown" ]; then
sleep 5 && "$DIRNAME/$BASENAME" "$1" disown &
exit
fi
if [ "$1" = "start" ]; then
start
elif [ "$1" = "startdaemon" ]; then
startdaemon
elif [ "$1" = "stop" ]; then
stop
else
show_message "Error: The script must be started with start/startdaemon/stop command"
fi
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# This script simplifies all challenges by removing any time
# limit, position requirement, etc, and setting the number
# of laps to 0. This is meant to quickly test the story
# mode without having to fully play all challenges.
for i in data/challenges/*.challenge; do
echo "Simplifying $i"
cat $i | sed 's/position="[0-9]*"/position="99"/' \
| sed 's/laps="[0-9]*"/laps="0"/' \
| sed 's/energy="[0-9]*"/energy="0"/' \
| sed 's/time="[0-9]*"/time="9999"/' \
> $i.new
mv $i.new $i
done
for i in data/grandprix/*.grandprix; do
echo "Simplyfing GP $i"
cat $i | sed 's/laps="[0-9]*"/laps="0"/' > $i.new
mv $i.new $i
done
echo
echo "All challenges simplified."
echo "PLEASE do not commit the changes back to our repository!"
echo "========================================================"
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env python3
#
# SuperTuxKart - a fun racing game with go-kart
# Copyright (C) 2006-2015 SuperTuxKart-Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# 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 program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This script uses create_kart_properties.py to create code and then replaces
# the code in the source files. The parts in the source are marked with tags, that
# contain the argument that has to be passed to create_kart_properties.py.
# The script has to be run from the root directory of this project.
import os
import re
import subprocess
from create_kart_properties import functions
def main():
# Check, if it runs in the root directory
if not os.path.isfile("tools/update_characteristics.py"):
print("Please run this script in the root directory of the project.")
exit(1)
for operation, function in functions.items():
result = subprocess.Popen("tools/create_kart_properties.py " +
operation, shell = True,
stdout = subprocess.PIPE).stdout.read().decode('UTF-8')
with open("src/" + function[2], "r") as f:
text = f.read()
# Replace the text by using look behinds and look forwards
text = re.sub("(?<=/\* \<characteristics-start " + operation +
"\> \*/\\n)(.|\n)*(?=\\n\s*/\* <characteristics-end " + operation + "> \*/)", result, text)
with open("src/" + function[2], "w") as f:
f.write(text)
if __name__ == '__main__':
main()
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/awk -f
# A simple awk script to update copyright lines
# It can be used in a simple loop, e.g.:
#
# cd src
# for i in $a; do
# echo $i
# ../update_copyright.sh $i >xx
# rc=$?
# if [ $rc == "0" ]; then
# echo "$i contains no (c)."
# else
# mv xx $i
# fi
# done
BEGIN {
found_something=0;
}
/\(C\)/ {
if(index($4,"-")>0)
new_years=gensub("-.*$","-2015",1,$4);
else
new_years=$4"-2015";
line = $0;
sub($4,new_years,line);
print line;
found_something=1;
next;
}
{
print $0;
}
END {
exit(found_something);
}
+129
View File
@@ -0,0 +1,129 @@
#!/usr/bin/env python3
"""
Usage: ./tools/update_google_play_listings.py /path/to/account_file.json
Pass --beta at the end to generate listings for beta version of stk
"""
import sys
import os
from google.auth.transport.requests import Request
from google.oauth2 import service_account
import googleapiclient.discovery
# List of google play supported locale, this dict allow conversion from po file
lang_dict = {
'af': 'af', # Afrikaans
'sq': 'sq', # Albanian
'am': 'am', # Amharic
'ar': 'ar', # Arabic
'hy': 'hy-AM', # Armenian
'az': 'az-AZ', # Azerbaijani
'bn': 'bn-BD', # Bangla
'eu': 'eu-ES', # Basque
'be': 'be', # Belarusian
'bg': 'bg', # Bulgarian
'my': 'my-MM', # Burmese
'ca': 'ca', # Catalan
'zh_HK': 'zh-HK', # Chinese (Hong Kong)
'zh_CN': 'zh-CN', # Chinese (Simplified)
'zh_TW': 'zh-TW', # Chinese (Traditional)
'hr': 'hr', # Croatian
'cs': 'cs-CZ', # Czech
'da': 'da-DK', # Danish
'nl': 'nl-NL', # Dutch
'en': 'en-US', # English
'et': 'et', # Estonian
'fil': 'fil', # Filipino
'fi': 'fi-FI', # Finnish
'fr_CA': 'fr-CA', # French (Canada)
'fr': 'fr-FR', # French (France)
'gl': 'gl-ES', # Galician
'ka': 'ka-GE', # Georgian
'de': 'de-DE', # German
'el': 'el-GR', # Greek
'gu': 'gu', # Gujarati
'he': 'iw-IL', # Hebrew
'hi': 'hi-IN', # Hindi
'hu': 'hu-HU', # Hungarian
'is': 'is-IS', # Icelandic
'id': 'id', # Indonesian
'it': 'it-IT', # Italian
'ja': 'ja-JP', # Japanese
'kn': 'kn-IN', # Kannada
'kk': 'kk', # Kazakh
'km': 'km-KH', # Khmer
'ko': 'ko-KR', # Korean
'ky': 'ky-KG', # Kyrgyz
'lo': 'lo-LA', # Lao
'lv': 'lv', # Latvian
'lt': 'lt', # Lithuanian
'mk': 'mk-MK', # Macedonian
'ms': 'ms', # Malay
'ml': 'ml-IN', # Malayalam
'mr': 'mr-IN', # Marathi
'mn': 'mn-MN', # Mongolian
'ne': 'ne-NP', # Nepali
'no': 'no-NO', # Norwegian
'fa': 'fa', # Persian
'pl': 'pl-PL', # Polish
'pt_BR': 'pt-BR', # Portuguese (Brazil)
'pt': 'pt-PT', # Portuguese (Portugal)
'pa': 'pa', # Punjabi
'ro': 'ro', # Romanian
'rm': 'rm', # Romansh
'ru': 'ru-RU', # Russian
'sr': 'sr', # Serbian
'si': 'si-LK', # Sinhala
'sk': 'sk', # Slovak
'sl': 'sl', # Slovenian
'es': 'es-ES', # Spanish (Spain)
'sw': 'sw', # Swahili
'sv': 'sv-SE', # Swedish
'ta': 'ta-IN', # Tamil
'te': 'te-IN', # Telugu
'th': 'th', # Thai
'tr': 'tr-TR', # Turkish
'uk': 'uk', # Ukrainian
'ur': 'ur', # Urdu
'vi': 'vi', # Vietnamese
'zu': 'zu', # Zulu
}
package = 'org.supertuxkart.stk'
account_file = sys.argv[1]
is_beta = False
if len(sys.argv) == 3 and sys.argv[2] == '--beta':
package += '_beta'
is_beta = True
SCOPES = ['https://www.googleapis.com/auth/androidpublisher']
credentials = service_account.Credentials.from_service_account_file(
account_file, scopes = SCOPES)
credentials.refresh(Request())
from googleapiclient.discovery import build
service = build('androidpublisher', 'v3', credentials = credentials)
edit_request = service.edits().insert(body = {}, packageName = package)
result = edit_request.execute()
edit_id = result['id']
for lang in os.listdir('./google_play_msg'):
if not lang in lang_dict:
continue
language_name = lang_dict[lang]
print('Updating', language_name)
listing_response = service.edits().listings().update(
editId = edit_id,
language = language_name,
packageName = package,
body = {
'language': language_name,
'title': 'SuperTuxKart Beta' if is_beta else 'SuperTuxKart',
'fullDescription':
open('./google_play_msg/' + lang + ('/full_beta.txt'
if is_beta else '/full.txt'), 'r').read(),
'shortDescription':
open('./google_play_msg/' + lang + '/short.txt', 'r').read(),
}).execute()
commit_request = service.edits().commit(
editId = edit_id, packageName = package).execute()
Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

+1
View File
@@ -0,0 +1 @@
100 ICON "@PROJECT_SOURCE_DIR@/tools/windows_installer/icon.ico"
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

@@ -0,0 +1,331 @@
; Before you start you will need the shelllink plugin for NSIS
; http://nsis.sourceforge.net/ShellLink_plug-in
; Download it from the nsis webpage, and unzip it in the NSIS
; install dir.
;
; To use just put this in a directory below the supertuxkart directory
; which should be called "supertuxkart" and then copy the
; GPL in the supertuxkart directory to 'license.txt'.
; You will then need to make an icon, you can use:
; http://tools.dynamicdrive.com/favicon/ to convert a png to an icon.
; Once you have made an icon put it in the supertuxkart dir and call it
; icon.ico. You will need to do the same for install.ico nd uninstall.ico
; Once there done then all you need to do is compile with NSIS.
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;Include LogicLib http://nsis.sourceforge.net/LogicLib
!include 'LogicLib.nsh'
;--------------------------------
;Include FileFunc lib
!include "FileFunc.nsh"
;--------------------------------
;General
; Version information
; TODO get these from the source code directly
!define VERSION_MAJOR 1
!define VERSION_MINOR 2
!define VERSION_REVISION 0
; Empty means stable, could be -git, -rc1
!define VERSION_BUILD ""
;Name and file
!define APPNAME "SuperTuxKart"
!define APPNAMEANDVERSION "${APPNAME} ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_BUILD}"
!define VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_BUILD}"
!define DESCRIPTION "3D open-source arcade racer with a variety characters, tracks, and modes to play"
Name "${APPNAMEANDVERSION}"
OutFile "${APPNAMEANDVERSION} installer-64bit.exe"
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "https://supertuxkart.net/" # "Support Information" link
!define UPDATEURL "https://supertuxkart.net/" # "Product Updates" link
!define ABOUTURL "https://supertuxkart.net/" # "Publisher" link
RequestExecutionLevel admin
;Default installation folder
InstallDir "$PROGRAMFILES64\${APPNAMEANDVERSION}"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${APPNAMEANDVERSION}" ""
;Sets the text in the bottom corner
BrandingText "${APPNAMEANDVERSION} Installer"
;Set the icon
!define MUI_ICON "install.ico"
!define MUI_UNICON "uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_WELCOMEFINISHPAGE_BITMAP "stk_installer.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP "logo_slim.bmp"
;!define MUI_TEXT_INSTALLING_SUBTITLE "Please vote for SuperTuxKart to become SourceForge's Project of the month at vote.supertuxkart.net"
;!define MUI_TEXT_FINISH_INFO_TEXT "Please vote for SuperTuxKart to become $\"Project of the Month$\" at vote.supertuxkart.net"
; Sets the compressor to /SOLID lzma which when I (hiker) tested was the best.
; Between LZMA and zlib there is only a 20 MB difference.
SetCompressor /SOLID zlib
;Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
; For the uninstaller in the remove programs
!define ADD_REMOVE_KEY_NAME "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAMEANDVERSION}"
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
Function validate_dir
IfFileExists $INSTDIR\data\*.* 0 return
IfFileExists $INSTDIR\Uninstall.exe 0 dont_uninstall
MessageBox MB_YESNO "You can't install ${APPNAMEANDVERSION} in an existing directory. Do you wish to run the uninstaller in $INSTDIR?" IDNO dont_uninstall
; -?=$INSTDIR makes sure that this installer waits for the uninstaller
; to finish. The uninstaller (and directory) are not removed, but the
; uninstaller will be overwritten by our installer anyway.
ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR'
goto return
dont_uninstall:
MessageBox MB_OK "You can't install ${APPNAMEANDVERSION} in an existing directory. Please select a new directory."
abort
return:
FunctionEnd
;--------------------------------
;Pages
;Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\COPYING"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE validate_dir
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APPNAMEANDVERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
;!define MUI_FINISHPAGE_LINK "Please vote for SuperTuxkart here"
;!define MUI_FINISHPAGE_LINK_LOCATION "http://vote.supertuxkart.net"
!insertmacro MUI_PAGE_FINISH
;Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
; ---------------------------------------------------------------------------
; based on http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time
; Sets the variable _VAR_NAME to _FILE_NAME if _VAR_NAME is not defined yet
; and _FILE_NAME exists:
!macro !setIfUndefinedAndExists _VAR_NAME _FILE_NAME
!ifndef ${_VAR_NAME}
!tempfile _TEMPFILE
!ifdef NSIS_WIN32_MAKENSIS
; Windows - cmd.exe
!system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} "${_FILE_NAME}" > "${_TEMPFILE}"'
!else
; Posix - sh
!system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME} ${_FILE_NAME}" > "${_TEMPFILE}"; fi'
!endif
!include '${_TEMPFILE}'
!delfile '${_TEMPFILE}'
!undef _TEMPFILE
!endif
!macroend
!define !setIfUndefinedAndExists "!insertmacro !setIfUndefinedAndExists"
;--------------------------------
;Installer Sections
Section "Install" SecMain
SetOutPath "$INSTDIR"
; files in root dir
; Try to find the binary directory in a list of 'typical' names:
; The first found directory is used
${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld-64\bin\RelWithDebInfo\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld-64\bin\Release\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\build-64\bin\RelWithDebInfo\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\build-64\bin\Release\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build-64\bin\RelWithDebInfo\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build-64\bin\Release\*.*
; This failed to run in mxe nsis
;File /x *.ilk ${EXEC_PATH}
File /x *.ilk ../../build-mingw64/bin/*.*
; Check various options for the editor. Note that us devs mostly use 'bld',
; but documented is the name 'build'
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\Release
!ifdef EDITOR_PATH
File ${EDITOR_PATH}\supertuxkart-editor.exe ${EDITOR_PATH}\supertuxkart-editor.pdb
File ${EDITOR_PATH}\..\..\supertuxkart-editor.ico
!endif
File *.ico
; data + assets
SetOutPath "$INSTDIR\data\"
File /r /x .svn /x wip-* ..\..\..\stk-assets\*.*
File /r /x *.sh ..\..\data\*.*
;Store installation folder
WriteRegStr HKCU "Software\${APPNAMEANDVERSION}" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall ${APPNAMEANDVERSION}.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\uninstall.ico"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAMEANDVERSION}.lnk" "$INSTDIR\supertuxkart.exe" "" "$INSTDIR\icon.ico"
!ifdef EDITOR_PATH
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\supertuxkart-editor (beta).lnk" "$INSTDIR\supertuxkart-editor.exe" "" "$INSTDIR\supertuxkart-editor.ico"
!endif
ShellLink::SetShortCutShowMode $SMPROGRAMS\$STARTMENU_FOLDER\SuperTuxKart.lnk 0
!insertmacro MUI_STARTMENU_WRITE_END
; Registry information for add/remove programs
; See http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" \
"DisplayName" "${APPNAMEANDVERSION} - ${DESCRIPTION}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "Publisher" "${APPNAME}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
# There is no option for modifying or repairing the install
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoModify" 1
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoRepair" 1
; Write size
; [...copy all files here, before GetSize...]
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${ADD_REMOVE_KEY_NAME}" "EstimatedSize" "$0"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall" redist
;Removes all the supertuxkart data files
; DO NOT USE RMDIR ... $INSTDIR\*.* - if someone should e.g.
; install supertuxkart in c:\Program Files (note: no subdirectory)
; this could remove all files in Program Files!!!!!!!!!!!!!!!!!!!
RMDir /r /REBOOTOK $INSTDIR\data
DELETE /REBOOTOK "$INSTDIR\install.ico"
DELETE /REBOOTOK "$INSTDIR\icon.ico"
DELETE /REBOOTOK "$INSTDIR\libbz2.dll"
DELETE /REBOOTOK "$INSTDIR\libcurl-4.dll"
DELETE /REBOOTOK "$INSTDIR\libeay32.dll"
DELETE /REBOOTOK "$INSTDIR\License.txt"
DELETE /REBOOTOK "$INSTDIR\libfreetype-6.dll"
DELETE /REBOOTOK "$INSTDIR\libharfbuzz-0.dll"
DELETE /REBOOTOK "$INSTDIR\libharfbuzz-subset-0.dll"
DELETE /REBOOTOK "$INSTDIR\libjpeg-62.dll"
DELETE /REBOOTOK "$INSTDIR\libogg-0.dll"
DELETE /REBOOTOK "$INSTDIR\libopenglrecorder.dll"
DELETE /REBOOTOK "$INSTDIR\libpng16.dll"
DELETE /REBOOTOK "$INSTDIR\libturbojpeg.dll"
DELETE /REBOOTOK "$INSTDIR\libvorbis-0.dll"
DELETE /REBOOTOK "$INSTDIR\libvorbisenc-2.dll"
DELETE /REBOOTOK "$INSTDIR\libvorbisfile-3.dll"
DELETE /REBOOTOK "$INSTDIR\libvpx.dll"
DELETE /REBOOTOK "$INSTDIR\OpenAL32.dll"
DELETE /REBOOTOK "$INSTDIR\SDL2.dll"
DELETE /REBOOTOK "$INSTDIR\SDL2.pdb"
DELETE /REBOOTOK "$INSTDIR\physfs.dll"
DELETE /REBOOTOK "$INSTDIR\ssleay32.dll"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.exe"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.ico"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.icon"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.pdb"
DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.exe"
DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.ico"
DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.pdb"
DELETE /REBOOTOK "$INSTDIR\uninstall.ico"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
DELETE /REBOOTOK "$INSTDIR\zlib1.dll"
RMDir "$INSTDIR"
SetShellVarContext all
;Remove start menu items
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall ${APPNAMEANDVERSION}.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\${APPNAMEANDVERSION}.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\supertuxkart-editor (beta).lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\${APPNAMEANDVERSION}"
DeleteRegKey HKLM "${ADD_REMOVE_KEY_NAME}"
SectionEnd
@@ -0,0 +1,325 @@
; Before you start you will need the shelllink plugin for NSIS
; http://nsis.sourceforge.net/ShellLink_plug-in
; Download it from the nsis webpage, and unzip it in the NSIS
; install dir.
;
; To use just put this in a directory below the supertuxkart directory
; which should be called "supertuxkart" and then copy the
; GPL in the supertuxkart directory to 'license.txt'.
; You will then need to make an icon, you can use:
; http://tools.dynamicdrive.com/favicon/ to convert a png to an icon.
; Once you have made an icon put it in the supertuxkart dir and call it
; icon.ico. You will need to do the same for install.ico and uninstall.ico
; Once there done then all you need to do is compile with NSIS.
Unicode True
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;Include LogicLib http://nsis.sourceforge.net/LogicLib
!include 'LogicLib.nsh'
;--------------------------------
;Include FileFunc lib
!include "FileFunc.nsh"
;--------------------------------
;Include x64 lib
!include "x64.nsh"
;--------------------------------
; We save ShellLink.dll in current directory
!addplugindir .
;--------------------------------
;General
;Name and file
!define APPNAME "SuperTuxKart"
!define APPNAMEANDVERSION ""
!define ARCH ""
!define VERSION ""
!define DESCRIPTION "3D open-source arcade racer with a variety characters, tracks, and modes to play"
Name "${APPNAMEANDVERSION}"
OutFile ""
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "https://supertuxkart.net/" # "Support Information" link
!define UPDATEURL "https://supertuxkart.net/" # "Product Updates" link
!define ABOUTURL "https://supertuxkart.net/" # "Publisher" link
RequestExecutionLevel admin
; Overwrite later by onInit
InstallDir "$PROGRAMFILES\${APPNAMEANDVERSION}"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${APPNAMEANDVERSION}" ""
;Sets the text in the bottom corner
BrandingText "${APPNAMEANDVERSION} Installer"
;Set the icon
!define MUI_ICON "install.ico"
!define MUI_UNICON "uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_WELCOMEFINISHPAGE_BITMAP "stk_installer.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP "logo_slim.bmp"
;!define MUI_TEXT_INSTALLING_SUBTITLE "Please vote for SuperTuxKart to become SourceForge's Project of the month at vote.supertuxkart.net"
;!define MUI_TEXT_FINISH_INFO_TEXT "Please vote for SuperTuxKart to become $\"Project of the Month$\" at vote.supertuxkart.net"
; Sets the compressor to /SOLID lzma which when I (hiker) tested was the best.
; Between LZMA and zlib there is only a 20 MB difference.
SetCompressor /SOLID zlib
;Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
; For the uninstaller in the remove programs
!define ADD_REMOVE_KEY_NAME "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAMEANDVERSION}"
Function .onInit
;Default installation folder
${If} "${ARCH}" == "x86_64"
${OrIf} "${ARCH}" == "aarch64"
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $INSTDIR "$PROGRAMFILES64\${APPNAMEANDVERSION}"
${Else}
StrCpy $INSTDIR "$PROGRAMFILES\${APPNAMEANDVERSION}"
${EndIf}
${Else}
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
StrCpy $INSTDIR "$PROGRAMFILES32\${APPNAMEANDVERSION}"
${Else}
StrCpy $INSTDIR "$PROGRAMFILES\${APPNAMEANDVERSION}"
${EndIf}
${EndIf}
FunctionEnd
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
Function validate_dir
IfFileExists $INSTDIR\data\*.* 0 return
IfFileExists $INSTDIR\Uninstall.exe 0 dont_uninstall
MessageBox MB_YESNO "You can't install ${APPNAMEANDVERSION} in an existing directory. Do you wish to run the uninstaller in $INSTDIR?" IDNO dont_uninstall
; -?=$INSTDIR makes sure that this installer waits for the uninstaller
; to finish. The uninstaller (and directory) are not removed, but the
; uninstaller will be overwritten by our installer anyway.
ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR'
goto return
dont_uninstall:
MessageBox MB_OK "You can't install ${APPNAMEANDVERSION} in an existing directory. Please select a new directory."
abort
return:
FunctionEnd
;--------------------------------
;Pages
;Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\COPYING"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE validate_dir
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APPNAMEANDVERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
;!define MUI_FINISHPAGE_LINK "Please vote for SuperTuxkart here"
;!define MUI_FINISHPAGE_LINK_LOCATION "http://vote.supertuxkart.net"
!insertmacro MUI_PAGE_FINISH
;Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
; ---------------------------------------------------------------------------
; based on http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time
; Sets the variable _VAR_NAME to _FILE_NAME if _VAR_NAME is not defined yet
; and _FILE_NAME exists:
!macro !setIfUndefinedAndExists _VAR_NAME _FILE_NAME
!ifndef ${_VAR_NAME}
!tempfile _TEMPFILE
!ifdef NSIS_WIN32_MAKENSIS
; Windows - cmd.exe
!system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} "${_FILE_NAME}" > "${_TEMPFILE}"'
!else
; Posix - sh
!system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME} ${_FILE_NAME}" > "${_TEMPFILE}"; fi'
!endif
!include '${_TEMPFILE}'
!delfile '${_TEMPFILE}'
!undef _TEMPFILE
!endif
!macroend
!define !setIfUndefinedAndExists "!insertmacro !setIfUndefinedAndExists"
;--------------------------------
;Installer Sections
Section "Install" SecMain
SetOutPath "$INSTDIR"
; files in root dir
; Try to find the binary directory in a list of 'typical' names:
; The first found directory is used
;${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\RelWithDebInfo\*.*
;${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\Release\*.*
;${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\RelWithDebInfo\*.*
;${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\Release\*.*
;${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\RelWithDebInfo\*.*
;${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\Release\*.*
; Check various options for the editor. Note that us devs mostly use 'bld',
; but documented is the name 'build'
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\RelWithDebInfo
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\Release
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\RelWithDebInfo
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\Release
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\RelWithDebInfo
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\Release
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\RelWithDebInfo
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\Release
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\RelWithDebInfo
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\Release
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\RelWithDebInfo
;${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\Release
File /x *.ilk ..\..\build-${ARCH}\bin\*.*
!ifdef EDITOR_PATH
File ${EDITOR_PATH}\supertuxkart-editor.exe ${EDITOR_PATH}\supertuxkart-editor.pdb
File ${EDITOR_PATH}\..\..\supertuxkart-editor.ico
!endif
File *.ico
; data + assets
SetOutPath "$INSTDIR\data\"
File /r /x .svn /x wip-* ..\..\..\stk-assets\*.*
File /r /x *.sh ..\..\data\*.*
;Store installation folder
WriteRegStr HKCU "Software\${APPNAMEANDVERSION}" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall ${APPNAMEANDVERSION}.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\uninstall.ico"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAMEANDVERSION}.lnk" "$INSTDIR\supertuxkart.exe" "" "$INSTDIR\icon.ico"
!ifdef EDITOR_PATH
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\supertuxkart-editor (beta).lnk" "$INSTDIR\supertuxkart-editor.exe" "" "$INSTDIR\supertuxkart-editor.ico"
!endif
ShellLink::SetShortCutShowMode $SMPROGRAMS\$STARTMENU_FOLDER\SuperTuxKart.lnk 0
!insertmacro MUI_STARTMENU_WRITE_END
; Registry information for add/remove programs
; See http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" \
"DisplayName" "${APPNAMEANDVERSION} - ${ARCH}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "Publisher" "SuperTuxKart Team"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "HelpLink" "${HELPURL}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLUpdateInfo" "${UPDATEURL}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLInfoAbout" "${ABOUTURL}"
# There is no option for modifying or repairing the install
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoModify" 1
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoRepair" 1
; Write size
; [...copy all files here, before GetSize...]
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${ADD_REMOVE_KEY_NAME}" "EstimatedSize" "$0"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall" redist
;Removes all the supertuxkart data files
; DO NOT USE RMDIR ... $INSTDIR\*.* - if someone should e.g.
; install supertuxkart in c:\Program Files (note: no subdirectory)
; this could remove all files in Program Files!!!!!!!!!!!!!!!!!!!
; GitHub Actions script will add installed files as seen in windows.yml
RMDir /r /REBOOTOK $INSTDIR\data
DELETE /REBOOTOK "$INSTDIR\install.ico"
DELETE /REBOOTOK "$INSTDIR\icon.ico"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.ico"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.icon"
DELETE /REBOOTOK "$INSTDIR\uninstall.ico"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
;DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.exe"
;DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.ico"
;DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.pdb"
RMDir "$INSTDIR"
SetShellVarContext all
;Remove start menu items
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall ${APPNAMEANDVERSION}.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\${APPNAMEANDVERSION}.lnk"
;Delete "$SMPROGRAMS\$MUI_TEMP\supertuxkart-editor (beta).lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\${APPNAMEANDVERSION}"
DeleteRegKey HKLM "${ADD_REMOVE_KEY_NAME}"
SectionEnd
@@ -0,0 +1,331 @@
; Before you start you will need the shelllink plugin for NSIS
; http://nsis.sourceforge.net/ShellLink_plug-in
; Download it from the nsis webpage, and unzip it in the NSIS
; install dir.
;
; To use just put this in a directory below the supertuxkart directory
; which should be called "supertuxkart" and then copy the
; GPL in the supertuxkart directory to 'license.txt'.
; You will then need to make an icon, you can use:
; http://tools.dynamicdrive.com/favicon/ to convert a png to an icon.
; Once you have made an icon put it in the supertuxkart dir and call it
; icon.ico. You will need to do the same for install.ico nd uninstall.ico
; Once there done then all you need to do is compile with NSIS.
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;Include LogicLib http://nsis.sourceforge.net/LogicLib
!include 'LogicLib.nsh'
;--------------------------------
;Include FileFunc lib
!include "FileFunc.nsh"
;--------------------------------
;General
; Version information
; TODO get these from the source code directly
!define VERSION_MAJOR 1
!define VERSION_MINOR 2
!define VERSION_REVISION 0
; Empty means stable, could be -git, -rc1
!define VERSION_BUILD ""
;Name and file
!define APPNAME "SuperTuxKart"
!define APPNAMEANDVERSION "${APPNAME} ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_BUILD}"
!define VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_BUILD}"
!define DESCRIPTION "3D open-source arcade racer with a variety characters, tracks, and modes to play"
Name "${APPNAMEANDVERSION}"
OutFile "${APPNAMEANDVERSION} installer-32bit.exe"
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "https://supertuxkart.net/" # "Support Information" link
!define UPDATEURL "https://supertuxkart.net/" # "Product Updates" link
!define ABOUTURL "https://supertuxkart.net/" # "Publisher" link
RequestExecutionLevel admin
;Default installation folder
InstallDir "$PROGRAMFILES\${APPNAMEANDVERSION}"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${APPNAMEANDVERSION}" ""
;Sets the text in the bottom corner
BrandingText "${APPNAMEANDVERSION} Installer"
;Set the icon
!define MUI_ICON "install.ico"
!define MUI_UNICON "uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_WELCOMEFINISHPAGE_BITMAP "stk_installer.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_BITMAP "logo_slim.bmp"
;!define MUI_TEXT_INSTALLING_SUBTITLE "Please vote for SuperTuxKart to become SourceForge's Project of the month at vote.supertuxkart.net"
;!define MUI_TEXT_FINISH_INFO_TEXT "Please vote for SuperTuxKart to become $\"Project of the Month$\" at vote.supertuxkart.net"
; Sets the compressor to /SOLID lzma which when I (hiker) tested was the best.
; Between LZMA and zlib there is only a 20 MB difference.
SetCompressor /SOLID zlib
;Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
; For the uninstaller in the remove programs
!define ADD_REMOVE_KEY_NAME "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAMEANDVERSION}"
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
Function validate_dir
IfFileExists $INSTDIR\data\*.* 0 return
IfFileExists $INSTDIR\Uninstall.exe 0 dont_uninstall
MessageBox MB_YESNO "You can't install ${APPNAMEANDVERSION} in an existing directory. Do you wish to run the uninstaller in $INSTDIR?" IDNO dont_uninstall
; -?=$INSTDIR makes sure that this installer waits for the uninstaller
; to finish. The uninstaller (and directory) are not removed, but the
; uninstaller will be overwritten by our installer anyway.
ExecWait '"$INSTDIR\Uninstall.exe" _?=$INSTDIR'
goto return
dont_uninstall:
MessageBox MB_OK "You can't install ${APPNAMEANDVERSION} in an existing directory. Please select a new directory."
abort
return:
FunctionEnd
;--------------------------------
;Pages
;Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\COPYING"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE validate_dir
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APPNAMEANDVERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
;!define MUI_FINISHPAGE_LINK "Please vote for SuperTuxkart here"
;!define MUI_FINISHPAGE_LINK_LOCATION "http://vote.supertuxkart.net"
!insertmacro MUI_PAGE_FINISH
;Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
; ---------------------------------------------------------------------------
; based on http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time
; Sets the variable _VAR_NAME to _FILE_NAME if _VAR_NAME is not defined yet
; and _FILE_NAME exists:
!macro !setIfUndefinedAndExists _VAR_NAME _FILE_NAME
!ifndef ${_VAR_NAME}
!tempfile _TEMPFILE
!ifdef NSIS_WIN32_MAKENSIS
; Windows - cmd.exe
!system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} "${_FILE_NAME}" > "${_TEMPFILE}"'
!else
; Posix - sh
!system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME} ${_FILE_NAME}" > "${_TEMPFILE}"; fi'
!endif
!include '${_TEMPFILE}'
!delfile '${_TEMPFILE}'
!undef _TEMPFILE
!endif
!macroend
!define !setIfUndefinedAndExists "!insertmacro !setIfUndefinedAndExists"
;--------------------------------
;Installer Sections
Section "Install" SecMain
SetOutPath "$INSTDIR"
; files in root dir
; Try to find the binary directory in a list of 'typical' names:
; The first found directory is used
${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\RelWithDebInfo\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\bld\bin\Release\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\RelWithDebInfo\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\build\bin\Release\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\RelWithDebInfo\*.*
${!setIfUndefinedAndExists} EXEC_PATH ..\..\cmake_build\bin\Release\*.*
; This failed to run in mxe nsis
;File /x *.ilk ${EXEC_PATH}
File /x *.ilk ../../build-mingw/bin/*.*
; Check various options for the editor. Note that us devs mostly use 'bld',
; but documented is the name 'build'
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\bld\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\bld\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\bld\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\editor\build\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\stk-editor\build\Release
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\RelWithDebInfo
${!setIfUndefinedAndExists} EDITOR_PATH ..\..\..\supertuxkart-editor\build\Release
!ifdef EDITOR_PATH
File ${EDITOR_PATH}\supertuxkart-editor.exe ${EDITOR_PATH}\supertuxkart-editor.pdb
File ${EDITOR_PATH}\..\..\supertuxkart-editor.ico
!endif
File *.ico
; data + assets
SetOutPath "$INSTDIR\data\"
File /r /x .svn /x wip-* ..\..\..\stk-assets\*.*
File /r /x *.sh ..\..\data\*.*
;Store installation folder
WriteRegStr HKCU "Software\${APPNAMEANDVERSION}" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall ${APPNAMEANDVERSION}.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\uninstall.ico"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAMEANDVERSION}.lnk" "$INSTDIR\supertuxkart.exe" "" "$INSTDIR\icon.ico"
!ifdef EDITOR_PATH
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\supertuxkart-editor (beta).lnk" "$INSTDIR\supertuxkart-editor.exe" "" "$INSTDIR\supertuxkart-editor.ico"
!endif
ShellLink::SetShortCutShowMode $SMPROGRAMS\$STARTMENU_FOLDER\SuperTuxKart.lnk 0
!insertmacro MUI_STARTMENU_WRITE_END
; Registry information for add/remove programs
; See http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" \
"DisplayName" "${APPNAMEANDVERSION} - ${DESCRIPTION}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "Publisher" "${APPNAME}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
# There is no option for modifying or repairing the install
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoModify" 1
WriteRegStr HKLM "${ADD_REMOVE_KEY_NAME}" "NoRepair" 1
; Write size
; [...copy all files here, before GetSize...]
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${ADD_REMOVE_KEY_NAME}" "EstimatedSize" "$0"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall" redist
;Removes all the supertuxkart data files
; DO NOT USE RMDIR ... $INSTDIR\*.* - if someone should e.g.
; install supertuxkart in c:\Program Files (note: no subdirectory)
; this could remove all files in Program Files!!!!!!!!!!!!!!!!!!!
RMDir /r /REBOOTOK $INSTDIR\data
DELETE /REBOOTOK "$INSTDIR\install.ico"
DELETE /REBOOTOK "$INSTDIR\icon.ico"
DELETE /REBOOTOK "$INSTDIR\libbz2.dll"
DELETE /REBOOTOK "$INSTDIR\libcurl.dll"
DELETE /REBOOTOK "$INSTDIR\libeay32.dll"
DELETE /REBOOTOK "$INSTDIR\License.txt"
DELETE /REBOOTOK "$INSTDIR\libfreetype-6.dll"
DELETE /REBOOTOK "$INSTDIR\libharfbuzz-0.dll"
DELETE /REBOOTOK "$INSTDIR\libharfbuzz-subset-0.dll"
DELETE /REBOOTOK "$INSTDIR\libidn-11.dll"
DELETE /REBOOTOK "$INSTDIR\libjpeg-62.dll"
DELETE /REBOOTOK "$INSTDIR\libogg-0.dll"
DELETE /REBOOTOK "$INSTDIR\libopenglrecorder.dll"
DELETE /REBOOTOK "$INSTDIR\libpng16.dll"
DELETE /REBOOTOK "$INSTDIR\libturbojpeg.dll"
DELETE /REBOOTOK "$INSTDIR\libvorbis-0.dll"
DELETE /REBOOTOK "$INSTDIR\libvorbisenc-2.dll"
DELETE /REBOOTOK "$INSTDIR\libvorbisfile-3.dll"
DELETE /REBOOTOK "$INSTDIR\libvpx.dll"
DELETE /REBOOTOK "$INSTDIR\OpenAL32.dll"
DELETE /REBOOTOK "$INSTDIR\SDL2.dll"
DELETE /REBOOTOK "$INSTDIR\SDL2.pdb"
DELETE /REBOOTOK "$INSTDIR\physfs.dll"
DELETE /REBOOTOK "$INSTDIR\ssleay32.dll"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.exe"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.ico"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.icon"
DELETE /REBOOTOK "$INSTDIR\supertuxkart.pdb"
DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.exe"
DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.ico"
DELETE /REBOOTOK "$INSTDIR\supertuxkart-editor.pdb"
DELETE /REBOOTOK "$INSTDIR\uninstall.ico"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
DELETE /REBOOTOK "$INSTDIR\zlib1.dll"
RMDir "$INSTDIR"
SetShellVarContext all
;Remove start menu items
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall ${APPNAMEANDVERSION}.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\${APPNAMEANDVERSION}.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\supertuxkart-editor (beta).lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\${APPNAMEANDVERSION}"
DeleteRegKey HKLM "${ADD_REMOVE_KEY_NAME}"
SectionEnd
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB