OrangePi_CM5/external/packages/extras-buildpkgs/libmali-sunxi-r3p0.old/debian/patches/fix-makefiles.patch

198 lines
4.7 KiB
Diff

diff --git a/.gitignore b/.gitignore
index 6865abf..2f0cfe4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
config.mk
*~
+*.pc
+!Makefile.pc
diff --git a/Makefile b/Makefile
index 60d4a0f..83b40bb 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@
all: config.mk
$(MAKE) -C include
$(MAKE) -C lib
+ $(MAKE) -f Makefile.pc
config:
rm -f config.mk
@@ -12,15 +13,21 @@ config.mk:
$(MAKE) -f Makefile.config
clean:
+ touch config.mk
$(MAKE) -C version clean
$(MAKE) -C test clean
$(MAKE) -C lib clean
- $(MAKE) -C include clean
+ $(MAKE) -f Makefile.pc clean
rm -f config.mk
install: config.mk
$(MAKE) -C lib install
$(MAKE) -C include install
+ $(MAKE) -C test install
+ $(MAKE) -f Makefile.pc install
-test: config.mk
+prepare: config.mk
+ $(MAKE) -C lib prepare
+
+test: config.mk prepare
$(MAKE) -C test test
diff --git a/Makefile.pc b/Makefile.pc
new file mode 100644
index 0000000..333347a
--- /dev/null
+++ b/Makefile.pc
@@ -0,0 +1,24 @@
+include Makefile.setup
+include config.mk
+
+all:
+ echo "prefix=$(prefix)" > egl.pc
+ echo "libdir=$(prefix)lib/$(libsubdir)/$(private_dir)" >> egl.pc
+ cat egl.pc.in >> egl.pc
+ sed -i "s/MVERSION/${MALI_VERSION}/g" egl.pc
+ echo "prefix=$(prefix)" > gles_cm.pc
+ echo "libdir=$(prefix)lib/$(libsubdir)/$(private_dir)" >> gles_cm.pc
+ cat gles_cm.pc.in >> gles_cm.pc
+ sed -i "s/MVERSION/${MALI_VERSION}/g" gles_cm.pc
+ echo "prefix=$(prefix)" > glesv2.pc
+ echo "libdir=$(prefix)lib/$(libsubdir)/$(private_dir)" >> glesv2.pc
+ cat glesv2.pc.in >> glesv2.pc
+ sed -i "s/MVERSION/${MALI_VERSION}/g" glesv2.pc
+
+install: egl.pc gles_cm.pc glesv2.pc
+ $(MKDIR) $(pkgconfigdir)/pkgconfig
+ $(INSTALL_DATA) $^ $(pkgconfigdir)/pkgconfig
+
+clean:
+ $(RM) egl.pc gles_cm.pc glesv2.pc
+
diff --git a/Makefile.setup b/Makefile.setup
index 9b1ef0d..31da0d2 100644
--- a/Makefile.setup
+++ b/Makefile.setup
@@ -1,6 +1,9 @@
DESTDIR ?= /
prefix ?= /usr/
-libdir ?= $(DESTDIR)$(prefix)lib/
+libsubdir ?=
+private_dir ?=
+libdir ?= $(DESTDIR)$(prefix)lib/$(libsubdir)/$(private_dir)/
+pkgconfigdir ?= $(DESTDIR)$(prefix)lib/$(libsubdir)/
includedir ?= $(DESTDIR)$(prefix)/include
INSTALL ?= install
diff --git a/egl.pc.in b/egl.pc.in
new file mode 100644
index 0000000..e5917b0
--- /dev/null
+++ b/egl.pc.in
@@ -0,0 +1,10 @@
+exec_prefix=${prefix}
+includedir=${prefix}/include
+
+Name: egl
+Description: Mali EGL library
+Requires.private:
+Version: MVERSION
+Libs: -L${libdir} -lEGL
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/gles_cm.pc.in b/gles_cm.pc.in
new file mode 100644
index 0000000..86f30fb
--- /dev/null
+++ b/gles_cm.pc.in
@@ -0,0 +1,10 @@
+exec_prefix=${prefix}
+includedir=${prefix}/include
+
+Name: gles_cm
+Description: Mali OpenGL ES 1.1 CM library
+Requires.private:
+Version: MVERSION
+Libs: -L${libdir} -lGLES_CM
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/glesv2.pc.in b/glesv2.pc.in
new file mode 100644
index 0000000..21cc87b
--- /dev/null
+++ b/glesv2.pc.in
@@ -0,0 +1,10 @@
+exec_prefix=${prefix}
+includedir=${prefix}/include
+
+Name: glesv2
+Description: Mali OpenGL ES 2.0 library
+Requires.private:
+Version: MVERSION
+Libs: -L${libdir} -lGLESv2
+Libs.private: -lm -lpthread -ldl
+Cflags: -I${includedir}
diff --git a/include/GLES/gl.h b/include/GLES/gl.h
index 858f394..a6bb591 100644
--- a/include/GLES/gl.h
+++ b/include/GLES/gl.h
@@ -29,6 +29,7 @@ typedef float GLfloat;
typedef float GLclampf;
typedef signed int GLfixed;
typedef signed int GLclampx;
+typedef char GLchar;
typedef int * GLintptr;
typedef int * GLsizeiptr;
diff --git a/include/GLES2/gl2.h b/include/GLES2/gl2.h
index 59e376c..90d96bb 100644
--- a/include/GLES2/gl2.h
+++ b/include/GLES2/gl2.h
@@ -32,6 +32,7 @@ typedef unsigned int GLuint;
typedef khronos_float_t GLfloat;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
+typedef char GLchar;
/* GL types for handling large vertex buffer objects */
typedef khronos_intptr_t GLintptr;
diff --git a/lib/Makefile b/lib/Makefile
index 574bc2c..1df2e2e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,6 +2,9 @@ all:
clean:
+prepare:
+ $(MAKE) -C mali prepare
+
install:
$(MAKE) -C mali install
diff --git a/test/Makefile b/test/Makefile
index 700416e..1fce02f 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,11 +1,15 @@
include ../Makefile.setup
+include ../config.mk
CFLAGS ?= -Wall
all: test
test: ../config.mk test.c
- $(CC) $(CFLAGS) -o $@ test.c -lEGL -lGLESv2
+ $(CC) $(CFLAGS) -o $@ test.c -I../include/ -L../lib/mali/$(MALI_VERSION)/$(MALI_LIBS_ABI)/$(MALI_EGL_TYPE)/ -lEGL -lGLESv2 -lX11
+
+install:
+ $(INSTALL) -m 755 test $(DESTDIR)$(prefix)/bin/mali-triangle
clean:
rm -f test