This commit is contained in:
2020-05-27 01:30:22 +02:00
parent c93f2380c9
commit 5f69624c4d
4 changed files with 12 additions and 139 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
bundle/*

View File

@@ -24,12 +24,13 @@ BANANAS_INI = bananas.ini
MUSA = musa.py MUSA = musa.py
VERSION_INFO := "$(shell ./findversion.sh)" VERSION_INFO := $(shell ./findversion.sh)
REPO_VERSION := $(shell echo ${VERSION_INFO} | cut -f2) VERSION_NUMBER := $(shell echo "$(VERSION_INFO)" | sed 's/v//g')
REPO_TAG := $(shell echo ${VERSION_INFO} | cut -f5) REPO_VERSION := $(shell git rev-parse HEAD)
REPO_DATE := $(shell echo ${VERSION_INFO} | cut -f7) REPO_TAG := $(VERSION_INFO)
REPO_DATE := $(shell date +%Y-%m-%d)
DISPLAY_NAME := $(PROJECT_NAME) $(REPO_TAG) DISPLAY_NAME := $(PROJECT_NAME) $(VERSION_INFO)
BUNDLE_NAME := $(PROJECT_NAME) BUNDLE_NAME := $(PROJECT_NAME)
BUNDLE_FILENAME = $(shell echo "$(DISPLAY_NAME)" | sed 's/ /-/g') BUNDLE_FILENAME = $(shell echo "$(DISPLAY_NAME)" | sed 's/ /-/g')
@@ -47,12 +48,12 @@ bundle: $(BUNDLE_DIR)/$(BUNDLE_FILENAME).tar
$(BUNDLE_DIR)/$(BUNDLE_FILENAME).tar: $(SOURCES) $(LANGFILES) $(DOCS) $(BUNDLE_DIR)/$(BUNDLE_FILENAME).tar: $(SOURCES) $(LANGFILES) $(DOCS)
echo "[Bundle] $@" echo "[Bundle] $@"
python3 check_lang_compatibility.py lang/english.txt info.nut # python3 check_lang_compatibility.py lang/english.txt info.nut
rm -rf "$(BUNDLE_DIR)" rm -rf "$(BUNDLE_DIR)"
mkdir -p "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/lang" mkdir -p "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/lang"
cp $(SOURCES) $(DOCS) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)" cp $(SOURCES) $(DOCS) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)"
cp $(LANGFILES) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/lang" cp $(LANGFILES) "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/lang"
sed -e 's/^PROGRAM_VERSION.*/PROGRAM_VERSION <- $(REPO_VERSION);/' \ sed -e 's/^PROGRAM_VERSION.*/PROGRAM_VERSION <- $(VERSION_NUMBER);/' \
-e 's/^PROGRAM_DATE.*/PROGRAM_DATE <- "$(REPO_DATE)";/' \ -e 's/^PROGRAM_DATE.*/PROGRAM_DATE <- "$(REPO_DATE)";/' \
-e 's/^PROGRAM_NAME.*/PROGRAM_NAME <- "$(DISPLAY_NAME)";/' < info.nut > "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/info.nut" -e 's/^PROGRAM_NAME.*/PROGRAM_NAME <- "$(DISPLAY_NAME)";/' < info.nut > "$(BUNDLE_DIR)/$(BUNDLE_FILENAME)/info.nut"
cd $(BUNDLE_DIR); tar -cf "$(BUNDLE_FILENAME).tar" "$(BUNDLE_FILENAME)" cd $(BUNDLE_DIR); tar -cf "$(BUNDLE_FILENAME).tar" "$(BUNDLE_FILENAME)"

View File

@@ -2,8 +2,7 @@
type = Game Script type = Game Script
name = BeeReward name = BeeReward
# The version is inserted by the Makefile version = v6
version =
description_file = bananas_description.txt description_file = bananas_description.txt
url = https://gitlab.com/jottyfan/bee-reward/ url = https://gitlab.com/jottyfan/bee-reward/

View File

@@ -1,131 +1,3 @@
# make-nml NewGRF build framework #!/bin/bash
# (c) 2014 planetmaker and others
# Contact: planetmaker@openttd.org
#
# 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 2 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# This file is derived from OpenTTD's version check more bananas.ini | grep '^version' | sed "s/^version = //g"
# Arguments given? Show help text.
if [ "$#" != "0" ]; then
cat <<EOF
Usage: ./findversion.sh
Finds the current revision and if the code is modified.
Output: <HASH>\t<VERSION>\t<MODIFIED>\t<TAG>\t<DISPLAY_VERSION>\t<BRANCH>\t<DATE>
HASH
a string unique to the version of the code the current checkout is
based on. The exact format of this string depends on the version
control system in use, but it tries to identify the revision used as
close as possible (using the svn revision number or hg/git hash).
This also includes 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.
VERSION
the version number to be reported to OpenTTD (aka NewGRF version).
This usually is the number of days passed since 1.1.2000 up to the
date of the last commit in the repository.
This number should be sortable. Within a given branch or trunk, a
higher number means a newer version. However, when using git or hg,
this number will not increase on new commits.
If no revision number 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.
Modification is determined in relation to the commit identified by
REV, so not in relation to the svn revision identified by REV_NR.
A value of 1 means that the modified status is unknown, because this
is not an svn/git/hg checkout for example.
TAG
the tag of the commit (if any) - used to indicate and name releases
DISPLAY_VERSION
The version string shown to the user of the NewGRF
BRANCH
The branch the version is based on
DATE
The date of the last commit in ISO format
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=""
REPO_DATE="2000,1,1"
if [ -d "$ROOT_DIR/.hg" ]; then
# We are a hg checkout
if [ -n "`HGPLAIN= hg status -S | grep -v '^?'`" ]; then
MODIFIED="M"
fi
HASH=`LC_ALL=C HGPLAIN= hg id -i | cut -c1-12`
REV="h`echo $HASH | cut -c1-8`"
BRANCH="`hg branch | sed 's@^default$@@'`"
TAG="`HGPLAIN= hg id -t | grep -v 'tip$'`"
ISO_DATE="`HGPLAIN= hg log -r$HASH --template=\"{date|shortdate}\"`"
REPO_DATE="`echo ${ISO_DATE} | sed s/-/,/g | sed s/,0/,/g`"
VERSION=`python -c "from datetime import date; print (date($REPO_DATE)-date(2000,1,1)).days"`
DISPLAY_VERSION="v${VERSION}"
if [ -n "$TAG" ]; then
BRANCH=""
DISPLAY_VERSION="${TAG}"
fi
elif [ -f "$ROOT_DIR/.rev" ]; then
# We are an exported source bundle
cat $ROOT_DIR/.rev
exit
else
# We don't know
HASH=""
VERSION="0"
MODIFIED=""
BRANCH=""
TAG=""
DISPLAY_VERSION="noRev"
ISO_DATE=""
fi
DISPLAY_VERSION="${DISPLAY_VERSION}${MODIFIED}"
if [ -n "$BRANCH" ]; then
DISPLAY_VERSION="$BRANCH-${DISPLAY_VERSION}"
fi
if [ -z "${TAG}" -a -n "${HASH}" ]; then
DISPLAY_VERSION="${DISPLAY_VERSION}-h${HASH}"
fi
echo "$HASH $VERSION $MODIFIED $TAG $DISPLAY_VERSION $BRANCH $ISO_DATE"