diff games/wesnoth/wesnoth.sh @ 795:96735a865c3e

games/wesnoth: initial import, closes #1653
author David Demelier <markand@malikania.fr>
date Mon, 12 Aug 2019 20:54:37 +0200
parents
children ae55d9077f70
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/games/wesnoth/wesnoth.sh	Mon Aug 12 20:54:37 2019 +0200
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+PKGNAME=wesnoth
+PKGVERSION=1.14.7
+PKGREVISION=1
+PKGLICENSE="GPLv2"
+PKGSUMMARY="turn-based strategy game in fantasy world"
+PKGDOWNLOAD="https://sourceforge.net/projects/wesnoth/files/$PKGNAME-${PKGVERSION%.*}/$PKGNAME-$PKGVERSION/$PKGNAME-$PKGVERSION.tar.bz2"
+PKGDEPENDS="audio/sdl2-mixer
+            dev/cmake:build
+            fonts/fontconfig
+            fonts/pango
+            fonts/sdl2-ttf
+            graphics/cairo
+            graphics/sdl2-image
+            lib/boost
+            multimedia/sdl2"
+PKGOPTIONS="FRIBIDI NLS NOTIFICATIONS"
+
+: ${CC:=clang}
+: ${CFLAGS:=-O2}
+: ${CXX:=clang++}
+: ${CXXFLAGS:=-O2}
+: ${FRIBIDI:=yes}
+: ${NLS:=yes}
+: ${NOTIFICATIONS:=yes}
+
+if [ "$FRIBIDI" = "yes" ]; then
+	PKGDEPENDS="fonts/fribidi $PKGDEPENDS"
+	with_fribidi="-DENABLE_FRIBIDI=On"
+else
+	with_fribidi="-DENABLE_FRIBIDI=Off"
+fi
+
+if [ "$NLS" = "yes" ]; then
+	PKGDEPENDS="core/gettext:build $PKGDEPENDS"
+	with_nls="-DENABLE_NLS=On"
+else
+	with_nls="-DENABLE_NLS=Off"
+fi
+
+if [ "$NOTIFICATIONS" = "yes" ]; then
+	PKGDEPENDS="network/dbus $PKGDEPENDS"
+	with_notifications="-DENABLE_NOTIFICATIONS=On"
+else
+	with_notifications="-DENABLE_NOTIFICATIONS=Off"
+fi
+
+build()
+{
+	rm -rf $PKGNAME-$PKGVERSION
+	tar xvf $PKGNAME-$PKGVERSION.tar.bz2
+	cd $PKGNAME-$PKGVERSION
+
+	# -DENABLE_SERVER=Off: broken with libc++ yet.
+	patch -p0 < ../patch-clang.patch
+	patch -p0 < ../patch-boost.patch
+	mkdir build && cd build
+	cmake .. \
+		-DBUILD_SHARED_LIBS=On \
+		-DCMAKE_BUILD_TYPE=Release \
+		-DCMAKE_CXX_COMPILER="$CXX" \
+		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
+		-DCMAKE_C_COMPILER="$CC" \
+		-DCMAKE_C_FLAGS="$CFLAGS" \
+		-DCMAKE_INSTALL_PREFIX= \
+		-DENABLE_SERVER=Off \
+		$with_fribidi \
+		$with_nls \
+		$with_notifications
+	make -j2
+	make install DESTDIR=$DESTDIR
+	cd ..
+
+	cd ..
+	rm -rf $PKGNAME-$PKGVERSION
+}