diff mbox

[v2,01/13] package/irrlicht: new package

Message ID 20170612205410.20230-1-romain.naour@gmail.com
State Accepted
Headers show

Commit Message

Romain Naour June 12, 2017, 8:53 p.m. UTC
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
v2: Move to Target packages > Libraries > Graphics (Bernd)
    Place Zlib license first (Arnout)
    Add an explanation why we can't use libraries provided by Buildroot. (Arnout))
---
 DEVELOPERS                                         |  1 +
 package/Config.in                                  |  1 +
 ...-CPPFLAGS-CXXFLAGS-and-CFLAGS-in-Makefile.patch | 44 ++++++++++++++++
 package/irrlicht/0002-remove-sys-sysctl.h.patch    | 38 ++++++++++++++
 package/irrlicht/Config.in                         | 17 +++++++
 package/irrlicht/irrlicht.hash                     |  5 ++
 package/irrlicht/irrlicht.mk                       | 58 ++++++++++++++++++++++
 7 files changed, 164 insertions(+)
 create mode 100644 package/irrlicht/0001-override-CPPFLAGS-CXXFLAGS-and-CFLAGS-in-Makefile.patch
 create mode 100644 package/irrlicht/0002-remove-sys-sysctl.h.patch
 create mode 100644 package/irrlicht/Config.in
 create mode 100644 package/irrlicht/irrlicht.hash
 create mode 100644 package/irrlicht/irrlicht.mk

Comments

Thomas Petazzoni June 24, 2017, 3:14 p.m. UTC | #1
Hello,

On Mon, 12 Jun 2017 22:53:58 +0200, Romain Naour wrote:
> +# Bundled libraries: bzip2, libaesGladman, libpng, lzma, zlib,
> +# The handcrafted Makefile can only use bundled libraries.
> +IRRLICHT_LICENSE = Zlib (irrlicht), bzip2 license, jpeg-license (BSD-3-Clause-like), Libpng

Why didn't you use SPDX license codes here? Also, what we put between
parenthesis is not details about the license, but the components on
which the license applies. So I've changed this line to:

IRRLICHT_LICENSE = Zlib (irrlicht), BSD-3-Clause (libaesGladman), bzip2-1.0.5 (bzip2), IJG (libjpeg), Libpng (libpng)

Applied to master after fixing this. Thanks!

Thomas
diff mbox

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 7d8b410..5ec1d7d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1382,6 +1382,7 @@  F:	package/efl/
 F:	package/enlightenment/
 F:	package/expedite/
 F:	package/iqvlinux/
+F:	package/irrlicht/
 F:	package/liblinear/
 F:	package/lensfun/
 F:	package/linux-syscall-support/
diff --git a/package/Config.in b/package/Config.in
index 3a99c86..938235f 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1029,6 +1029,7 @@  menu "Graphics"
 	source "package/gtksourceview/Config.in"
 	source "package/harfbuzz/Config.in"
 	source "package/ijs/Config.in"
+	source "package/irrlicht/Config.in"
 	source "package/imlib2/Config.in"
 	source "package/jasper/Config.in"
 	source "package/jpeg/Config.in"
diff --git a/package/irrlicht/0001-override-CPPFLAGS-CXXFLAGS-and-CFLAGS-in-Makefile.patch b/package/irrlicht/0001-override-CPPFLAGS-CXXFLAGS-and-CFLAGS-in-Makefile.patch
new file mode 100644
index 0000000..d6e4b63
--- /dev/null
+++ b/package/irrlicht/0001-override-CPPFLAGS-CXXFLAGS-and-CFLAGS-in-Makefile.patch
@@ -0,0 +1,44 @@ 
+From 5c5e6d0f469c8b4384bbe5d6c8f78069c182daf0 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 9 Apr 2017 19:56:55 +0200
+Subject: [PATCH] override CPPFLAGS, CXXFLAGS and CFLAGS in Makefile
+
+When CPPFLAGS is passed on the command line, include paths for the
+bundled libraries are lost. Since the hand written Makefile want
+to use them unconditionally, we need to use the key word "override"
+before CPPFLAGS.
+
+Do the same for CXXFLAGS and CFLAGS otherwise -fPIC is lost.
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ source/Irrlicht/Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile
+index 0712b07..b334e9c 100644
+--- a/source/Irrlicht/Makefile
++++ b/source/Irrlicht/Makefile
+@@ -62,7 +62,7 @@ LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \
+ ###############
+ #Compiler flags
+ CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng
+-CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
++override CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
+ CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
+ ifndef NDEBUG
+ CXXFLAGS += -g -D_DEBUG
+@@ -74,8 +74,8 @@ CXXFLAGS += -pg
+ endif
+ CFLAGS := -O3 -fexpensive-optimizations -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES
+ 
+-sharedlib sharedlib_osx: CXXFLAGS += -fPIC
+-sharedlib sharedlib_osx: CFLAGS += -fPIC
++sharedlib sharedlib_osx: override CXXFLAGS += -fPIC
++sharedlib sharedlib_osx: override CFLAGS += -fPIC
+ 
+ #multilib handling
+ ifeq ($(HOSTTYPE), x86_64)
+-- 
+2.9.3
+
diff --git a/package/irrlicht/0002-remove-sys-sysctl.h.patch b/package/irrlicht/0002-remove-sys-sysctl.h.patch
new file mode 100644
index 0000000..d9142a9
--- /dev/null
+++ b/package/irrlicht/0002-remove-sys-sysctl.h.patch
@@ -0,0 +1,38 @@ 
+From 5382142d37730f6758753b758c91e257ffd5892c Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 9 Apr 2017 22:20:19 +0200
+Subject: [PATCH] remove sys/sysctl.h
+
+With musl irrlicht doesn't build due to missing sys/sysctl.h
+
+fatal error: sys/sysctl.h: No such file or directory
+
+From [1]
+"sysctl does not work, and NEVER worked. using it is bogus.
+it was a bogus experimental syscall that was deprecated before
+it was ever used (basically, a broken binary version of
+/proc/sys, without any stability between kernel versions for
+what the binary constants meant)."
+
+[1] https://devsonacid.wordpress.com/tag/musl/
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ source/Irrlicht/COSOperator.cpp | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/source/Irrlicht/COSOperator.cpp b/source/Irrlicht/COSOperator.cpp
+index 0899d1d..ccf5ef5 100644
+--- a/source/Irrlicht/COSOperator.cpp
++++ b/source/Irrlicht/COSOperator.cpp
+@@ -13,7 +13,6 @@
+ #include <unistd.h>
+ #ifndef _IRR_SOLARIS_PLATFORM_
+ #include <sys/types.h>
+-#include <sys/sysctl.h>
+ #endif
+ #endif
+ 
+-- 
+2.9.3
+
diff --git a/package/irrlicht/Config.in b/package/irrlicht/Config.in
new file mode 100644
index 0000000..edd182b
--- /dev/null
+++ b/package/irrlicht/Config.in
@@ -0,0 +1,17 @@ 
+config BR2_PACKAGE_IRRLICHT
+	bool "irrlicht"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_XORG7
+	depends on BR2_PACKAGE_HAS_LIBGL # use GLX
+	select BR2_PACKAGE_XLIB_LIBXXF86VM # libXxf86vm
+	help
+	  An open source high performance realtime 3D graphics engine.
+
+	  http://irrlicht.sourceforge.net/
+
+comment "irrlicht needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
+
+comment "irrlicht needs X11 and an OpenGL provider"
+	depends on !BR2_PACKAGE_HAS_LIBGL || !BR2_PACKAGE_XORG7
+	depends on BR2_INSTALL_LIBSTDCPP
diff --git a/package/irrlicht/irrlicht.hash b/package/irrlicht/irrlicht.hash
new file mode 100644
index 0000000..489790e
--- /dev/null
+++ b/package/irrlicht/irrlicht.hash
@@ -0,0 +1,5 @@ 
+# From https://sourceforge.net/projects/irrlicht/files/Irrlicht%20SDK/1.8/1.8.4
+md5 9401cfff801395010b0912211f3cbb4f irrlicht-1.8.4.zip
+sha1 38bf0223fe868d243d6a39d0dc191c8df6e03b3b irrlicht-1.8.4.zip
+# locally calculated
+sha256 f42b280bc608e545b820206fe2a999c55f290de5c7509a02bdbeeccc1bf9e433  irrlicht-1.8.4.zip
diff --git a/package/irrlicht/irrlicht.mk b/package/irrlicht/irrlicht.mk
new file mode 100644
index 0000000..61d5ccf
--- /dev/null
+++ b/package/irrlicht/irrlicht.mk
@@ -0,0 +1,58 @@ 
+################################################################################
+#
+# irrlicht
+#
+################################################################################
+
+IRRLICHT_VERSION_MAJOR = 1.8
+IRRLICHT_VERSION = $(IRRLICHT_VERSION_MAJOR).4
+IRRLICHT_SOURCE = irrlicht-$(IRRLICHT_VERSION).zip
+IRRLICHT_SITE = https://downloads.sourceforge.net/project/irrlicht/Irrlicht%20SDK/$(IRRLICHT_VERSION_MAJOR)/$(IRRLICHT_VERSION)
+IRRLICHT_INSTALL_STAGING = YES
+
+# Bundled libraries: bzip2, libaesGladman, libpng, lzma, zlib,
+# The handcrafted Makefile can only use bundled libraries.
+IRRLICHT_LICENSE = Zlib (irrlicht), bzip2 license, jpeg-license (BSD-3-Clause-like), Libpng
+IRRLICHT_LICENSE_FILES = \
+	doc/aesGladman.txt \
+	doc/bzip2-license.txt \
+	doc/irrlicht-license.txt \
+	doc/jpglib-license.txt \
+	doc/libpng-license.txt
+
+IRRLICHT_SUBDIR = source/Irrlicht
+
+IRRLICHT_DEPENDENCIES = libgl xlib_libXxf86vm
+
+define IRRLICHT_EXTRACT_CMDS
+	$(UNZIP) -d $(@D) $(DL_DIR)/$(IRRLICHT_SOURCE)
+	mv $(@D)/irrlicht-$(IRRLICHT_VERSION)/* $(@D)
+	$(RM) -r $(@D)/irrlicht-$(IRRLICHT_VERSION)
+endef
+
+IRRLICHT_CONF_OPTS = $(TARGET_CONFIGURE_OPTS)
+
+# Build a static library OR a shared library, otherwise we need to compile with -fPIC
+# "relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC"
+ifeq ($(BR2_STATIC_LIBS),)
+IRRLICHT_CONF_OPTS += sharedlib
+endif
+
+define IRRLICHT_BUILD_CMDS
+	$(TARGET_MAKE_ENV)
+		$(MAKE) -C $(@D)/$(IRRLICHT_SUBDIR) $(IRRLICHT_CONF_OPTS)
+endef
+
+define IRRLICHT_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) \
+		INSTALL_DIR=$(STAGING_DIR)/usr/lib \
+		-C $(@D)/$(IRRLICHT_SUBDIR) install
+endef
+
+define IRRLICHT_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) \
+		INSTALL_DIR=$(TARGET_DIR)/usr/lib \
+		-C $(@D)/$(IRRLICHT_SUBDIR) install
+endef
+
+$(eval $(generic-package))