summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/openctm/files/openctm-fix-makefiles.patch')
-rw-r--r--media-libs/openctm/files/openctm-fix-makefiles.patch191
1 files changed, 191 insertions, 0 deletions
diff --git a/media-libs/openctm/files/openctm-fix-makefiles.patch b/media-libs/openctm/files/openctm-fix-makefiles.patch
new file mode 100644
index 000000000000..540b3cfa84fc
--- /dev/null
+++ b/media-libs/openctm/files/openctm-fix-makefiles.patch
@@ -0,0 +1,191 @@
+ Makefile.linux | 18 ++++++++-------
+ lib/Makefile.linux | 23 ++++++++++++-------
+ tools/Makefile.linux | 64 ++++++++++++++++++++--------------------------------
+ 3 files changed, 50 insertions(+), 55 deletions(-)
+
+diff --git a/Makefile.linux b/Makefile.linux
+index 24ca137..51fc88c 100644
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -47,19 +47,21 @@ documentation:
+
+
+ # Installation settings
+-LIBDIR = /usr/lib/
+-INCDIR = /usr/local/include/
+-BINDIR = /usr/local/bin/
+-MAN1DIR = /usr/local/share/man/man1/
+-CP = cp
++LIBDIR = $(DESTDIR)/usr/@GENTOO_LIBDIR@/$(DEB_HOST_MULTIARCH)
++INCDIR = $(DESTDIR)/usr/include/
++BINDIR = $(DESTDIR)/usr/bin/
++MAN1DIR = $(DESTDIR)/usr/share/man/man1/
++CP = cp -P
+ MKDIR = mkdir -p
+
+-install:
+- $(CP) lib/libopenctm.so $(LIBDIR)
++$(LIBDIR) $(INCDIR) $(BINDIR) $(MAN1DIR):
++ mkdir -p "$@"
++
++install: $(LIBDIR) $(INCDIR) $(BINDIR) $(MAN1DIR)
++ $(CP) lib/libopenctm.so* $(LIBDIR)
+ $(CP) lib/openctm.h $(INCDIR)
+ $(CP) lib/openctmpp.h $(INCDIR)
+ $(CP) tools/ctmconv $(BINDIR)
+ $(CP) tools/ctmviewer $(BINDIR)
+- $(MKDIR) $(MAN1DIR)
+ $(CP) doc/ctmconv.1 $(MAN1DIR)
+ $(CP) doc/ctmviewer.1 $(MAN1DIR)
+diff --git a/lib/Makefile.linux b/lib/Makefile.linux
+index 7643127..1e622ec 100644
+--- a/lib/Makefile.linux
++++ b/lib/Makefile.linux
+@@ -27,13 +27,18 @@
+ ###############################################################################
+
+ LZMADIR = liblzma
+-CC = gcc
+-CFLAGS = -O3 -W -Wall -c -fPIC -DOPENCTM_BUILD -I$(LZMADIR) -DLZMA_PREFIX_CTM -std=c99 -pedantic
+-CFLAGS_LZMA = -O3 -W -Wall -c -fPIC -DLZMA_PREFIX_CTM -std=c99 -pedantic
++CC ?= gcc
++CFLAGS += -W -Wall -c -fPIC -std=c99 -pedantic
++INCDEF = -DOPENCTM_BUILD -I$(LZMADIR) -DLZMA_PREFIX_CTM
++INCDEF_LZMA = -DLZMA_PREFIX_CTM
+ RM = rm -f
+ DEPEND = $(CPP) -MM
+
+-DYNAMICLIB = libopenctm.so
++VERSION = 1.0.3
++SOVERSION = 1
++LIBNAME = libopenctm.so
++SONAME = $(LIBNAME).$(SOVERSION)
++DYNAMICLIB = $(LIBNAME).$(VERSION)
+
+ OBJS = openctm.o \
+ stream.o \
+@@ -64,16 +69,18 @@ LZMA_SRCS = $(LZMADIR)/Alloc.c \
+ all: $(DYNAMICLIB)
+
+ clean:
+- $(RM) $(DYNAMICLIB) $(OBJS) $(LZMA_OBJS)
++ $(RM) $(DYNAMICLIB) $(SONAME) $(LIBNAME) $(OBJS) $(LZMA_OBJS)
+
+ $(DYNAMICLIB): $(OBJS) $(LZMA_OBJS)
+- gcc -shared -s -Wl,-soname,$@ -o $@ $(OBJS) $(LZMA_OBJS) -lm
++ $(CC) $(LDFLAGS) -shared -s -Wl,-soname,$(SONAME) -o $@ $(OBJS) $(LZMA_OBJS) -lm
++ ln -s $(DYNAMICLIB) $(SONAME)
++ ln -s $(DYNAMICLIB) $(LIBNAME)
+
+ %.o: %.c
+- $(CC) $(CFLAGS) $<
++ $(CC) $(CPPFLAGS) $(CFLAGS) $(INCDEF) $<
+
+ %.o: $(LZMADIR)/%.c
+- $(CC) $(CFLAGS_LZMA) $<
++ $(CC) $(CPPFLAGS) $(CFLAGS) $(INCDEF_LZMA) $<
+
+ depend:
+ $(DEPEND) $(SRCS) $(LZMA_SRCS) > make.depend
+diff --git a/tools/Makefile.linux b/tools/Makefile.linux
+index fa3e6e5..46276d1 100644
+--- a/tools/Makefile.linux
++++ b/tools/Makefile.linux
+@@ -26,49 +26,50 @@
+ ###############################################################################
+
+ OPENCTMDIR = ../lib
+-GLEWDIR = glew
+-JPEGDIR = jpeg
++# Use system libs if possible
++#GLEWDIR = glew
++GLEWDIR = /usr/include/GL
++#JPEGDIR = jpeg
+ RPLYDIR = rply
+-TINYXMLDIR = tinyxml
+-ZLIBDIR = zlib
+-PNGLITEDIR = pnglite
++# rply in libvxl1-dev is version 1.1, we need v. 1.01
++#RPLYDIR = /usr/include/vxl/rply
++#TINYXMLDIR = tinyxml
++#ZLIBDIR = zlib
++#PNGLITEDIR = pnglite
+
+-CPP = g++
+-CPPFLAGS = -c -O3 -W -Wall `pkg-config --cflags gtk+-2.0` -I$(OPENCTMDIR) -I$(RPLYDIR) -I$(JPEGDIR) -I$(TINYXMLDIR) -I$(GLEWDIR) -I$(ZLIBDIR) -I$(PNGLITEDIR)
++CXX ?= g++
++CC ?= gcc
++CXXFLAGS += -W -Wall `pkg-config --cflags gtk+-2.0` -I$(OPENCTMDIR) -I$(RPLYDIR) -I$(GLEWDIR)
+
+ MESHOBJS = mesh.o meshio.o ctm.o ply.o rply.o stl.o 3ds.o dae.o obj.o lwo.o off.o wrl.o
+ CTMCONVOBJS = ctmconv.o common.o systimer.o convoptions.o $(MESHOBJS)
+-CTMVIEWEROBJS = ctmviewer.o common.o image.o systimer.o sysdialog_gtk.o convoptions.o glew.o pnglite.o $(MESHOBJS)
++CTMVIEWEROBJS = ctmviewer.o common.o image.o systimer.o sysdialog_gtk.o convoptions.o $(MESHOBJS)
+ CTMBENCHOBJS = ctmbench.o systimer.o
+
+ all: ctmconv ctmviewer ctmbench
+
+ clean:
+ rm -f ctmconv ctmviewer ctmbench $(CTMCONVOBJS) $(CTMVIEWEROBJS) $(CTMBENCHOBJS) bin2c phong_frag.h phong_vert.h
+- cd $(JPEGDIR) && $(MAKE) -f makefile.linux clean
+- cd $(TINYXMLDIR) && $(MAKE) -f Makefile.linux clean
+- cd $(ZLIBDIR) && $(MAKE) -f Makefile.linux clean
+
+-libopenctm.so: $(OPENCTMDIR)/libopenctm.so
+- cp $< $@
++ctmconv: $(CTMCONVOBJS)
++ $(CXX) $(LDFLAGS) -s -o $@ -L$(OPENCTMDIR) $(CTMCONVOBJS) -lopenctm -ltinyxml
+
+-ctmconv: $(CTMCONVOBJS) $(TINYXMLDIR)/libtinyxml.a libopenctm.so
+- $(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) $(CTMCONVOBJS) -Wl,-rpath,. -lopenctm -ltinyxml
++ctmviewer: $(CTMVIEWEROBJS)
++ $(CXX) $(LDFLAGS) -s -o $@ -L$(OPENCTMDIR) $(CTMVIEWEROBJS) -lopenctm \
++ -ltinyxml -ljpeg -lpnglite -lz -lGL -lglut -lGLU -lGLEW \
++ -lgtk-x11-2.0 -lgobject-2.0 -lglib-2.0
+
+-ctmviewer: $(CTMVIEWEROBJS) $(JPEGDIR)/libjpeg.a $(TINYXMLDIR)/libtinyxml.a $(ZLIBDIR)/libz.a libopenctm.so
+- $(CPP) -s -o $@ -L$(OPENCTMDIR) -L$(TINYXMLDIR) -L$(JPEGDIR) -L$(ZLIBDIR) $(CTMVIEWEROBJS) -Wl,-rpath,. -lopenctm -ltinyxml -ljpeg -lz -lglut `pkg-config --libs gtk+-2.0`
+-
+-ctmbench: $(CTMBENCHOBJS) libopenctm.so
+- $(CPP) -s -o $@ -L$(OPENCTMDIR) $(CTMBENCHOBJS) -Wl,-rpath,. -lopenctm
++ctmbench: $(CTMBENCHOBJS)
++ $(CXX) $(LDFLAGS) -s -o $@ -L$(OPENCTMDIR) $(CTMBENCHOBJS) -lopenctm
+
+ %.o: %.cpp
+- $(CPP) $(CPPFLAGS) -o $@ $<
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
+
+ ctmconv.o: ctmconv.cpp systimer.h convoptions.h mesh.h meshio.h
+ ctmviewer.o: ctmviewer.cpp common.h image.h systimer.h sysdialog.h mesh.h meshio.h phong_vert.h phong_frag.h icons/icon_open.h icons/icon_save.h icons/icon_help.h
+ ctmbench.o: ctmbench.cpp systimer.h
+ common.o: common.cpp common.h
+-image.o: image.cpp image.h common.h $(JPEGDIR)/libjpeg.a
++image.o: image.cpp image.h common.h
+ systimer.o: systimer.cpp systimer.h
+ sysdialog_gtk.o: sysdialog_gtk.cpp sysdialog.h
+ convoptions.o: convoptions.cpp convoptions.h
+@@ -91,22 +92,7 @@ phong_frag.h: phong.frag bin2c
+ ./bin2c phong.frag phongFragSrc > $@
+
+ bin2c: bin2c.cpp
+- $(CPP) -Os -W -Wall -o $@ $<
+-
+-$(JPEGDIR)/libjpeg.a:
+- cd $(JPEGDIR) && $(MAKE) -f makefile.linux libjpeg.a
+-
+-$(ZLIBDIR)/libz.a:
+- cd $(ZLIBDIR) && $(MAKE) -f Makefile.linux
+-
+-glew.o: $(GLEWDIR)/glew.c
+- gcc -c -Os -W -I$(GLEWDIR) -o $@ $<
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -Os -W -Wall -o $@ $<
+
+ rply.o: $(RPLYDIR)/rply.c
+- gcc -c -O2 -W -I$(RPLYDIR) -o $@ $<
+-
+-pnglite.o: $(PNGLITEDIR)/pnglite.c
+- gcc -c -O2 -W -I$(PNGLITEDIR) -o $@ $<
+-
+-$(TINYXMLDIR)/libtinyxml.a:
+- cd $(TINYXMLDIR) && $(MAKE) -f Makefile.linux
++ $(CC) $(CPPFLAGS) $(CFLAGS) -c -O2 -W -I$(RPLYDIR) -o $@ $<