Merge branch 'master' into cpp-11
This commit is contained in:
@@ -21,34 +21,40 @@ Sub FindReplaceInFile(filename, to_find, replacement)
|
||||
file.Close
|
||||
End Sub
|
||||
|
||||
Sub UpdateFile(modified, isodate, version, cur_date, githash, filename)
|
||||
Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, filename)
|
||||
FSO.CopyFile filename & ".in", filename
|
||||
FindReplaceInFile filename, "!!MODIFIED!!", modified
|
||||
FindReplaceInFile filename, "!!ISODATE!!", isodate
|
||||
FindReplaceInFile filename, "!!VERSION!!", version
|
||||
FindReplaceInFile filename, "!!DATE!!", cur_date
|
||||
FindReplaceInFile filename, "!!GITHASH!!", githash
|
||||
FindReplaceInFile filename, "!!ISTAG!!", istag
|
||||
End Sub
|
||||
|
||||
Sub UpdateFiles(version)
|
||||
Dim modified, isodate, cur_date, githash
|
||||
Dim modified, isodate, cur_date, githash, istag
|
||||
cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
|
||||
|
||||
If InStr(version, Chr(9)) Then
|
||||
' Split string into field with tails
|
||||
isodate = Mid(version, InStr(version, Chr(9)) + 1)
|
||||
modified = Mid(isodate, InStr(isodate, Chr(9)) + 1)
|
||||
githash = Mid(modified, InStr(modified, Chr(9)) + 1)
|
||||
istag = Mid(githash, InStr(githash, Chr(9)) + 1)
|
||||
' Remove tails from fields
|
||||
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
|
||||
isodate = Mid(isodate, 1, InStr(isodate, Chr(9)) - 1)
|
||||
modified = Mid(modified, 1, InStr(modified, Chr(9)) - 1)
|
||||
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
|
||||
githash = Mid(githash, 1, InStr(githash, Chr(9)) - 1)
|
||||
Else
|
||||
isodate = 0
|
||||
modified = 1
|
||||
githash = ""
|
||||
istag = 0
|
||||
End If
|
||||
|
||||
UpdateFile modified, isodate, version, cur_date, githash, "../src/rev.cpp"
|
||||
UpdateFile modified, isodate, version, cur_date, githash, "../src/os/windows/ottdres.rc"
|
||||
UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/rev.cpp"
|
||||
UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/os/windows/ottdres.rc"
|
||||
End Sub
|
||||
|
||||
Function DetermineVersion()
|
||||
@@ -137,7 +143,7 @@ Function DetermineVersion()
|
||||
DetermineVersion = "norev000"
|
||||
modified = 1
|
||||
Else
|
||||
Dim version, hashprefix
|
||||
Dim version, hashprefix, istag
|
||||
If modified = 0 Then
|
||||
hashprefix = "-g"
|
||||
ElseIf modified = 2 Then
|
||||
@@ -148,11 +154,13 @@ Function DetermineVersion()
|
||||
|
||||
If tag <> "" Then
|
||||
version = tag
|
||||
istag = 1
|
||||
Else
|
||||
version = isodate & "-" & branch & hashprefix & shorthash
|
||||
istag = 0
|
||||
End If
|
||||
|
||||
DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash
|
||||
DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
@@ -10,6 +10,19 @@
|
||||
# This file generates all project files based on sources.list, so everyone who
|
||||
# can start a bash process, can update the project files.
|
||||
|
||||
# Set neutral locale so sort behaves the same everywhere
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
# We really need gawk for this!
|
||||
AWK=gawk
|
||||
|
||||
${AWK} --version > /dev/null 2> /dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "This script needs gawk to run properly"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT_DIR="`pwd`/.."
|
||||
if ! [ -e "$ROOT_DIR/source.list" ]
|
||||
then
|
||||
@@ -66,7 +79,7 @@ with_cocoa="0"
|
||||
enable_directmusic="1"
|
||||
enable_fluidsynth="0"
|
||||
with_threads="1"
|
||||
file_prefix="..\\\\src\\\\"
|
||||
file_prefix="..\\\\\\\\src\\\\\\\\"
|
||||
|
||||
safety_check() {
|
||||
li=""
|
||||
@@ -97,7 +110,8 @@ rm tmp.headers.*
|
||||
|
||||
load_main_data() {
|
||||
# Read the source.list and process it
|
||||
RES="`cat $1 | tr '\r' '\n' | awk '
|
||||
RES="`cat $1 | ${AWK} -v BINMODE=1 '
|
||||
{ gsub("\\r", "", $0); }
|
||||
/^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; }
|
||||
/^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; }
|
||||
/^( *)#if/ {
|
||||
@@ -149,7 +163,7 @@ load_main_data() {
|
||||
{
|
||||
if (deep == skip) {
|
||||
gsub(" ", "", $0);
|
||||
gsub("/", "\\\\", $0);
|
||||
gsub("/", "\\\\\\\\", $0);
|
||||
split($0, file, ".");
|
||||
cltype = "ClInclude"
|
||||
if (file[2] == "cpp") cltype = "ClCompile";
|
||||
@@ -177,13 +191,13 @@ load_lang_data() {
|
||||
continue
|
||||
fi
|
||||
RES="$RES
|
||||
#2 <CustomBuild Include=\"..\\src\\lang\\"$i".txt\">
|
||||
#2 <CustomBuild Include=\"..\\\\src\\\\lang\\\\"$i".txt\">
|
||||
#2 <Message Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">Generating "$i" language file</Message>
|
||||
#2 <Command Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang \"%(FullPath)\"</Command>
|
||||
#2 <AdditionalInputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\src\\lang\\english.txt;..\\objs\\strgen\\strgen.exe;%(AdditionalInputs)</AdditionalInputs>
|
||||
#2 <Outputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\bin\\lang\\"$i".lng;%(Outputs)</Outputs>
|
||||
#2 <Command Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\\\objs\\\\strgen\\\\strgen.exe -s ..\\\\src\\\\lang -d ..\\\\bin\\\\lang \"%(FullPath)\"</Command>
|
||||
#2 <AdditionalInputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\\\src\\\\lang\\\\english.txt;..\\\\objs\\\\strgen\\\\strgen.exe;%(AdditionalInputs)</AdditionalInputs>
|
||||
#2 <Outputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\\\bin\\\\lang\\\\"$i".lng;%(Outputs)</Outputs>
|
||||
#2 </CustomBuild>
|
||||
#3 <CustomBuild Include=\"..\\src\\lang\\"$i".txt\">
|
||||
#3 <CustomBuild Include=\"..\\\\src\\\\lang\\\\"$i".txt\">
|
||||
#3 <Filter>Translations</Filter>
|
||||
#3 </CustomBuild>"
|
||||
done
|
||||
@@ -194,16 +208,16 @@ load_lang_data() {
|
||||
load_settings_data() {
|
||||
RES=""
|
||||
RES2="
|
||||
#3..\\objs\\settings\\settings_gen.exe -o ..\\objs\\settings\\table\\settings.h -b ..\\src\\table\\settings.h.preamble -a ..\\src\\table\\settings.h.postamble"
|
||||
#3..\\\\objs\\\\settings\\\\settings_gen.exe -o ..\\\\objs\\\\settings\\\\table\\\\settings.h -b ..\\\\src\\\\table\\\\settings.h.preamble -a ..\\\\src\\\\table\\\\settings.h.postamble"
|
||||
for i in `ls $1`
|
||||
do
|
||||
i=`basename $i`
|
||||
RES="$RES
|
||||
#2 <None Include=\"..\\src\\table\\"$i"\" />
|
||||
#4 <None Include=\"..\\src\\table\\"$i"\">
|
||||
#2 <None Include=\"..\\\\src\\\\table\\\\"$i"\" />
|
||||
#4 <None Include=\"..\\\\src\\\\table\\\\"$i"\">
|
||||
#4 <Filter>INI</Filter>
|
||||
#4 </None>"
|
||||
RES2="$RES2 ..\\src\\table\\"$i
|
||||
RES2="$RES2 ..\\\\src\\\\table\\\\"$i
|
||||
done
|
||||
|
||||
eval "$2=\"\$RES\$RES2\""
|
||||
@@ -224,7 +238,7 @@ load_baseset_data() {
|
||||
FIRST=1
|
||||
fi
|
||||
i=`basename $i`
|
||||
RES2="$RES2..\\src\\lang\\$i.txt"
|
||||
RES2="$RES2..\\\\src\\\\lang\\\\$i.txt"
|
||||
done
|
||||
RES2="$RES2</Langs>"
|
||||
# Windows Folder sort and Linux Folder sort are slightly different.
|
||||
@@ -233,13 +247,13 @@ load_baseset_data() {
|
||||
do
|
||||
i=`basename $i`
|
||||
RES="$RES
|
||||
#2 <CustomBuild Include=\"..\\media\\baseset\\"$i"\">
|
||||
#2 <CustomBuild Include=\"..\\\\media\\\\baseset\\\\"$i"\">
|
||||
#2 <Message Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">Generating "$i" baseset metadata file</Message>
|
||||
#2 <Command Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">cscript //nologo ..\\media\\baseset\\translations.vbs \"%(FullPath)\" \"\$(OutputPath)$i\" ..\\src\\lang ..\\bin\\baseset\\orig_extra.grf</Command>
|
||||
#2 <AdditionalInputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">\$(Langs);..\\bin\\baseset\\orig_extra.grf;%(AdditionalInputs)</AdditionalInputs>
|
||||
#2 <Outputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\bin\\baseset\\"$i";%(Outputs)</Outputs>
|
||||
#2 <Command Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">cscript //nologo ..\\\\media\\\\baseset\\\\translations.vbs \"%(FullPath)\" \"\$(OutputPath)$i\" ..\\\\src\\\\lang ..\\\\bin\\\\baseset\\\\orig_extra.grf</Command>
|
||||
#2 <AdditionalInputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">\$(Langs);..\\\\bin\\\\baseset\\\\orig_extra.grf;%(AdditionalInputs)</AdditionalInputs>
|
||||
#2 <Outputs Condition=\"'\$(Configuration)|\$(Platform)'=='Debug|Win32'\">..\\\\bin\\\\baseset\\\\"$i";%(Outputs)</Outputs>
|
||||
#2 </CustomBuild>
|
||||
#3 <CustomBuild Include=\"..\\media\\baseset\\"$i"\">
|
||||
#3 <CustomBuild Include=\"..\\\\media\\\\baseset\\\\"$i"\">
|
||||
#3 <Filter>Baseset Metadata</Filter>
|
||||
#3 </CustomBuild>"
|
||||
done
|
||||
@@ -249,52 +263,28 @@ load_baseset_data() {
|
||||
|
||||
generate() {
|
||||
echo "Generating $2..."
|
||||
if [ $# -eq 3 ]; then
|
||||
# Everything above the !!FILTERS!! marker
|
||||
cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
|
||||
/^$/ { next }
|
||||
/!!FILTERS!!/ { stop = 1; }
|
||||
{
|
||||
if (stop == 0) { print $0 }
|
||||
}
|
||||
' > "$ROOT_DIR/projects/$2"
|
||||
|
||||
echo "$3" >> "$ROOT_DIR/projects/$2"
|
||||
|
||||
# Everything below the !!FILTERS!! marker and above the !!FILES!! marker
|
||||
cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
|
||||
BEGIN { stop = 1; }
|
||||
/^$/ { next }
|
||||
/!!FILTERS!!/ { stop = 2; }
|
||||
/!!FILES!!/ { stop = 1; }
|
||||
{
|
||||
if (stop == 0) { print $0 }
|
||||
if (stop == 2) { stop = 0 }
|
||||
}
|
||||
' >> "$ROOT_DIR/projects/$2"
|
||||
else
|
||||
# Everything above the !!FILES!! marker
|
||||
cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
|
||||
/^$/ { next }
|
||||
/!!FILES!!/ { stop = 1; }
|
||||
{
|
||||
if (stop == 0) { print $0 }
|
||||
}
|
||||
' > "$ROOT_DIR/projects/$2"
|
||||
fi
|
||||
|
||||
echo "$1" >> "$ROOT_DIR/projects/$2"
|
||||
|
||||
# Everything below the !!FILES!! marker
|
||||
cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
|
||||
BEGIN { stop = 1; }
|
||||
# Everything above the !!FILTERS!! marker
|
||||
cat "$ROOT_DIR/projects/$2".in | ${AWK} -v BINMODE=1 -v FILTERS="$3" -v FILES="$1" '
|
||||
{ CR = (match($0, "\\r$") > 0 ? "\r" : "") }
|
||||
/^$/ { next }
|
||||
/!!FILES!!/ { stop = 2; }
|
||||
{
|
||||
if (stop == 0) { print $0 }
|
||||
if (stop == 2) { stop = 0 }
|
||||
/!!FILTERS!!/ {
|
||||
split(FILTERS, filters, "\n");
|
||||
for (i = 1; filters[i] != ""; i++) {
|
||||
print filters[i] CR;
|
||||
}
|
||||
next;
|
||||
}
|
||||
' >> "$ROOT_DIR/projects/$2"
|
||||
/!!FILES!!/ {
|
||||
split(FILES, files, "\n");
|
||||
for (i = 1; files[i] != ""; i++) {
|
||||
print files[i] CR;
|
||||
}
|
||||
next;
|
||||
}
|
||||
{
|
||||
print $0;
|
||||
}
|
||||
' > "$ROOT_DIR/projects/$2"
|
||||
}
|
||||
|
||||
safety_check "$ROOT_DIR/source.list"
|
||||
|
||||
@@ -405,5 +405,5 @@ generate basesetvcxproj, ROOT_DIR & "/projects/basesets_vs140.vcxproj", basesetl
|
||||
generate basesetfiles, ROOT_DIR & "/projects/basesets_vs140.vcxproj.filters", Null
|
||||
generate basesetvcxproj, ROOT_DIR & "/projects/basesets_vs141.vcxproj", basesetlangs
|
||||
generate basesetfiles, ROOT_DIR & "/projects/basesets_vs141.vcxproj.filters", Null
|
||||
generate settingsvcxproj, ROOT_DIR & "/projects/basesets_vs142.vcxproj", settingscommand
|
||||
generate settingsfiles, ROOT_DIR & "/projects/basesets_vs142.vcxproj.filters", Null
|
||||
generate basesetvcxproj, ROOT_DIR & "/projects/basesets_vs142.vcxproj", basesetlangs
|
||||
generate basesetfiles, ROOT_DIR & "/projects/basesets_vs142.vcxproj.filters", Null
|
||||
|
||||
Reference in New Issue
Block a user