[mupen64plus-audio-sdl] 54/163: Rewrite Makefile to fix flags and linking

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:53:11 UTC 2015


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

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-audio-sdl.

commit 5e2f15647ea8499b9d27bc6138c067a4bf29d6c6
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sat Jul 23 17:41:02 2011 +0200

    Rewrite Makefile to fix flags and linking
---
 debian/changelog                           |   3 +
 debian/patches/default-optimisations.patch |  39 -----
 debian/patches/hurd_os.patch               |  20 ---
 debian/patches/rewrite_makefile.patch      | 244 +++++++++++++++++++++++++++++
 debian/patches/series                      |   3 +-
 5 files changed, 248 insertions(+), 61 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 865162c..a31e7fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 mupen64plus-audio-sdl (1.99.4-3) UNRELEASED; urgency=low
 
   * Mark all targets in debian/rules as phony
+  * debian/patches:
+    - Add rewrite_makefile.patch, Rewrite Makefile to fix flags and linking
+    - Remove obsolete default-optimisations.patch, hurd_os.patch
 
  -- Sven Eckelmann <sven at narfation.org>  Sat, 23 Jul 2011 16:42:37 +0200
 
diff --git a/debian/patches/default-optimisations.patch b/debian/patches/default-optimisations.patch
deleted file mode 100644
index a237a65..0000000
--- a/debian/patches/default-optimisations.patch
+++ /dev/null
@@ -1,39 +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 7e24a25f67142a7d888aead9c2d5f7fdd3d1a987..6ca972fbbcdf6b92dbfc1ff1778bf27206bb962b 100644
---- a/projects/unix/Makefile
-+++ b/projects/unix/Makefile
-@@ -88,7 +88,7 @@ ifeq ("$(CPU)","NONE")
- 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
- 
- # 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
-@@ -108,10 +108,10 @@ endif
- ifeq ($(OS), LINUX)
-   ifeq ($(CPU), X86)
-     ifeq ($(ARCH_DETECTED), 64BITS)
--      CFLAGS += -pipe -O3 -march=athlon64
-+      CFLAGS += -pipe
-       LDFLAGS += -ldl
-     else
--      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
-+      CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer
-       LDFLAGS += -ldl
-     endif
-   endif
-@@ -128,7 +128,6 @@ ifeq ($(OS), OSX)
-   endif
- endif
- ifeq ($(CPU), PPC)
--  CFLAGS += -mcpu=powerpc
-   LDFLAGS += -ldl
- endif
- 
diff --git a/debian/patches/hurd_os.patch b/debian/patches/hurd_os.patch
deleted file mode 100644
index 9909f47..0000000
--- a/debian/patches/hurd_os.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Description: Add GNU/Hurd as operating system with "linux" userland
-Author: Sven Eckelmann <sven at narfation.org>
-
----
-diff --git a/projects/unix/Makefile b/projects/unix/Makefile
-index 6ca972fbbcdf6b92dbfc1ff1778bf27206bb962b..ad2432e1fc613649f3ca9069f5811b62d7ea117e 100644
---- a/projects/unix/Makefile
-+++ b/projects/unix/Makefile
-@@ -39,6 +39,11 @@ ifneq ("$(filter GNU hurd,$(UNAME))","")
-   SHARED = -shared
-   SO_EXTENSION = so
- endif
-+ifneq ("$(filter GNU hurd,$(UNAME))","")
-+  OS = LINUX
-+  SHARED = -shared
-+  SO_EXTENSION = so
-+endif
- ifeq ("$(UNAME)","Darwin")
-   OS = OSX
-   SHARED = -bundle
diff --git a/debian/patches/rewrite_makefile.patch b/debian/patches/rewrite_makefile.patch
new file mode 100644
index 0000000..2803342
--- /dev/null
+++ b/debian/patches/rewrite_makefile.patch
@@ -0,0 +1,244 @@
+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 7e24a25f67142a7d888aead9c2d5f7fdd3d1a987..fad1f25b0caf9ac7ba8ac2e21c8bad0e87191b98 100644
+--- a/projects/unix/Makefile
++++ b/projects/unix/Makefile
+@@ -49,6 +49,12 @@ ifeq ("$(UNAME)","FreeBSD")
+   SHARED = -shared
+   SO_EXTENSION = so
+ endif
++ifeq ("$(UNAME)","OpenBSD")
++  OS = FREEBSD
++  SHARED = -shared
++  SO_EXTENSION = so
++  $(warning OS type "$(UNAME)" not officially supported.')
++endif
+ ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
+   OS = LINUX
+   SHARED = -shared
+@@ -87,50 +93,47 @@ ifeq ("$(CPU)","NONE")
+   $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+ 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
++LDFLAGS += $(SHARED)
+ 
+ # 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)
+-  CFLAGS += -fpic -DPIC
++  PIC ?= 1
+ endif
++ifeq ($(PIC), 1)
++  CFLAGS += -fPIC
++  LDFLAGS += -fPIC
++endif
++
+ # tweak flags for 32-bit build on 64-bit system
+ ifeq ($(ARCH_DETECTED), 64BITS_32)
+   ifeq ($(OS), FREEBSD)
+     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
+   endif
+   CFLAGS += -m32
+-  LDFLAGS += -m32 -m elf_i386
++  LDFLAGS += -m32 -Wl,-m,elf_i386
+ endif
+ 
+ # set special flags per-system
+ ifeq ($(OS), LINUX)
+-  ifeq ($(CPU), X86)
+-    ifeq ($(ARCH_DETECTED), 64BITS)
+-      CFLAGS += -pipe -O3 -march=athlon64
+-      LDFLAGS += -ldl
+-    else
+-      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
+-      LDFLAGS += -ldl
+-    endif
+-  endif
++  LDLIBS += -ldl
+ endif
+ ifeq ($(OS), OSX)
+   ifeq ($(CPU), X86)
+     ifeq ($(ARCH_DETECTED), 64BITS)
+       CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+-      LDFLAGS += -arch x86_64 -ldl
++      LDFLAGS += -arch x86_64
++      LDLIBS += -ldl
+     else
+       CFLAGS += -pipe -O3 -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+-      LDFLAGS += -arch i686 -ldl
++      LDFLAGS += -arch i686
++      LDLIBS += -ldl
+     endif
+   endif
+ endif
+-ifeq ($(CPU), PPC)
+-  CFLAGS += -mcpu=powerpc
+-  LDFLAGS += -ldl
+-endif
+ 
+ # test for presence of SDL
+ ifeq ($(shell which sdl-config 2>/dev/null),)
+@@ -138,17 +141,17 @@ ifeq ($(shell which sdl-config 2>/dev/null),)
+ endif
+ ifeq ($(OS),FREEBSD)
+     CFLAGS  += $(shell sdl-config --cflags)
+-    LDFLAGS += $(shell sdl-config --libs)
++    LDLIBS += $(shell sdl-config --libs)
+ endif
+ ifeq ($(OS),OSX)
+     CFLAGS  += $(shell sdl-config --cflags)
+     # sdl-config on mac screws up when we're trying to build a library and not an executable
+     # SDL 1.3 is supposed to fix that, if it's ever released
+-    LDFLAGS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
++    LDLIBS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
+ endif
+ ifeq ($(OS),LINUX)
+     CFLAGS  += $(shell sdl-config --cflags)
+-    LDFLAGS += $(shell sdl-config --libs)
++    LDLIBS += $(shell sdl-config --libs)
+ endif
+ 
+ # test for presence of libsamplerate
+@@ -156,7 +159,7 @@ ifneq ($(strip $(shell pkg-config samplerate --modversion 2> /dev/null)),)
+   ifneq ($(NO_RESAMP), 1)
+     # set libsamplerate flags and libraries
+     CFLAGS	+= $(shell pkg-config samplerate --cflags) -DUSE_SRC
+-    LDFLAGS += $(shell pkg-config samplerate --libs)
++    LDLIBS += $(shell pkg-config samplerate --libs)
+   endif
+ else
+   # warn user
+@@ -185,25 +188,28 @@ else
+   endif
+ endif
+ 
+-# set shell function names
+-CC      ?= gcc
+-CXX     ?= g++
+-LD      ?= 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_LD = @echo '    LD  '$@;
+ endif
+-ifeq ($(OS),OSX)
+-  STRIP	?= strip -x 
+-endif
+-ifeq ($(OS),FREEBSD)
+-  STRIP	+= strip -s
+ endif
+ 
++# set base program pointers and flags
++CC       ?= gcc
++RM       ?= rm -f
++INSTALL  ?= install
++MKDIR ?= mkdir -p
++COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
++LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
++
+ # set special flags for given Makefile parameters
+ ifeq ($(DEBUG),1)
+   CFLAGS += -g
+-  STRIP = true # disable binary strip
++  INSTALL_STRIP_FLAG ?= 
++else
++  INSTALL_STRIP_FLAG ?= -s
+ endif
+ 
+ # set installation options
+@@ -211,7 +217,10 @@ ifeq ($(PREFIX),)
+   PREFIX := /usr/local
+ endif
+ ifeq ($(LIBDIR),)
+-  LIBDIR := $(PREFIX)/lib/mupen64plus
++  LIBDIR := $(PREFIX)/lib
++endif
++ifeq ($(PLUGINDIR),)
++  PLUGINDIR := $(LIBDIR)/mupen64plus
+ endif
+ 
+ SRCDIR = ../../src
+@@ -226,20 +235,12 @@ SOURCE = \
+ # generate a list of object files build, make a temporary directory for them
+ OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
+ OBJDIRS = $(dir $(OBJECTS))
+-$(shell mkdir -p $(OBJDIRS))
++$(shell $(MKDIR) $(OBJDIRS))
+ 
+ # build dependency files
+ CFLAGS += -MD
+ -include $(OBJECTS:.o=.d)
+ 
+-# reduced compile output when running make without V=1
+-ifneq ($(findstring $(MAKEFLAGS),s),s)
+-ifndef V
+-    Q_CC = @echo '    CC  '$@;
+-    Q_LD = @echo '    LD  '$@;
+-endif
+-endif
+-
+ # build targets
+ TARGET = mupen64plus-audio-sdl.$(SO_EXTENSION)
+ 
+@@ -254,35 +255,37 @@ 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"
++	@echo "    V=1           == show verbose compiler output"
+ 
+ 
+ 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/* $(TARGET)
+-	rmdir ./_obj
++	$(RM) -r ./_obj $(TARGET)
+ 
+ rebuild: clean all
+ 
+-# build rules
+-$(TARGET): $(OBJECTS)
+-	$(Q_LD)$(CC) $(SHARED) $^ $(LDFLAGS) -o $@
+-	$(STRIP) $@
+-
++# standard build rules
+ $(OBJDIR)/%.o: $(SRCDIR)/%.c
+-	$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
++	$(COMPILE.c) -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 16e335d..c753e70 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1 @@
-default-optimisations.patch
-hurd_os.patch
+rewrite_makefile.patch

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



More information about the Pkg-games-commits mailing list