[mupen64plus-video-arachnoid] 44/147: Rewrite Makefile to fix flags and linking

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:09:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch master
in repository mupen64plus-video-arachnoid.

commit 43f59401ab3c008ddea3ffa81d9f4de2ded05e8b
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sat Jul 23 17:50:54 2011 +0200

    Rewrite Makefile to fix flags and linking
---
 debian/changelog                           |   3 +
 debian/patches/default-optimisations.patch |  55 -------
 debian/patches/rewrite_makefile.patch      | 239 +++++++++++++++++++++++++++++
 debian/patches/series                      |   2 +-
 4 files changed, 243 insertions(+), 56 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 28c0a88..620a7f0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 mupen64plus-video-arachnoid (1.99.4-3) UNRELEASED; urgency=low
 
   * Mark all targets in debian/rules as phony
+  * debian/patches:
+    - Remove obsolete default-optimisations.patch
+    - Add rewrite_makefile.patch, Rewrite Makefile to fix flags and linking
 
  -- Sven Eckelmann <sven at narfation.org>  Sat, 23 Jul 2011 16:42:55 +0200
 
diff --git a/debian/patches/default-optimisations.patch b/debian/patches/default-optimisations.patch
deleted file mode 100644
index 57850dc..0000000
--- a/debian/patches/default-optimisations.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-Description: Don't override optimisations set by build environment
-Forwarded: not-needed
-Author: Sven Eckelmann <sven at narfation.org>
-
----
-diff --git a/projects/unix/Makefile b/projects/unix/Makefile
-index 762c0318deb37dab32d8b3d3f41937803d0704a7..001a9abf50494e8ad77ee44c8a383cba15b7d0e1 100755
---- a/projects/unix/Makefile
-+++ b/projects/unix/Makefile
-@@ -79,12 +79,12 @@ ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
- endif
- 
- # base CFLAGS, LIBS, and LDFLAGS
--CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src \
-+CFLAGS += -fno-strict-aliasing -fvisibility=hidden -I../../src \
- 		 -I../../src/hash -I../../src/ucodes -I../../src/GBI -I../../src/RDP -I../../src/utils \
- 		 -I../../src/log -I../../src/RSP -I../../src/framebuffer -I../../src/math -I../../src/renderer \
- 		 -I../../src/Assembler -I../../src/texture -I../../src/config -I../../src/Combiner 
- ifneq ($(OS), FREEBSD)
--  CFLAGS += -pipe -O3
-+  CFLAGS += -pipe
- endif
- CXXFLAGS += -fvisibility-inlines-hidden
- 
-@@ -138,9 +138,9 @@ endif
- ifneq ($(OS), FREEBSD)
-   ifeq ($(CPU), X86)
-     ifeq ($(ARCH_DETECTED), 64BITS)
--      CFLAGS += -march=athlon64
-+      CFLAGS += 
-     else
--      CFLAGS += -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
-+      CFLAGS += -mmmx -msse -fomit-frame-pointer
-     endif
-     # tweak flags for 32-bit build on 64-bit system
-     ifeq ($(ARCH_DETECTED), 64BITS_32)
-@@ -153,9 +153,6 @@ else
-     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
-   endif
- endif
--ifeq ($(CPU), PPC)
--  CFLAGS += -mcpu=powerpc
--endif
- 
- # set shell function names
- # set shell function names
-@@ -171,7 +168,7 @@ endif
- 
- # set special flags for given Makefile parameters
- ifeq ($(DEBUG),1)
--  CFLAGS += -g  -fno-inline -Werror
-+  CFLAGS += -g
-   STRIP = true # disable binary strip
- endif
- 
diff --git a/debian/patches/rewrite_makefile.patch b/debian/patches/rewrite_makefile.patch
new file mode 100644
index 0000000..11a5620
--- /dev/null
+++ b/debian/patches/rewrite_makefile.patch
@@ -0,0 +1,239 @@
+Description: Rewrite Makefile to fix flags and linking
+Author: Sven Eckelmann <sven at narfation.org>
+
+---
+diff --git a/projects/unix/Makefile b/projects/unix/Makefile
+index 762c0318deb37dab32d8b3d3f41937803d0704a7..d8133a9c37b72128249f4bd3e0ee1d62d02076ec 100755
+--- a/projects/unix/Makefile
++++ b/projects/unix/Makefile
+@@ -39,7 +39,7 @@ ifneq ("$(filter GNU hurd,$(UNAME))","")
+ endif
+ ifeq ("$(UNAME)","Darwin")
+   OS = OSX
+-  LDFLAGS += -liconv -lpng
++  LDLIBS += -liconv -lpng
+   SO_EXTENSION = dylib
+   SHARED = -bundle
+ endif
+@@ -48,6 +48,12 @@ ifeq ("$(UNAME)","FreeBSD")
+   SO_EXTENSION = so
+   SHARED = -shared
+ endif
++ifeq ("$(UNAME)","OpenBSD")
++  OS = FREEBSD
++  SO_EXTENSION = so
++  SHARED = -shared
++  $(warning OS type "$(UNAME)" not officially supported.')
++endif
+ ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
+   OS = LINUX
+   SO_EXTENSION = so
+@@ -78,15 +84,14 @@ ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
+   ARCH_DETECTED := 64BITS
+ endif
+ 
+-# base CFLAGS, LIBS, and LDFLAGS
+-CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src \
++# base CFLAGS, LDLIBS, and LDFLAGS
++OPTFLAGS ?= -O3
++CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src \
+ 		 -I../../src/hash -I../../src/ucodes -I../../src/GBI -I../../src/RDP -I../../src/utils \
+ 		 -I../../src/log -I../../src/RSP -I../../src/framebuffer -I../../src/math -I../../src/renderer \
+ 		 -I../../src/Assembler -I../../src/texture -I../../src/config -I../../src/Combiner 
+-ifneq ($(OS), FREEBSD)
+-  CFLAGS += -pipe -O3
+-endif
+ CXXFLAGS += -fvisibility-inlines-hidden
++LDFLAGS += $(SHARED)
+ 
+ # On OS X, add a few extra flags to elegantly support cross-compilation and backward
+ # compatibility (and also the flags to link against OpenGL)
+@@ -101,13 +106,36 @@ ifeq ($(OS), OSX)
+     endif
+   endif
+ else
+-  # flags for other Unices
+-  LDFLAGS += -ldl -lGL -lGLU -lpthread
++  # test for essential build dependencies
++  ifeq ($(shell which pkg-config 2>/dev/null),)
++    $(error pkg-config not found)
++  endif
++  ifeq ($(shell pkg-config --modversion gl 2>/dev/null),)
++    $(error No OpenGL development libraries found!)
++  endif
++  ifeq ($(shell pkg-config --modversion glu 2>/dev/null),)
++    $(error No OpenGL utility development libraries found!)
++  endif
++
++  CFLAGS += -pthread $(shell pkg-config --cflags gl glu)
++  LDLIBS += -pthread $(shell pkg-config --libs gl glu)
++endif
++ifeq ($(OS), LINUX)
++  LDLIBS += -ldl 
++endif
++ifeq ($(OS), FREEBSD)
++  LDLIBS += -lc
+ endif
+ 
+ 
++# Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
++# On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
+ ifeq ($(ARCH_DETECTED), 64BITS)
++  PIC ?= 1
++endif
++ifeq ($(PIC), 1)
+   CFLAGS += -fPIC
++  LDFLAGS += -fPIC
+ endif
+ 
+ # set mupen64plus core API header path
+@@ -137,15 +165,10 @@ ifeq ($(OS), LINUX)
+ endif
+ ifneq ($(OS), FREEBSD)
+   ifeq ($(CPU), X86)
+-    ifeq ($(ARCH_DETECTED), 64BITS)
+-      CFLAGS += -march=athlon64
+-    else
+-      CFLAGS += -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
+-    endif
+     # tweak flags for 32-bit build on 64-bit system
+     ifeq ($(ARCH_DETECTED), 64BITS_32)
+       CFLAGS += -m32
+-      LDFLAGS += -m32 -m elf_i386
++      LDFLAGS += -m32 -Wl,-m,elf_i386
+     endif
+   endif
+ else
+@@ -153,26 +176,32 @@ else
+     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
+   endif
+ endif
+-ifeq ($(CPU), PPC)
+-  CFLAGS += -mcpu=powerpc
+-endif
+ 
+-# set shell function names
+-# set shell function names
+-CC      ?= gcc
+-CXX     ?= g++
+-INSTALL ?= install
+-ifeq ($(OS),LINUX)
+-  STRIP	= strip -s
++# reduced compile output when running make without V=1
++ifneq ($(findstring $(MAKEFLAGS),s),s)
++ifndef V
++	Q_CC  = @echo '    CC  '$@;
++	Q_CXX = @echo '    CXX '$@;
++	Q_LD  = @echo '    LD  '$@;
+ endif
+-ifeq ($(OS),OSX)
+-  STRIP	= strip -x 
+ endif
+ 
++# set base program pointers and flags
++CC       ?= gcc
++CXX      ?= g++
++RM       ?= rm -f
++INSTALL  ?= install
++MKDIR ?= mkdir -p
++COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
++COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
++LINK.o = $(Q_LD)$(CXX) $(LDFLAGS) $(TARGET_ARCH)
++
+ # set special flags for given Makefile parameters
+ ifeq ($(DEBUG),1)
+-  CFLAGS += -g  -fno-inline -Werror
+-  STRIP = true # disable binary strip
++  CFLAGS += -g
++  INSTALL_STRIP_FLAG ?= 
++else
++  INSTALL_STRIP_FLAG ?= -s
+ endif
+ 
+ # set installation options
+@@ -183,7 +212,10 @@ ifeq ($(SHAREDIR),)
+   SHAREDIR := $(PREFIX)/share/mupen64plus
+ endif
+ ifeq ($(LIBDIR),)
+-  LIBDIR := $(PREFIX)/lib/mupen64plus
++  LIBDIR := $(PREFIX)/lib
++endif
++ifeq ($(PLUGINDIR),)
++  PLUGINDIR := $(LIBDIR)/mupen64plus
+ endif
+ 
+ 
+@@ -249,7 +281,7 @@ SOURCE = \
+ # generate a list of object files build, make a temporary directory for them
+ OBJECTS := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
+ OBJDIRS = $(dir $(OBJECTS))
+-$(shell mkdir -p $(OBJDIRS))
++$(shell $(MKDIR) $(OBJDIRS))
+ 
+ # build targets
+ 
+@@ -265,9 +297,12 @@ targets:
+ 	@echo "  Options:"
+ 	@echo "    BITS=32       == build 32-bit binaries on 64-bit machine"
+ 	@echo "    APIDIR=path   == path to find Mupen64Plus Core headers"
++	@echo "    OPTFLAGS=flag == compiler optimization (default: -O3)"
++	@echo "    PIC=(1|0)     == Force enable/disable of position independent code"
+ 	@echo "  Install Options:"
+ 	@echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local)"
+-	@echo "    LIBDIR=path   == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
++	@echo "    LIBDIR=path   == library prefix (default: PREFIX/lib)"
++	@echo "    PLUGINDIR=path == path to install plugin libraries (default: LIBDIR/mupen64plus)"
+ 	@echo "    DESTDIR=path  == path to prepend to all installation paths (only for packagers)"
+ 	@echo "  Debugging Options:"
+ 	@echo "    DEBUG=1       == add debugging symbols"
+@@ -276,15 +311,15 @@ targets:
+ all: $(TARGET)
+ 
+ install: $(TARGET)
+-	$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
+-	$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
++	$(INSTALL) -d "$(DESTDIR)$(PLUGINDIR)"
++	$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(PLUGINDIR)"
+ 
+ uninstall:
+-	rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
++	$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
+ 
+ 
+ clean:
+-	rm -rf ./_obj mupen64plus-video-arachnoid.$(SO_EXTENSION)
++	$(RM) -r ./_obj mupen64plus-video-arachnoid.$(SO_EXTENSION)
+ 
+ # build dependency files
+ CFLAGS += -MD
+@@ -292,22 +327,14 @@ CFLAGS += -MD
+ 
+ CXXFLAGS += $(CFLAGS)
+ 
+-# reduced compile output when running make without V=1
+-ifneq ($(findstring $(MAKEFLAGS),s),s)
+-ifndef V
+-	Q_CC  = @echo '    CC  '$@;
+-	Q_CXX = @echo '    CXX '$@;
+-	Q_LD  = @echo '    LD  '$@;
+-endif
+-endif
+-
+-# build rules
+-$(TARGET): $(OBJECTS)
+-	$(Q_LD)$(CXX) $(SHARED) $^ $(LDFLAGS) -o $@
+-	$(STRIP) $@
+-
++# standard build rules
+ $(OBJDIR)/%.o: $(SRCDIR)/%.c
+-	$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
++	$(COMPILE.c) -o $@ $<
+ 
+ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
+-	$(Q_CXX)$(CXX) -o $@ $(CXXFLAGS) -c $<
++	$(COMPILE.cc) -o $@ $<
++
++$(TARGET): $(OBJECTS)
++	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
++
++.PHONY: all clean install uninstall targets
diff --git a/debian/patches/series b/debian/patches/series
index e164d80..c753e70 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-default-optimisations.patch
+rewrite_makefile.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-video-arachnoid.git



More information about the Pkg-games-commits mailing list