diff options
author | felics | 2020-03-12 16:33:10 +0100 |
---|---|---|
committer | felics | 2020-03-12 16:33:10 +0100 |
commit | fb02f017095128f936da7df2a697a3663b5f1517 (patch) | |
tree | 89d6eaa1583f5c86f49d3393deb51c7b1c00d7cc | |
download | aur-fb02f017095128f936da7df2a697a3663b5f1517.tar.gz |
Initial commit of widelands-git; successor of [widelands-bzr](https://aur.archlinux.org/packages/widelands-bzr/).
-rw-r--r-- | .SRCINFO | 35 | ||||
-rw-r--r-- | PKGBUILD | 220 |
2 files changed, 255 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..1a81c2e4d2ef --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,35 @@ +pkgbase = widelands-git + pkgdesc = An elaborate realtime multiplayer strategy game with emphasis on economy and transport - development version. In the spirit of BlueByte's 'Siedler II/ Settlers 2'. + pkgver = 20+r24473_20200312_510e0dd + pkgrel = 1 + epoch = 0 + url = http://widelands.org/ + arch = i686 + arch = x86_64 + license = GPL2 + makedepends = boost + makedepends = cmake + makedepends = doxygen + makedepends = git + makedepends = graphviz + makedepends = python + depends = boost-libs + depends = gettext + depends = glew + depends = hicolor-icon-theme + depends = libpng + depends = sdl2_image + depends = sdl2_mixer + depends = sdl2_ttf + depends = zlib + provides = widelands=20+r24473_20200312_510e0dd + conflicts = widelands + conflicts = widelands-bzr + conflicts = widelands-data + replaces = widelands-bzr<=20+r24473_20200312_510e0dd + options = !strip + source = widelands::git+git://github.com/widelands/widelands.git + sha256sums = SKIP + +pkgname = widelands-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ec9492274542 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,220 @@ +# Maintainer: dreieck +# Contributor: Gabriel Margiani (gamag) <gabriel _strange_curved_character_ margiani · ch> +# Contributor: matthiaskrgr <matthias · krueger _strange_curved_character_ famsike · de> + +_pkgname=widelands +pkgname="${_pkgname}-git" +epoch=0 +_pkgver=latest +pkgver=20+r24473_20200312_510e0dd +pkgrel=1 +pkgdesc="An elaborate realtime multiplayer strategy game with emphasis on economy and transport - development version. In the spirit of BlueByte's 'Siedler II/ Settlers 2'." +url="http://widelands.org/" +arch=('i686' 'x86_64') +license=('GPL2') +depends=( + 'boost-libs' + 'gettext' + 'glew' + 'hicolor-icon-theme' + 'libpng' + 'sdl2_image' + 'sdl2_mixer' + 'sdl2_ttf' + 'zlib' +) +makedepends=( + 'boost' + 'cmake' # For configuring the build + 'doxygen' # For documentation (?) + 'git' # For getting the source + 'graphviz' # For documentation (?) + 'python' +) +optdepends=() +provides=( + "${_pkgname}=${pkgver}" +) +conflicts=( + "${_pkgname}" + "${_pkgname}-bzr" + "${_pkgname}-data" +) +replaces=( + "${_pkgname}-bzr<=${pkgver}" # Previously, the development code was hosted a another location in a bazaar repository. +) +source=( + "${_pkgname}::git+git://github.com/${_pkgname}/${_pkgname}.git" +) +sha256sums=( + 'SKIP' +) +options=('!strip') # Stripping seems not to reduce the size, but takes a long time. + + +# The following variable controls if `ccache` should be used for the build -- it switches some variables, also in build(). +_ccache=false # true|false + +# Check `$USE_CCACHE` environment variable if we should use `ccache` +case "${USE_CCACHE}" in + [yY]|[yY][eE][sS]|[tR][rR][uU][eE]|[oO][nN]) + _ccache=true + ;; +esac + +if "${_ccache}"; then + makedepends+=('ccache') + options+=('ccache') +fi + +# Temporary file in "${srcdir}" the git log should be written to -- it will become part of the installed documentation. +_gitlog="_widelands.git.log" + +### The following is deactivated, since the corresponding section in package() is commented out. +# # Keep the following translations, remove all other. +# _keep_translations=('en_US' 'en_GB' 'de') + + +pkgver() { + cd "${srcdir}/${_pkgname}" + + _get_build_ver() { + grep -Ei 'build[[:space:]]+[0-9]+' "ChangeLog" | head -n 1 | sed -E 's|^.*[Bb]uild[[:space:]]+([0-9]+).*$|\1|' + } + _get_git_commit_count() { + git rev-list --count HEAD + } + _get_git_latest_commit_date() { + git log -n 1 --format=tformat:%ci | awk '{print $1}' | tr -d '-' + } + _get_git_hash() { + git rev-parse --short=7 HEAD + } + + _ver="$(_get_build_ver)" + _rev="$(_get_git_commit_count)" + _date="$(_get_git_latest_commit_date)" + _hash="$(_get_git_hash)" + + if [ -z ${_ver} ]; then + error "Failed to determine build version. Aborting." + return 11 + fi + if [ -z ${_rev} ]; then + error "Failed to determine commit count. Aborting." + return 12 + fi + if [ -z ${_date} ]; then + error "Failed to determine latest commit date. Aborting." + return 13 + fi + if [ -z ${_hash} ]; then + error "Failed to determine git hash. Aborting." + return 14 + fi + + printf "%s" "${_ver}+r${_rev}_${_date}_${_hash}" +} + + +prepare() { + cd "${srcdir}/${_pkgname}" + + msg2 "Creating git log: Executing 'git log' ..." + git log > "${srcdir}/${_gitlog}" + + msg2 "Creating directories 'build' and 'build/locale' ..." + test -d build/locale || mkdir -p build/locale + msg2 "Symlinking 'build/locale/' to the main source base directory ..." + test -e locale || ln -s build/locale . +} + + +build() { + cd "${srcdir}/${_pkgname}/build" + + # If we want to compile with ccache, modify $CC/ $CXX accordingly: + if "${_ccache}"; then + msg2 'Build with `ccache` requested. Setting `$CC` and `$CXX` environment variables accordingly ...' + # If $CC/ $CXX is empty, set a default compiler: + if [ -z $CC ]; then + CC=gcc + fi + if [ -z $CXX ]; then + CXX=g++ + fi + # Only append 'ccache' if it is not already part of $CC/ $CXX: + if ! grep -wq ccache <(printf '%s' "${CC}"); then + CC="ccache ${CC}" + fi + if ! grep -wq ccache <(printf '%s' "${CXX}"); then + CXX="ccache ${CXX}" + fi + export CC + export CXX + fi + + msg2 'Running `cmake` ...' + # YES, -DCMAKE_INSTALL_PREFIX="/usr/bin" is corrent (nothing ${pkgdir}-related!!). + # If this failes on an existing build because of an mismatch of src and build cmake files, just delete build and try again. + cmake \ + -DBUILD_TESTING=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS="" \ + -DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS} -DNDEBUG" \ + -DCMAKE_C_FLAGS="" \ + -DCMAKE_C_FLAGS_RELEASE="${CFLAGS} -DNDEBUG" \ + -DCMAKE_EXE_LINKER_FLAGS="" \ + -DCMAKE_EXE_LINKER_FLAGS_RELEASE="${LDFLAGS}" \ + -DCMAKE_INSTALL_PREFIX="/usr/bin" \ + -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_STATIC_LINKER_FLAGS="" \ + -DGETTEXT_MSGFMT_EXECUTABLE=/usr/bin/msgfmt \ + -DGETTEXT_MSGMERGE_EXECUTABLE=/usr/bib/msgmerge \ + -DICU_CONFIG_EXECUTABLE=/usr/bin/icu-config \ + -DOPTION_ASAN=OFF \ + -DOPTION_BUILD_CODECHECK=OFF \ + -DOPTION_BUILD_TESTS=ON \ + -DOPTION_BUILD_TRANSLATIONS=ON \ + -DOPTION_BUILD_WEBSITE_TOOLS=ON \ + -DOPTION_GLEW_STATIC=OFF \ + -DOPTION_USE_GLBINDING=OFF \ + -DOpenGL_GL_PREFERENCE=LEGACY \ + -DUSE_XDG=OFF \ + -DWL_INSTALL_DATADIR=/usr/share/widelands \ + .. + + msg2 'Running `make` ...' + make + # msg2 'Running `make lang` ...' + # make lang ## Seems not to be needed; seems to be done already with the general `make`-call. +} + + +check() { + cd "${srcdir}/${_pkgname}/build" + msg2 'Running `make test` ...' + make test +} + + +package() { + cd "${srcdir}/${_pkgname}/build" + + msg2 'Running `make install` ...' + make DESTDIR="${pkgdir}" install + + msg2 'Installing additional documentation files ...' + cd "${srcdir}/${_pkgname}" + for _docfile in CREDITS ChangeLog; do + install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}" + done + install -D -v -m644 "${srcdir}/${_gitlog}" "${pkgdir}/usr/share/doc/${_pkgname}/git-log.txt" + +### When re-activating the following, also uncomment the line which sets ${_keep_translations[]}! +# msg2 'Removing translations we do not want ...' +# ls -1d "${pkgdir}/usr/share/widelands/locale"/* | grep -vE $(printf ' -e /%s$' "${_keep_translations[@]}") | while read _line; do +# rm -R "${_line}" +# done +} |