xref: /OK3568_Linux_fs/buildroot/package/supertux/supertux.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# supertux
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunSUPERTUX_VERSION = 0.6.2
8*4882a593SmuzhiyunSUPERTUX_SITE = https://github.com/SuperTux/supertux/releases/download/v$(SUPERTUX_VERSION)
9*4882a593SmuzhiyunSUPERTUX_SOURCE = SuperTux-v$(SUPERTUX_VERSION)-Source.tar.gz
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun# Supertux itself is GPL-3.0+, but it bundles a few libraries with different
12*4882a593Smuzhiyun# licenses (sexp-cpp, squirrel, tinygettext) which are linked statically.
13*4882a593SmuzhiyunSUPERTUX_LICENSE = GPL-3.0+ (code), CC-BY-SA-2.0, CC-BY-SA-3.0, CC-BY-SA-4.0, GPL-2.0+ (images music sounds)
14*4882a593SmuzhiyunSUPERTUX_LICENSE_FILES = LICENSE.txt data/AUTHORS
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun# Use bundled squirrel, tinygettext sexp-cpp packages which are hardcoded in
17*4882a593Smuzhiyun# the CMake build system.
18*4882a593SmuzhiyunSUPERTUX_DEPENDENCIES = host-pkgconf boost freetype libcurl libgl libglew \
19*4882a593Smuzhiyun	libogg libpng libvorbis openal physfs sdl2 sdl2_image
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun# CMAKE_BUILD_TYPE=Release: disable profiling code (-pg)
22*4882a593Smuzhiyun# ENABLE_BOOST_STATIC_LIBS=OFF: use boost shared libraries since supertux
23*4882a593Smuzhiyun# depends on !BR2_STATIC_LIBS and boost provide only shared libraries with
24*4882a593Smuzhiyun# BR2_SHARED_LIBS.
25*4882a593Smuzhiyun# ENABLE_OPENGL=ON: Can be disabled but will make SuperTux unplayable slow.
26*4882a593Smuzhiyun# GLBINDING_ENABLED=OFF: use GLEW (default) instead of glbinding.
27*4882a593Smuzhiyun# Install the game directly in /usr/bin and game data in /usr/share/supertux2.
28*4882a593Smuzhiyun# Force using physfs.so from staging since the check on PHYSFS_getPrefDir symbol
29*4882a593Smuzhiyun# in physfs.h (CHECK_SYMBOL_EXISTS) doesn't work.
30*4882a593Smuzhiyun# ENABLE_OPENGLES2=OFF: Disable opengles2 for now.
31*4882a593SmuzhiyunSUPERTUX_CONF_OPTS += \
32*4882a593Smuzhiyun	-DCMAKE_BUILD_TYPE=Release \
33*4882a593Smuzhiyun	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -DGLEW_NO_GLU" \
34*4882a593Smuzhiyun	-DENABLE_BOOST_STATIC_LIBS=OFF \
35*4882a593Smuzhiyun	-DBUILD_DOCUMENTATION=OFF \
36*4882a593Smuzhiyun	-DENABLE_OPENGL=ON \
37*4882a593Smuzhiyun	-DGLBINDING_ENABLED=OFF \
38*4882a593Smuzhiyun	-DINSTALL_SUBDIR_BIN="bin" \
39*4882a593Smuzhiyun	-DINSTALL_SUBDIR_SHARE="share/supertux2" \
40*4882a593Smuzhiyun	-DUSE_SYSTEM_PHYSFS=ON \
41*4882a593Smuzhiyun	-DENABLE_OPENGLES2=OFF
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun# Avoid incompatible posix_memalign declaration on x86 and x86_64 with
44*4882a593Smuzhiyun# musl.
45*4882a593Smuzhiyun# https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01425.html
46*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_i386)$(BR2_x86_64),y:y)
47*4882a593Smuzhiyundefine SUPERTUX_REMOVE_PEDANTIC
48*4882a593Smuzhiyun	$(SED) 's% -pedantic%%' $(@D)/CMakeLists.txt
49*4882a593Smuzhiyun	$(SED) 's%CHECK_CXX_FLAG(pedantic)%%' $(@D)/external/tinygettext/CMakeLists.txt
50*4882a593Smuzhiyunendef
51*4882a593SmuzhiyunSUPERTUX_POST_PATCH_HOOKS += SUPERTUX_REMOVE_PEDANTIC
52*4882a593Smuzhiyunendif
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun# From https://bugs.debian.org/cgi-bin/bugreport.cgi/?bug=770670
55*4882a593Smuzhiyun# "The problem lies within SDL_cpuinfo.h.  It includes altivec.h, which by
56*4882a593Smuzhiyun# definition provides an unconditional vector, pixel and bool define in
57*4882a593Smuzhiyun# standard-c++ mode.  In GNU-c++ mode this names are only defined
58*4882a593Smuzhiyun# context-sensitive by cpp.  SDL_cpuinfo.h is included by SDL.h.
59*4882a593Smuzhiyun# Including altivec.h makes arbitrary code break."
60*4882a593Smuzhiyun#
61*4882a593Smuzhiyun# Acording to a bug report in GCC [1]:
62*4882a593Smuzhiyun# "You need to use -std=g++11 or undefine bool after the include of altivec.h
63*4882a593Smuzhiyun# as context sensitive keywords is not part of the C++11 standard".
64*4882a593Smuzhiyun# So use gnu++11 instead of c++11 only for altivec system.
65*4882a593Smuzhiyun# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58241#c3
66*4882a593Smuzhiyunifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
67*4882a593Smuzhiyundefine SUPERTUX_FIX_ALTIVEC_ISSUE
68*4882a593Smuzhiyun	$(SED) 's%std=c++0x%std=gnu++0x%' $(@D)/external/tinygettext/CMakeLists.txt
69*4882a593Smuzhiyunendef
70*4882a593SmuzhiyunSUPERTUX_POST_PATCH_HOOKS += SUPERTUX_FIX_ALTIVEC_ISSUE
71*4882a593Smuzhiyunendif
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun$(eval $(cmake-package))
74