summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaohan Chen2015-08-16 17:15:14 -0400
committerYaohan Chen2015-08-16 17:15:14 -0400
commitaae5ee5bb2e82fd7f1dd945d57b869c8acbb35e0 (patch)
treef1004205f1ef7763cb3ad8dd20bb254e17c1db80
parent1cb6d09ae8ff8b3ce7539547a8c8bfd2352b15e0 (diff)
downloadaur-aae5ee5bb2e82fd7f1dd945d57b869c8acbb35e0.tar.gz
Fix compile errors
-rw-r--r--0001-Change-Makefile-to-enable-ccache-to-work.patch46
-rw-r--r--0002-Fix-a-Linux-compilation-error.patch42
-rw-r--r--PKGBUILD12
3 files changed, 98 insertions, 2 deletions
diff --git a/0001-Change-Makefile-to-enable-ccache-to-work.patch b/0001-Change-Makefile-to-enable-ccache-to-work.patch
new file mode 100644
index 00000000000..54dce7897f0
--- /dev/null
+++ b/0001-Change-Makefile-to-enable-ccache-to-work.patch
@@ -0,0 +1,46 @@
+From 67e2fb107fac7370d1efc27dd4b4bbe1ffebca2e Mon Sep 17 00:00:00 2001
+From: Yaohan Chen <yaohan.chen@gmail.com>
+Date: Wed, 12 Aug 2015 19:00:22 -0400
+Subject: [PATCH 1/2] Change Makefile to enable ccache to work
+
+Replace the -MM flag not supported by ccache with -MMD which is
+supported. This also enables simplification of the compilation
+command line.
+
+See
+http://stackoverflow.com/questions/29703938/ccache-doesnt-work-with-gcc-m-flag
+http://www.microhowto.info/howto/automatically_generate_makefile_dependencies.html
+---
+ Makefile | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 04803c8..18ff74f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -137,16 +137,11 @@ INCLUDES := $(addprefix -I,$(SRC_DIR))
+
+ vpath %.cpp $(SRC_DIR)
+
++CPPFLAGS += -MMD -MP
+ define cc-command
+ $1/%.o: %.cpp
+ @echo "Building:" $$<
+ @$(CCACHE) $(CXX) $(BASE_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(INC) $(INCLUDES) -c -o $$@ $$<
+- @$(CXX) $(BASE_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(INC) $(INCLUDES) -MM $$< > $$@.d
+- @mv -f $$@.d $$@.d.tmp
+- @sed -e 's|.*:|$$@:|' < $$@.d.tmp > $$@.d
+- @sed -e 's/.*://' -e 's/\\$$$$//' < $$@.d.tmp | fmt -1 | \
+- sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.d
+- @rm -f $$@.d.tmp
+ endef
+
+ .PHONY: all checkdirs clean
+@@ -180,4 +175,3 @@ $(foreach bdir,$(BUILD_DIR),$(eval $(call cc-command,$(bdir))))
+
+ # pull in dependency info for *existing* .o files
+ -include $(OBJ:.o=.o.d)
+-
+--
+2.5.0
+
diff --git a/0002-Fix-a-Linux-compilation-error.patch b/0002-Fix-a-Linux-compilation-error.patch
new file mode 100644
index 00000000000..073ed2d6023
--- /dev/null
+++ b/0002-Fix-a-Linux-compilation-error.patch
@@ -0,0 +1,42 @@
+From a51e39291a5a83909e6b4cac080dd8cfc358ae8f Mon Sep 17 00:00:00 2001
+From: Yaohan Chen <yaohan.chen@gmail.com>
+Date: Wed, 12 Aug 2015 19:16:46 -0400
+Subject: [PATCH 2/2] Fix a Linux compilation error
+
+A comparison between boost::optional and nullptr in src/tiled/tmx_reader.cpp
+causes compilation to fail with boost version 1.58. This fixes it by
+comparing with boost::none instead, which works in both the latest boost
+and the bundled version.
+
+Although this fix is not necessary for the bundled boost in the
+compilation stage, on a Linux system the linking may fail because the
+boost library on the system doesn't match the bundled boost headers.
+---
+ src/tiled/tmx_reader.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/tiled/tmx_reader.cpp b/src/tiled/tmx_reader.cpp
+index 3409d12..60c8e0f 100644
+--- a/src/tiled/tmx_reader.cpp
++++ b/src/tiled/tmx_reader.cpp
+@@ -139,7 +139,7 @@ namespace tiled
+ void TmxReader::parseMapElement(const boost::property_tree::ptree& pt)
+ {
+ auto attributes = pt.get_child_optional("<xmlattr>");
+- ASSERT_LOG(attributes != nullptr, "map elements must have a minimum number of attributes: 'version', 'orientation', 'width', 'height', 'tilewidth', 'tileheight'");
++ ASSERT_LOG(attributes != boost::none, "map elements must have a minimum number of attributes: 'version', 'orientation', 'width', 'height', 'tilewidth', 'tileheight'");
+ auto version = attributes->get_child("version").data();
+ auto orientation = attributes->get_child("orientation").data();
+ map_->setOrientation(convert_orientation(orientation));
+@@ -201,7 +201,7 @@ namespace tiled
+ void TmxReader::parseTileset(const boost::property_tree::ptree& pt)
+ {
+ auto attributes = pt.get_child_optional("<xmlattr>");
+- ASSERT_LOG(attributes != nullptr, "tileset elements must have a minimum number of attributes: 'firstgid'");
++ ASSERT_LOG(attributes != boost::none, "tileset elements must have a minimum number of attributes: 'firstgid'");
+ int firstgid = attributes->get<int>("firstgid");
+ TileSet ts(firstgid);
+
+--
+2.5.0
+
diff --git a/PKGBUILD b/PKGBUILD
index 370016a9bf6..adec0e34e5c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,8 +12,12 @@ optdepends=('frogatto-git: the default game module'
makedepends=(git boost)
source=('git+https://github.com/anura-engine/anura.git#branch=trunk'
anura.sh
+ 0001-Change-Makefile-to-enable-ccache-to-work.patch
+ 0002-Fix-a-Linux-compilation-error.patch)
md5sums=('SKIP'
- '15f4c03c2404bcfd7618b8f9e0c850ba')
+ '15f4c03c2404bcfd7618b8f9e0c850ba'
+ '63fee48f8260aa1e51f7d4ab9bdb925f'
+ '39a6636cdfe007beb20b754820618601')
install=anura.install
_gitname=anura
@@ -33,7 +37,11 @@ pkgver() {
prepare() {
cd $_gitname
- sed -i -e 's/-lSDL2main//' Makefile
+ git apply ../0001-Change-Makefile-to-enable-ccache-to-work.patch
+ git apply ../0002-Fix-a-Linux-compilation-error.patch
+
+ # use system boost headers
+ rm -r external/include/boost
}
build() {