Skip to contentSkip to conversation

package/libsoil: new package

PATCH Superseded Bernd Kuhls 2 participants 2 messages Oct 30, 2015 – Nov 2, 2015

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/libsoil: new package

Needed for these new Kodi addons:

kodi-screensaver-asterwave
kodi-screensaver-cpblobs
kodi-screensaver-matrixtrails
kodi-screensaver-planestate
kodi-visualisation-fountain

---
v3: added various changes after a review by Peter
- in comment for v2: s/tarball/zipfile/
- moved -fPIC from 0001-fix-makefile.patch to LIBSOIL_CFLAGS
Because this library will be used in at least five packages I decided against using the other upstream makefile providing a static-only library.

v2: added various changes after a review by Thomas
- not available as static library
- used author's upstream tarball instead from Debian
- added a Makefile fix to simplify the usage of variable CC

 package/Config.in                       |  1 +
 package/libsoil/0001-fix-makefile.patch | 35 +++++++++++++++++++++++++++
 package/libsoil/Config.in               | 12 +++++++++
 package/libsoil/libsoil.hash            |  2 ++
 package/libsoil/libsoil.mk              | 43 +++++++++++++++++++++++++++++++++
 5 files changed, 93 insertions(+)
 create mode 100644 package/libsoil/0001-fix-makefile.patch
 create mode 100644 package/libsoil/Config.in
 create mode 100644 package/libsoil/libsoil.hash
 create mode 100644 package/libsoil/libsoil.mk
package/Config.in +1 -0
index 10ff94e..780eb12 100644
@@ -833,6 +833,7 @@ menu "Graphics"
 	source "package/libqrencode/Config.in"
 	source "package/libraw/Config.in"
 	source "package/librsvg/Config.in"
+	source "package/libsoil/Config.in"
 	source "package/libsvg/Config.in"
 	source "package/libsvg-cairo/Config.in"
 	source "package/libsvgtiny/Config.in"
package/libsoil/0001-fix-makefile.patch new file +35 -0
new file mode 100644
index 0000000..43e81f2
@@ -0,0 +1,35 @@
+Various makefile fixes to allow cross compilation
+
+Partly ported from
+http://anonscm.debian.org/cgit/pkg-games/libsoil.git/tree/debian/patches/linking_correctly.patch
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+
+diff -uNr "b/Simple OpenGL Image Library/projects/makefile/alternate Makefile.txt" "a/Simple OpenGL Image Library/projects/makefile/alternate Makefile.txt"
+--- "b/Simple OpenGL Image Library/projects/makefile/alternate Makefile.txt"	2008-07-07 18:13:28.000000000 +0200
++++ "a/Simple OpenGL Image Library/projects/makefile/alternate Makefile.txt"	2015-10-05 20:35:59.264517571 +0200
+@@ -1,8 +1,8 @@
+ MAKE = make
+-CC = gcc
+-INSTALL_FILE = install -p -o root -g root -m 644
+-INSTALL_DIR = install -p -o root -g root -d
+-LN = ln -s
++CC = $(GCC)
++INSTALL_FILE = $(INSTALL) -m 644
++INSTALL_DIR = $(INSTALL) -d
++LN = ln -sf
+ RM = rm -fv
+ CFLAGS += -c -O2 -Wall
+ LDFLAGS +=
+@@ -27,9 +27,9 @@
+ 
+ lib: $(OFILES)
+ 	# create static library
+-	ar -cvq $(LIBNAME).a $(OFILES)
++	$(AR) -cvq $(LIBNAME).a $(OFILES)
+ 	# create shared library
+-	gcc -shared -Wl,-soname,$(LIBNAME).so.$(MAJOR) -o $(LIBNAME).so.$(VERSION) $(OFILES)
++	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(MAJOR) -o $(LIBNAME).so.$(VERSION) $(OFILES) -lGL -lm
+ 
+ install:
+ 	$(INSTALL_DIR) $(DESTDIR)/$(INCLUDEDIR)
package/libsoil/Config.in new file +12 -0
new file mode 100644
index 0000000..aea0cc3
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_LIBSOIL
+	bool "libsoil"
+	depends on BR2_PACKAGE_HAS_LIBGL
+	depends on !BR2_STATIC_LIBS
+	help
+	  SOIL is a tiny C library used primarily for uploading
+	  textures into OpenGL.
+
+	  http://www.lonesock.net/soil.html
+
+comment "libsoil needs an OpenGL backend and a toolchain w/ dynamic library"
+	depends on !BR2_PACKAGE_HAS_LIBGL || BR2_STATIC_LIBS
package/libsoil/libsoil.hash new file +2 -0
new file mode 100644
index 0000000..175569b
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256	a2305b8d64f6d636e36d669bbdb0ca5445d1345c754b3d61d3f037dad2e5f701	soil.zip
package/libsoil/libsoil.mk new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.6.1
#1 lore raw

PATCH v3 1/1 package/libsoil: new package

Dear Bernd Kuhls,

Quoted 4 lines · Bernd Kuhls

- moved -fPIC from 0001-fix-makefile.patch to LIBSOIL_CFLAGS
Because this library will be used in at least five packages I decided against using the other upstream makefile providing a static-only library.

I don't see the relation between this, and not patching the makefile that you are already patching.

Quoted 6 lines
package/libsoil/libsoil.mk new file +0 -0
new file mode 100644
index 0000000..0ed8723

package/libsoil/libsoil.mk line 8

Quoted 8 lines
package/libsoil/libsoil.mk new file +8 -0
@@ -0,0 +1,43 @@
+################################################################################
+#
+# libsoil
+#
+################################################################################
+
+LIBSOIL_VERSION = 20080707
+LIBSOIL_SOURCE = soil.zip

Argh, a non-versioned file name. But oh well, our hash checking mechanism will verify this, and delete the file if it no longer matches with the hash.

package/libsoil/libsoil.mk line 15

Quoted 7 lines
package/libsoil/libsoil.mk new file +7 -0
+LIBSOIL_SITE = http://www.lonesock.net/files
+LIBSOIL_INSTALL_STAGING = YES
+LIBSOIL_DEPENDENCIES = libgl
+LIBSOIL_LICENSE = Public Domain, MIT
+LIBSOIL_LICENSE_FILES = src/stb_image_aug.c src/image_helper.c
+
+LIBSOIL_CFLAGS = "$(TARGET_CFLAGS) -c -fPIC"

Why would we need the -c here? It generally shouldn't be part of CFLAGS. What about patching the Makefile %.o: %.c rule instead ?

package/libsoil/libsoil.mk line 18

Quoted 2 lines
package/libsoil/libsoil.mk new file +2 -0
+define LIBSOIL_EXTRACT_CMDS
+	$(UNZIP) -d $(@D) $(DL_DIR)/$(LIBSOIL_SOURCE)

Please move all the code from the "Simple OpenGL Image Library" subdir into $(@D) directory, and remove the "Simple OpenGL Image Library" subdir. This way you don't have to repeat $(@D)/Simple\ OpenGL\ Image\
Library everywhere.

package/libsoil/libsoil.mk line 23

Quoted 5 lines
package/libsoil/libsoil.mk new file +5 -0
+endef
+
+define LIBSOIL_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) CFLAGS=$(LIBSOIL_CFLAGS) \
+		-f ../projects/makefile/alternate\ Makefile.txt \

Can you put ../projects/makefile/alternate\ Makefile.txt in some variable called LIBSOIL_MAKEFILE for example ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com