diff --git a/.github/workflows/commit-checker.yml b/.github/workflows/commit-checker.yml
new file mode 100644
index 0000000..36df152
--- /dev/null
+++ b/.github/workflows/commit-checker.yml
@@ -0,0 +1,46 @@
+name: Commit checker
+
+on:
+ pull_request:
+
+jobs:
+ commit-checker:
+ name: Commit checker
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 4
+
+ - name: Get pull-request commits
+ run: |
+ set -x
+ # actions/checkout did a merge checkout of the pull-request. As such, the first
+ # commit is the merge commit. This means that on HEAD^ is the base branch, and
+ # on HEAD^2 are the commits from the pull-request. We now check if those trees
+ # have a common parent. If not, we fetch a few more commits till we do. In result,
+ # the log between HEAD^ and HEAD^2 will be the commits in the pull-request.
+ DEPTH=4
+ while [ -z "$(git merge-base HEAD^ HEAD^2)" ]; do
+ git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --deepen=${DEPTH} origin HEAD
+ DEPTH=$(( ${DEPTH} * 4 ))
+ done
+
+ # Just to show which commits we are going to evaluate.
+ git log --oneline HEAD^..HEAD^2
+
+ - name: Checkout commit-checker
+ uses: actions/checkout@v2
+ with:
+ repository: OpenTTD/OpenTTD-git-hooks
+ path: git-hooks
+ ref: master
+
+ - name: Check commits
+ run: |
+ set -x
+ HOOKS_DIR=./git-hooks/hooks GIT_DIR=.git ./git-hooks/hooks/check-commits.sh HEAD^..HEAD^2
+ echo "Commit checks passed"
+
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..348b1b2
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,149 @@
+name: Publish binaries
+
+on:
+ push:
+ tags:
+ - '*'
+ schedule:
+ - cron: '0 21 * * *'
+
+jobs:
+ publish_binaries:
+ name: Publish binaries
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Checkout tags
+ uses: openttd/actions/checkout@v1
+ with:
+ with-tags: true
+
+ - name: Set variables
+ id: vars
+ run: |
+ set -e
+
+ FULL_VERSION=$(./findversion.sh)
+ RELEASE_DATE=$(TZ='UTC' date +"%Y-%m-%d %H:%M UTC")
+ VERSION=$(echo "${FULL_VERSION}" | cut -f 1 -d$'\t')
+
+ # If this secret is not set, we are doing a dryrun. This means that
+ # people who fork this repository will not try to publish this to AWS
+ # (as that will most likely fail anyway).
+ if [ -z "${{ secrets.CDN_S3_BUCKET }}" ]; then
+ DRY_RUN="true"
+ else
+ DRY_RUN="false"
+ fi
+
+ REPO_NAME=$(echo ${{ github.repository }} | cut -d/ -f2 | tr [A-Z] [a-z])
+ # If we run on "schedule", we are producting a nightly. Otherwise it
+ # is a tag, so a release.
+ if [ "${{ github.event_name }}" = "schedule" ]; then
+ FOLDER="${REPO_NAME}-nightlies"
+
+ # Download the latest version we published; if we are different, it
+ # is safe to assume we are newer.
+ LATEST_VERSION=$(curl --fail -s https://cdn.openttd.org/${FOLDER}/latest.yaml | grep version | cut -d: -f2 | cut -b 2-)
+
+ if [ "${LATEST_VERSION}" = "${VERSION}" ]; then
+ echo "Run on schedule; going to skip this run, as we already build this version"
+ SKIP="true"
+ elif [ "${DRY_RUN}" = "true" ]; then
+ # Also skip everything if we are triggered frm the schedule and we
+ # are a fork. That would waste a lot of CPU cycles for no good reason.
+ echo "Run on schedule; going to skip this run, as this is a fork"
+ SKIP="true"
+ else
+ SKIP="false"
+ fi
+ else
+ FOLDER="${REPO_NAME}-releases"
+ SKIP="false"
+ fi
+
+ echo "::set-output name=release-date::${RELEASE_DATE}"
+ echo "::set-output name=version::${VERSION}"
+ echo "::set-output name=folder::${FOLDER}"
+ echo "::set-output name=dry-run::${DRY_RUN}"
+ echo "::set-output name=skip::${SKIP}"
+
+ echo "Release-date: ${RELEASE_DATE}"
+ echo "Version: ${VERSION}"
+ echo "Folder: ${FOLDER}"
+ echo "Dry-run: ${DRY_RUN}"
+ echo "Skip: ${SKIP}"
+
+ - if: steps.vars.outputs.skip == 'false'
+ name: Install dependencies
+ run: |
+ set -e
+
+ sudo apt update
+ sudo apt install -y catcodec --no-install-recommends
+
+ - if: steps.vars.outputs.skip == 'false'
+ name: Build
+ run: |
+ set -e
+
+ make maintainer-clean
+ make bundle_zip bundle_xsrc
+
+ # Move bundles in their own folder
+ mkdir bundles
+ mv opensfx-${{ steps.vars.outputs.version }}-source.tar.xz bundles/
+ mv opensfx-${{ steps.vars.outputs.version }}-all.zip bundles/
+
+ - if: steps.vars.outputs.skip == 'false'
+ name: Create checksums
+ run: |
+ set -e
+
+ cd bundles
+ for i in $(ls); do
+ openssl dgst -r -md5 -hex $i > $i.md5sum
+ openssl dgst -r -sha1 -hex $i > $i.sha1sum
+ openssl dgst -r -sha256 -hex $i > $i.sha256sum
+ done
+
+ # Show the content of the bundles folder, to make problems debugging easier
+ ls -l
+
+ - if: steps.vars.outputs.skip == 'false'
+ name: Prepare bundles folder
+ run: |
+ set -e
+
+ echo "${{ steps.vars.outputs.release-date }}" > bundles/released.txt
+ cp docs/readme.txt bundles/
+ cp docs/changelog.txt bundles/
+
+ # Show the content of the bundles folder, to make problems debugging easier
+ ls -l bundles/
+
+ - if: steps.vars.outputs.dry-run == 'false' && steps.vars.outputs.skip == 'false'
+ name: Publish
+ id: publish
+ run: |
+ set -e
+
+ aws s3 cp --recursive --only-show-errors bundles/ s3://${{ secrets.CDN_S3_BUCKET }}/${{ steps.vars.outputs.folder }}/${{ steps.vars.outputs.version }}/
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+
+ - if: steps.vars.outputs.dry-run == 'false' && steps.vars.outputs.skip == 'false'
+ name: Trigger 'update CDN'
+ uses: peter-evans/repository-dispatch@v1
+ with:
+ token: ${{ secrets.DEPLOYMENT_TOKEN }}
+ repository: OpenTTD/workflows
+ event-type: update-cdn
+ client-payload: '{"version": "${{ steps.vars.outputs.version }}", "folder": "${{ steps.vars.outputs.folder }}"}'
+
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
new file mode 100644
index 0000000..e4b1ad1
--- /dev/null
+++ b/.github/workflows/testing.yml
@@ -0,0 +1,34 @@
+name: Testing
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+
+jobs:
+ build:
+ name: Build OpenSFX
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ - name: Checkout tags
+ uses: openttd/actions/checkout@v1
+ with:
+ with-tags: true
+ - name: Install dependencies
+ run: |
+ set -e
+
+ sudo apt update
+ sudo apt install -y catcodec --no-install-recommends
+ - name: Build
+ run: |
+ set -e
+
+ make maintainer-clean
+ make bundle_tar bundle_src
+
diff --git a/.hgignore b/.gitignore
similarity index 100%
rename from .hgignore
rename to .gitignore
diff --git a/Makefile b/Makefile
index ee5300a..6743ea3 100644
--- a/Makefile
+++ b/Makefile
@@ -19,10 +19,10 @@ SHELL := /bin/bash
##################################################################
# Definition of the grfs
-REPO_NAME ?= My NewGRF
+REPO_NAME ?= OpenSFX
# This is the filename part common to the grf file, main source file and the tar name
-BASE_FILENAME ?= mynewgrf
+BASE_FILENAME ?= opensfx
# Documentation files
DOC_FILES ?= docs/readme.txt docs/license.txt docs/changelog.txt
@@ -116,50 +116,41 @@ AWK ?= awk
GREP ?= grep
-HG ?= $(shell hg st >/dev/null 2>/dev/null && which hg 2>/dev/null)
+GIT ?= $(shell git status >/dev/null 2>/dev/null && which git 2>/dev/null)
PYTHON ?= python
UNIX2DOS ?= $(shell which unix2dos 2>/dev/null)
-UNIX2DOS_FLAGS ?= $(shell [ -n $(UNIX2DOS) ] && $(UNIX2DOS) -q --version 2>/dev/null && echo "-q" || echo "")
+UNIX2DOS_FLAGS ?= $(shell [ -n $(UNIX2DOS) ] && $(UNIX2DOS) -q --version 1>&2 2>/dev/null && echo "-q" || echo "")
################################################################
-# Get the Repository revision, tags and the modified status
-# The displayed name within OpenTTD / TTDPatch
-# Looks like either
-# a nightly build: GRF's Name nightly-r51
-# a release build (taged version): GRF's Name 0.1
+#
+# Working copy / bundle version detection.
+#
################################################################
-# This must be conditional declarations, or building from the tar.gz won't work anymore
-DEFAULT_BRANCH_NAME ?=
-
-# HG revision
-REPO_REVISION ?= $(shell $(HG) id -n | cut -d+ -f1)
-
-# HG Hash
-REPO_HASH ?= $(shell $(HG) id -i | cut -d+ -f1)
-
-# Days of commit since 2000-1-1 00-00
-REPO_DATE ?= $(shell $(HG) log -r$(REPO_HASH) --template='{time|shortdate}')
-REPO_DAYS_SINCE_2000 ?= $(shell $(PYTHON) -c "from datetime import date; print (date(`echo "$(REPO_DATE)" | sed s/-/,/g | sed s/,0/,/g`)-date(2000,1,1)).days")
-# Whether there are local changes
-REPO_MODIFIED ?= $(shell [ "`$(HG) id | cut -c13`" = "+" ] && echo "M" || echo "")
+# Always run version detection, so we always have an accurate modified
+# flag
+REPO_VERSIONS := $(shell AWK="$(AWK)" "./findversion.sh")
-# Branch name
-REPO_BRANCH ?= $(shell $(HG) id -b | sed "s/default/$(DEFAULT_BRANCH_NAME)/")
+# Use autodetected revisions
+REPO_VERSION ?= $(shell echo "$(REPO_VERSIONS)" | cut -f 1 -d' ')
+REPO_DATE ?= $(shell echo "$(REPO_VERSIONS)" | cut -f 2 -d' ')
+REPO_HASH ?= $(shell echo "$(REPO_VERSIONS)" | cut -f 4 -d' ')
-# Any tag which is not 'tip'
-REPO_TAGS ?= $(shell $(HG) id -t | grep -v "tip")
+# Days of commit since 2000-01-01. REPO_DATE is in format YYYYMMDD.
+REPO_DATE_YEAR := $(shell echo "${REPO_DATE}" | cut -b1-4)
+REPO_DATE_MONTH := $(shell echo "${REPO_DATE}" | cut -b5-6 | sed s/^0//)
+REPO_DATE_DAY := $(shell echo "${REPO_DATE}" | cut -b7-8 | sed s/^0//)
+REPO_DAYS_SINCE_2000 := $(shell $(PYTHON) -c "from datetime import date; print( (date($(REPO_DATE_YEAR),$(REPO_DATE_MONTH),$(REPO_DATE_DAY))-date(2000,1,1)).days)")
-# Filename addition, if we're not building the default branch
-REPO_BRANCH_STRING ?= $(shell if [ "$(REPO_BRANCH)" = "$(DEFAULT_BRANCH_NAME)" ]; then echo ""; else echo "-$(REPO_BRANCH)"; fi)
+REPO_TAGS ?= $(REPO_VERSION)
# The version reported to OpenTTD. Usually days since 2000 + branch offset
NEWGRF_VERSION ?= $(shell let x="$(REPO_DAYS_SINCE_2000) + 65536 * $(REPO_BRANCH_VERSION)"; echo "$$x")
# The shown version is either a tag, or in the absence of a tag the revision.
-REPO_VERSION_STRING ?= $(shell [ -n "$(REPO_TAGS)" ] && echo $(REPO_TAGS)$(REPO_MODIFIED) || echo $(REPO_DATE)$(REPO_BRANCH_STRING) \($(NEWGRF_VERSION):$(REPO_HASH)$(REPO_MODIFIED)\))
+REPO_VERSION_STRING ?= $(shell [ -n "$(REPO_TAGS)" ] && echo $(REPO_TAGS) || echo $(REPO_DATE)$(REPO_BRANCH_STRING) \($(NEWGRF_VERSION):$(REPO_HASH)\))
# The title consists of name and version
REPO_TITLE ?= $(REPO_NAME) $(REPO_VERSION_STRING)
@@ -349,7 +340,7 @@ GRFID_FLAGS ?= -m
# followed by an M, if the source repository is not a clean version.
# Common to all filenames
-FILE_VERSION_STRING ?= $(shell [ -n "$(REPO_TAGS)" ] && echo "$(REPO_TAGS)$(REPO_MODIFIED)" || echo "$(REPO_BRANCH_STRING)$(NEWGRF_VERSION)$(REPO_MODIFIED)")
+FILE_VERSION_STRING ?= $(shell [ -n "$(REPO_TAGS)" ] && echo "$(REPO_TAGS)" || echo "$(REPO_BRANCH_STRING)$(NEWGRF_VERSION)")
DIR_NAME := $(shell [ -n "$(REPO_TAGS)" ] && echo $(BASE_FILENAME)-$(FILE_VERSION_STRING) || echo $(BASE_FILENAME))
VERSIONED_FILENAME := $(BASE_FILENAME)-$(FILE_VERSION_STRING)
DIR_NAME_SRC := $(VERSIONED_FILENAME)-source
@@ -358,7 +349,7 @@ TAR_FILENAME := $(DIR_NAME).tar
BZIP_FILENAME := $(TAR_FILENAME).bz2
GZIP_FILENAME := $(TAR_FILENAME).gz
XZ_FILENAME := $(TAR_FILENAME).xz
-ZIP_FILENAME := $(VERSIONED_FILENAME).zip
+ZIP_FILENAME := $(VERSIONED_FILENAME)-all.zip
MD5_FILENAME := $(DIR_NAME).md5
MD5_SRC_FILENAME ?= $(DIR_NAME).check.md5
@@ -410,7 +401,7 @@ clean::
# Bundle source targets
# target 'bundle_src which builds source bundle
################################################################
-RE_FILES_NO_SRC_BUNDLE = ^.devzone|^.hg
+RE_FILES_NO_SRC_BUNDLE = ^.devzone|^.git
check: $(MD5_FILENAME)
$(_V) if [ -f $(MD5_SRC_FILENAME) ]; then echo "[CHECKING md5sums]"; else echo "Required file '$(MD5_SRC_FILENAME)' which to test against not found!"; false; fi
@@ -419,7 +410,7 @@ check: $(MD5_FILENAME)
$(DIR_NAME_SRC).tar: $(DIR_NAME_SRC)
$(_E) "[BUNDLE SRC]"
- $(_V) $(HG) archive -t tar $<.tar
+ $(_V) $(GIT) archive --format=tar HEAD | tar -x -C $(DIR_NAME_SRC)
$(_V) $(TAR) -uf $@ $^
bundle_src: $(DIR_NAME_SRC).tar
@@ -435,6 +426,7 @@ Makefile.fordist:
$(_V) echo '# Definitions needed for tar releases' >> $@
$(_V) echo '# This part is automatically generated' >> $@
$(_V) echo '################################################################' >> $@
+ $(_V) echo 'REPO_VERSION := $(REPO_VERSION)' >> $@
$(_V) echo 'REPO_REVISION := $(NEWGRF_VERSION)' >> $@
$(_V) echo 'NEWGRF_VERSION := $(NEWGRF_VERSION)' >> $@
$(_V) echo 'REPO_HASH := $(REPO_HASH)' >> $@
@@ -442,12 +434,10 @@ Makefile.fordist:
$(_V) echo 'REPO_TITLE := $(REPO_TITLE)' >> $@
$(_V) echo 'REPO_DATE := $(REPO_DATE)' >> $@
$(_V) echo 'REPO_BRANCH := $(REPO_BRANCH)' >> $@
- $(_V) echo 'REPO_MODIFIED := $(REPO_MODIFIED)' >> $@
- $(_V) echo 'REPO_TAGS := $(REPO_TAGS)' >> $@
- $(_V) echo 'HG := :' >> $@
+ $(_V) echo 'GIT := :' >> $@
$(_V) echo 'PYTHON := :' >> $@
-ifneq ("$(strip $(HG))",":")
+ifneq ("$(strip $(GIT))",":")
$(DIR_NAME_SRC): $(MD5_SRC_FILENAME) Makefile.fordist
$(_E) "[ASSEMBLING] $(DIR_NAME_SRC)"
$(_V)-rm -rf $@
@@ -456,7 +446,7 @@ $(DIR_NAME_SRC): $(MD5_SRC_FILENAME) Makefile.fordist
$(_V) cp $(CP_FLAGS) Makefile.fordist $@/Makefile.dist
else
$(DIR_NAME_SRC):
- $(_E) "Source releases can only be made from a hg checkout."
+ $(_E) "Source releases can only be made from a git checkout."
$(_V) false
endif
diff --git a/Makefile.local.sample b/Makefile.local.sample
index 67aec53..7fa7227 100644
--- a/Makefile.local.sample
+++ b/Makefile.local.sample
@@ -65,7 +65,7 @@
# BZIP = bzip2
# CC = gcc
# AWK = awk
-# HG = hg
+# GIT = git
# MAKE = make
# UNIX2DOS = $(shell [ `which unix2dos 2>/dev/null` ] && echo "unix2dos" || echo "")
# MD5SUM = $(shell [ "$(OSTYPE)" = "Darwin" ] && echo "md5 -r" || echo "md5sum")
diff --git a/docs/readme.ptxt b/docs/readme.ptxt
index 8a962b7..c066896 100644
--- a/docs/readme.ptxt
+++ b/docs/readme.ptxt
@@ -1,6 +1,6 @@
OpenSFX README
-Last updated: 2021-02-14
-Release version: {{REPO_TITLE}}
+Last updated: 2021-02-25
+Release version: {{GRF_TITLE}}
------------------------------------------------------------------------
Table of Contents:
diff --git a/findversion.sh b/findversion.sh
new file mode 100755
index 0000000..8e31219
--- /dev/null
+++ b/findversion.sh
@@ -0,0 +1,113 @@
+#!/bin/sh
+
+# This file is part of OpenTTD.
+# OpenTTD 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, version 2.
+# OpenTTD 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 OpenTTD. If not, see .
+
+
+# Arguments given? Show help text.
+if [ "$#" != "0" ]; then
+ cat <\t\t\t
+VERSION
+ a string describing what version of the code the current checkout is
+ based on.
+ This also includes the commit date, an indication of whether the checkout
+ was modified and which branch was checked out. This value is not
+ guaranteed to be sortable, but is mainly meant for identifying the
+ revision and user display.
+
+ If no revision identifier could be found, this is left empty.
+ISODATE
+ the commit date of the revision this checkout is based on.
+ The commit date may differ from the author date.
+ This can be used to decide upon the age of the source.
+
+ If no timestamp could be found, this is left empty.
+MODIFIED
+ Whether (the src directory of) this checkout is modified or not. A
+ value of 0 means not modified, a value of 2 means it was modified.
+
+ A value of 1 means that the modified status is unknown, because this
+ is not an git checkout for example.
+
+HASH
+ the git revision hash
+
+By setting the AWK environment variable, a caller can determine which
+version of "awk" is used. If nothing is set, this script defaults to
+"awk".
+EOF
+exit 1;
+fi
+
+# Allow awk to be provided by the caller.
+if [ -z "$AWK" ]; then
+ AWK=awk
+fi
+
+# Find out some dirs
+cd `dirname "$0"`
+ROOT_DIR=`pwd`
+
+# Determine if we are using a modified version
+# Assume the dir is not modified
+MODIFIED="0"
+if [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; then
+ # We are a git checkout
+ # Refresh the index to make sure file stat info is in sync, then look for modifications
+ git update-index --refresh >/dev/null
+ if [ -n "`git diff-index HEAD`" ]; then
+ MODIFIED="2"
+ fi
+ HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
+ SHORTHASH=`echo ${HASH} | cut -c1-10`
+ ISODATE=`LC_ALL=C git show -s --pretty='format:%ci' HEAD | "$AWK" '{ gsub("-", "", $1); print $1 }'`
+ BRANCH="`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@'`"
+ TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@'`"
+
+ if [ "$MODIFIED" -eq "0" ]; then
+ hashprefix="-g"
+ elif [ "$MODIFIED" -eq "2" ]; then
+ hashprefix="-m"
+ else
+ hashprefix="-u"
+ fi
+
+ if [ -n "$TAG" ]; then
+ VERSION="${TAG}"
+ ISTAG="1"
+ if [ -n "`echo \"${TAG}\" | grep \"^[0-9.]*$\"`" ]; then
+ ISSTABLETAG="1"
+ else
+ ISSTABLETAG="0"
+ fi
+ else
+ VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
+ ISTAG="0"
+ ISSTABLETAG="0"
+ fi
+
+elif [ -f "$ROOT_DIR/.ottdrev" ]; then
+ # We are an exported source bundle
+ cat $ROOT_DIR/.ottdrev
+ exit
+else
+ # We don't know
+ MODIFIED="1"
+ HASH=""
+ SHORTHASH=""
+ BRANCH=""
+ ISODATE=""
+ TAG=""
+ VERSION=""
+ ISTAG="0"
+ ISSTABLETAG="0"
+fi
+
+echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG $ISSTABLETAG"
+
diff --git a/scripts/Makefile.common b/scripts/Makefile.common
index fd6e097..9f73669 100644
--- a/scripts/Makefile.common
+++ b/scripts/Makefile.common
@@ -141,4 +141,4 @@ endif
addcheck:
$(_E) "[Checking] for missing repo files:"
- $(_V) for i in `$(REPO_FILES_CMD) | grep -E '($(FILE_SRC_RE)grf)$$'`; do hg st $$i `for j in $(FILE_SRC_EXTENSIONS) $(FILE_INC_EXTENSIONS); do cat $$i | grep -v '^//' | grep -o "[a-zA-Z0-9/_.-]\+\.$$j" | sort | uniq; done`; done | sort | uniq | grep "^?" && echo "Missing dependencies!" || echo "All is fine"
+ $(_V) for i in `$(REPO_FILES_CMD) | grep -E '($(FILE_SRC_RE)grf)$$'`; do git status $$i `for j in $(FILE_SRC_EXTENSIONS) $(FILE_INC_EXTENSIONS); do cat $$i | grep -v '^//' | grep -o "[a-zA-Z0-9/_.-]\+\.$$j" | sort | uniq; done`; done | sort | uniq | grep "^?" && echo "Missing dependencies!" || echo "All is fine"
diff --git a/scripts/Makefile.def b/scripts/Makefile.def
index 4d8b31f..0350c04 100644
--- a/scripts/Makefile.def
+++ b/scripts/Makefile.def
@@ -33,7 +33,7 @@ SRCZIP ?= gzip
BZIP ?= bzip2
CC ?= gcc
AWK ?= awk
-HG ?= hg
+GIT ?= git
MAKE ?= make
UNIX2DOS ?= $(shell [ `which unix2dos 2>/dev/null` ] && echo "unix2dos" || echo "")
# Macs have a different md5 command than linux or mingw envirnoment:
@@ -91,14 +91,16 @@ endif
# a release build (taged version): GRF's Name 0.1
################################################################
DEFAULT_BRANCH_NAME ?= nightly
-REPO_REVISION ?= $(shell $(HG) id -n | cut -d+ -f1)
-REPO_MODIFIED ?= $(shell [ "`$(HG) id | cut -c13`" = "+" ] && echo "M" || echo "")
-REPO_BRANCH ?= $(shell $(HG) id -b | sed "s/default/$(DEFAULT_BRANCH_NAME)/")
-REPO_TAGS ?= $(shell $(HG) id -t | grep -v "tip")
-REPO_FILES_CMD := $(HG) st -A | grep -v "^I" | grep -v "^?" | grep -v "^R" | grep -v "^\!" | cut -d\ -f2
-REPO_FILES ?= $(shell $(REPO_FILES_CMD))
-REPO_DIRS ?= $(shell for i in $(REPO_FILES); do dirname $$i; done | sort | uniq)
-REPO_TITLE := $(REPO_NAME) $(shell [ -n "$(REPO_TAGS)" ] && echo $(REPO_TAGS)$(REPO_MODIFIED) || echo $(REPO_BRANCH)-r$(REPO_REVISION)$(REPO_MODIFIED))
+REPO_HASH ?= $(shell $(GIT) log -n1 --pretty="format:%h")
+REPO_REVISION := $(REPO_HASH)
+TEMP_GITSTATUS ?= $(shell $(GIT) status --porcelain=v2 | grep "^[12]")
+REPO_MODIFIED ?= $(shell [ -z "$TEMP_GITSTATUS" ] && echo "" || echo "M")
+REPO_BRANCH ?= $(shell $(GIT) status -b --porcelain=v2 | grep "^# branch\.head" | tail -c7)
+REPO_TAGS ?= $(shell echo "")
+REPO_FILES_CMD := $(GIT) ls-tree -r master --name-only
+REPO_FILES ?= $(shell $(REPO_FILES_CMD))
+REPO_DIRS ?= $(shell for i in $(REPO_FILES); do dirname $$i; done | sort | uniq)
+REPO_TITLE := $(REPO_NAME) $(shell [ -n "$(REPO_TAGS)" ] && echo $(REPO_TAGS)$(REPO_MODIFIED) || echo $(REPO_BRANCH)-r$(REPO_REVISION)$(REPO_MODIFIED))
################################################################
# Rules on how to generate filenames. Usually no need to change
@@ -143,7 +145,7 @@ MAIN_DIRS = $(SRC_DIR) $(DOC_DIR) $(SCRIPT_DIR) $(TEMPLATE_DIR) $(LANG
FILE_SRC_RE := $(shell echo $(FILE_SRC_EXTENSIONS) | tr -s "[:space:]" "|")
FILE_INC_RE := $(shell echo $(FILE_INC_EXTENSIONS) | tr -s "[:space:]" "|")
-FILES_NOT_PACK_RE := "(\.hgignore|\.hgtags|backup\.push|\.devzone)"
+FILES_NOT_PACK_RE := "(\.gitignore|backup\.push|\.devzone)"
# Remove the @ when you want a more verbose output.
_V ?= @
diff --git a/scripts/translations.sh b/scripts/translations.sh
new file mode 100755
index 0000000..f595d46
--- /dev/null
+++ b/scripts/translations.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+function get_langline() {
+ id=`cat $1 | grep -a 'grflangid' | cut -c13-16`
+ text=`cat $1 | grep -a 'STR_GENERAL_DESC' | cut -d: -f2-`
+ langcode=""
+ case "$id" in
+ "0x01" ) langcode="en_GB";;
+ "0x02" ) langcode="de_DE";;
+ "0x1b" ) langcode="af_ZA";;
+ "0x14" ) langcode="ar_EG";;
+ "0x21" ) langcode="eu_ES";;
+ "0x10" ) langcode="be_BY";;
+ "0x37" ) langcode="pt_BR";;
+ "0x18" ) langcode="bg_BG";;
+ "0x22" ) langcode="ca_ES";;
+ "0x0B" ) langcode="cv_RU";;
+ "0x38" ) langcode="hr_HR";;
+ "0x15" ) langcode="cs_CZ";;
+ "0x2d" ) langcode="da_DK";;
+ "0x1f" ) langcode="nl_NL";;
+ "0x3D" ) langcode="en_AU";;
+ "0x00" ) langcode="en_US";;
+ "0x05" ) langcode="eo_EO";;
+ "0x34" ) langcode="et_EE";;
+ "0x12" ) langcode="fo_FO";;
+ "0x35" ) langcode="fi_FI";;
+ "0x03" ) langcode="fr_FR";;
+ "0x32" ) langcode="fy_NL";;
+ "0x31" ) langcode="gl_ES";;
+ "0x13" ) langcode="gd_GB";;
+ "0x1e" ) langcode="el_GR";;
+ "0x61" ) langcode="he_IL";;
+ "0x24" ) langcode="hu_HU";;
+ "0x29" ) langcode="is_IS";;
+ "0x06" ) langcode="io_IO";;
+ "0x5a" ) langcode="id_ID";;
+ "0x08" ) langcode="ga_IE";;
+ "0x27" ) langcode="it_IT";;
+ "0x39" ) langcode="ja_JP";;
+ "0x3a" ) langcode="ko_KR";;
+ "0x2a" ) langcode="lv_LV";;
+ "0x2b" ) langcode="lt_LT";;
+ "0x23" ) langcode="lb_LU";;
+ "0x26" ) langcode="mk_MK";;
+ "0x3c" ) langcode="ms_MY";;
+ "0x09" ) langcode="mt_MT";;
+ "0x11" ) langcode="mr_IN";;
+ "0x2f" ) langcode="nb_NO";;
+ "0x0e" ) langcode="nn_NO";;
+ "0x62" ) langcode="fa_IR";;
+ "0x30" ) langcode="pl_PL";;
+ "0x36" ) langcode="pt_PT";;
+ "0x28" ) langcode="ro_RO";;
+ "0x07" ) langcode="ru_RU";;
+ "0x0d" ) langcode="sr_RS";;
+ "0x56" ) langcode="zh_CN";;
+ "0x16" ) langcode="sk_SK";;
+ "0x2c" ) langcode="sl_SI";;
+ "0x04" ) langcode="es_ES";;
+ "0x2e" ) langcode="sv_SE";;
+ "0x0a" ) langcode="ta_IN";;
+ "0x42" ) langcode="th_TH";;
+ "0x0c" ) langcode="zh_TW";;
+ "0x3e" ) langcode="tr_TR";;
+ "0x33" ) langcode="uk_UA";;
+ "0x54" ) langcode="vi_VN";;
+ "0x0f" ) langcode="cy_GB";;
+ "0x5c" ) langcode="ur_PK";;
+ esac
+
+ # special treatment for the default language, en_GB
+ if [ "$langcode" == "en_GB" ]; then
+ generalline="description = $text"
+ fi
+ line="description.$langcode = $text"
+}
+
+# Obtain list of lang files
+lang_files="`ls lang/*.lng`"
+
+# Loop over language files
+for i in $lang_files; do
+ # echo "Processing: $i"
+ get_langline $i
+
+ # make sure that we only write sensible stuff
+ if [ "$langcode" != "" ] && [ "$text" != "" ]; then
+ echo "$line"
+ fi
+done
+echo "$generalline"
+
+# echo "$1 has language $langcode."