[mupen64plus-core] 81/310: Rewrite Makefile to fix flags and linking

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:57:21 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-core.

commit d96405fab056a0ecdde20f0ff1023175cfaf5690
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sat Jul 23 17:45:14 2011 +0200

    Rewrite Makefile to fix flags and linking
---
 debian/changelog                           |   4 +
 debian/patches/default-optimisations.patch |  50 -----
 debian/patches/dejavu-font.patch           |  14 +-
 debian/patches/rewrite_makefile.patch      | 290 +++++++++++++++++++++++++++++
 debian/patches/series                      |   2 +-
 5 files changed, 302 insertions(+), 58 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 72255b6..9d336db 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ mupen64plus-core (1.99.4-3) UNRELEASED; urgency=low
 
   * Fix spelling of "Flexible" in debian/control (Closes: #633693)
   * Mark all targets in debian/rules as phony
+  * debian/patches:
+    - Remove obsolete default-optimisations.patch
+    - Rebase debian/patches/dejavu-font.patch
+    - Add rewrite_makefile.patch, Rewrite Makefile to fix flags and linking
 
  -- Sven Eckelmann <sven at narfation.org>  Wed, 13 Jul 2011 08:38:54 +0200
 
diff --git a/debian/patches/default-optimisations.patch b/debian/patches/default-optimisations.patch
deleted file mode 100644
index 7dbeb1a..0000000
--- a/debian/patches/default-optimisations.patch
+++ /dev/null
@@ -1,50 +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 cf8e6ae7d0849ceea929a18b1628d8b50b3020da..5b6d106d1eab917fdbef4a1d9d8531b6ca8eabbe 100644
---- a/projects/unix/Makefile
-+++ b/projects/unix/Makefile
-@@ -77,15 +77,12 @@ ifeq ("$(CPU)","NONE")
- endif
- 
- # base CFLAGS, LIBS, and LDFLAGS
--CFLAGS += -Wall -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
-+CFLAGS += -Wall -fno-strict-aliasing -fvisibility=hidden -I../../src
- CXXFLAGS += -fvisibility-inlines-hidden
- LIBS += -lpng -lz -lm -lfreetype
- 
--# 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
--endif
-+CFLAGS += -fPIC -DPIC
-+
- # tweak flags for 32-bit build on 64-bit system
- ifeq ($(ARCH_DETECTED), 64BITS_32)
-   ifeq ($(OS), FREEBSD)
-@@ -111,9 +108,9 @@ ifeq ($(OS), LINUX)
-   LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver
-   ifeq ($(CPU), X86)
-     ifeq ($(ARCH_DETECTED), 64BITS)
--      CFLAGS += -pipe -O3 -march=athlon64
-+      CFLAGS += -pipe
-     else
--      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m
-+      CFLAGS += -pipe -mmmx -msse
-       ifneq ($(PROFILE), 1)
-         CFLAGS += -fomit-frame-pointer
-       endif
-@@ -137,9 +134,6 @@ ifeq ($(OS), OSX)
-     endif
-   endif
- endif
--ifeq ($(CPU), PPC)
--  CFLAGS += -mcpu=powerpc
--endif
- ifeq ($(CPU_ENDIANNESS), BIG)
-   CFLAGS += -D_BIG_ENDIAN
- endif
diff --git a/debian/patches/dejavu-font.patch b/debian/patches/dejavu-font.patch
index c112374..f49ffdb 100644
--- a/debian/patches/dejavu-font.patch
+++ b/debian/patches/dejavu-font.patch
@@ -4,18 +4,18 @@ Author: Sven Eckelmann <sven at narfation.org> Please enter the commit message for
 
 ---
 diff --git a/projects/unix/Makefile b/projects/unix/Makefile
-index 5b6d106d1eab917fdbef4a1d9d8531b6ca8eabbe..76022627dd390aaa94c7f95ae27a3c70d7caac89 100644
+index d56839f4fb47f17da3882eff1ac02df6516706b7..b310cc00b4642f15c779e5685bec7bf46e94ff30 100644
 --- a/projects/unix/Makefile
 +++ b/projects/unix/Makefile
-@@ -359,7 +359,7 @@ install: $(TARGET)
- 	$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
- 	$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
- 	$(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
+@@ -399,7 +399,7 @@ install: $(TARGET)
+ 	$(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
+ 	$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(LIBDIR)"
+ 	$(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
 -	$(INSTALL) -m 0644 ../../data/* "$(DESTDIR)$(SHAREDIR)"
 +	$(INSTALL) -m 0644 ../../data/mupen64plus.* "$(DESTDIR)$(SHAREDIR)"
- 	$(INSTALL) -d -v "$(DESTDIR)$(INCDIR)"
+ 	$(INSTALL) -d "$(DESTDIR)$(INCDIR)"
  	$(INSTALL) -m 0644 ../../src/api/m64p_*.h "$(DESTDIR)$(INCDIR)"
- 	if [ `id -u` -eq 0 ]; then $(LDCONFIG); fi
+ 	-$(LDCONFIG) "$(DESTDIR)$(LIBDIR)"
 diff --git a/src/osd/osd.cpp b/src/osd/osd.cpp
 index b62f391f97d7697ef4f877f8f567ddedab869115..d6775c6a9d45a17a1f0b2728060bed3c564e4491 100644
 --- a/src/osd/osd.cpp
diff --git a/debian/patches/rewrite_makefile.patch b/debian/patches/rewrite_makefile.patch
new file mode 100644
index 0000000..3e6f35d
--- /dev/null
+++ b/debian/patches/rewrite_makefile.patch
@@ -0,0 +1,290 @@
+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 cf8e6ae7d0849ceea929a18b1628d8b50b3020da..d56839f4fb47f17da3882eff1ac02df6516706b7 100644
+--- a/projects/unix/Makefile
++++ b/projects/unix/Makefile
+@@ -39,6 +39,10 @@ endif
+ ifeq ("$(UNAME)","FreeBSD")
+   OS = FREEBSD
+ endif
++ifeq ("$(UNAME)","OpenBSD")
++  OS = FREEBSD
++  $(warning OS type "$(UNAME)" not officially supported.')
++endif
+ ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
+   OS = LINUX
+ endif
+@@ -76,23 +80,29 @@ 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 += -Wall -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
++# base CFLAGS, LDLIBS, and LDFLAGS
++OPTFLAGS ?= -O3
++CFLAGS += $(OPTFLAGS) -Wall -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
+ CXXFLAGS += -fvisibility-inlines-hidden
+-LIBS += -lpng -lz -lm -lfreetype
++LDLIBS +=  -lm
+ 
+ # 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
+@@ -100,30 +110,20 @@ ifeq ($(OS), FREEBSD)
+   TARGET = libmupen64plus.so.2.0.0
+   SONAME = libmupen64plus.so.2
+   LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
+-  LIBS += -L${LOCALBASE}/lib -lGL -lGLU -lc
++  LDLIBS += -L${LOCALBASE}/lib -lc
+ endif
+ ifeq ($(OS), LINUX)
+   TARGET = libmupen64plus.so.2.0.0
+   SONAME = libmupen64plus.so.2
+   LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
+-  LIBS += -ldl -L/usr/X11R6/lib -lGL -lGLU
++  LDLIBS += -ldl
+   # only export api symbols
+   LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver
+-  ifeq ($(CPU), X86)
+-    ifeq ($(ARCH_DETECTED), 64BITS)
+-      CFLAGS += -pipe -O3 -march=athlon64
+-    else
+-      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m
+-      ifneq ($(PROFILE), 1)
+-        CFLAGS += -fomit-frame-pointer
+-      endif
+-    endif
+-  endif
+ endif
+ ifeq ($(OS), OSX)
+   TARGET = libmupen64plus.dylib
+   LDFLAGS += -bundle -read_only_relocs suppress
+-  LIBS += -ldl -framework OpenGL
++  LDLIBS += -ldl -framework OpenGL
+   ifeq ($(CPU), X86)
+     ifeq ($(ARCH_DETECTED), 64BITS)
+       CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+@@ -137,38 +137,67 @@ ifeq ($(OS), OSX)
+     endif
+   endif
+ endif
+-ifeq ($(CPU), PPC)
+-  CFLAGS += -mcpu=powerpc
+-endif
+ ifeq ($(CPU_ENDIANNESS), BIG)
+-  CFLAGS += -D_BIG_ENDIAN
++  CFLAGS += -DM64P_BIG_ENDIAN
+ endif
+ 
++# disable verbose output
++ifneq ($(findstring $(MAKEFLAGS),s),s)
++ifndef V
++	Q_CC  = @echo '    CC  '$@;
++	Q_CXX = @echo '    CXX '$@;
++	Q_LD  = @echo '    LD  '$@;
++endif
++endif
++
++# test for essential build dependencies
++ifeq ($(shell which pkg-config 2>/dev/null),)
++  $(error pkg-config not found)
++endif
++ifeq ($(shell pkg-config --modversion libpng 2>/dev/null),)
++  $(error No libpng development libraries found!)
++endif
++ifeq ($(shell pkg-config --modversion zlib 2>/dev/null),)
++  $(error No zlib development libraries found!)
++endif
++ifeq ($(shell pkg-config --modversion freetype2 2>/dev/null),)
++  $(error No FreeType 2 development libraries 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 += $(shell pkg-config --cflags libpng zlib freetype2 gl glu)
++LDLIBS +=  $(shell pkg-config --libs libpng zlib freetype2 gl glu)
++
+ # test for presence of SDL
+ ifeq ($(shell which sdl-config 2>/dev/null),)
+   $(error No SDL development libraries found!)
+ endif
+ CFLAGS	+= $(shell sdl-config --cflags)
+-LIBS	+= $(shell sdl-config --libs)
+-
+-# test for presence of FreeType
+-ifeq ($(shell which freetype-config 2>/dev/null),)
+-   $(error freetype-config not installed!)
+-endif
+-LIBS	+= $(shell freetype-config --libs)
+-CFLAGS	+= $(shell freetype-config --cflags)
++LDLIBS	+= $(shell sdl-config --libs)
+ 
+ # set base program pointers and flags
+ CC       ?= gcc
+ CXX      ?= g++
+-RM       ?= rm
++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)
++
+ ifeq ($(OS),OSX)
+   LDCONFIG ?= true  # no 'ldconfig' under OSX
+-  STRIP	?= strip -x 
+ else
+-  LDCONFIG ?= ldconfig
+-  STRIP	?= strip -s
++  ifeq ($(OS),LINUX)
++    LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -n
++  endif
++  ifeq ($(OS),FREEBSD)
++    LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -m
++  endif
+ endif
+ 
+ # compiler/linker flags for various compile-time options.
+@@ -180,11 +209,13 @@ endif
+ ifeq ($(PROFILE), 1)
+   CFLAGS += -pg -g
+   LDFLAGS += -pg
+-  STRIP = true
++  INSTALL_STRIP_FLAG ?= 
+ else
+   ifeq ($(DEBUG), 1)
+     CFLAGS += -g
+-    STRIP = true
++    INSTALL_STRIP_FLAG ?= 
++  else
++    INSTALL_STRIP_FLAG ?= -s
+   endif
+ endif
+ # 3. other options given to the makefile on the command line
+@@ -322,14 +353,14 @@ ifeq ($(DEBUGGER), 1)
+ 	$(SRCDIR)/debugger/dbg_decoder.c \
+ 	$(SRCDIR)/debugger/dbg_memory.c \
+ 	$(SRCDIR)/debugger/dbg_breakpoints.c
+-  LIBS += -lopcodes -lbfd
++  LDLIBS += -lopcodes -lbfd
+ endif
+ 
+ # generate a list of object files to build, make a temporary directory for them
+ OBJECTS := $(patsubst $(SRCDIR)/%.c,   $(OBJDIR)/%.o, $(filter %.c,   $(SOURCE)))
+ OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
+ OBJDIRS = $(dir $(OBJECTS))
+-$(shell mkdir -p $(OBJDIRS))
++$(shell $(MKDIR) $(OBJDIRS))
+ 
+ # build targets
+ targets:
+@@ -344,6 +375,8 @@ targets:
+ 	@echo "    LIRC=1        == enable LIRC support"
+ 	@echo "    NO_ASM=1      == build without assembly (no dynamic recompiler or MMX/SSE code)"
+ 	@echo "    SHAREDIR=path == extra path to search for shared data files"
++	@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 "    SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
+@@ -358,28 +391,31 @@ targets:
+ 	@echo "    DBG_COUNT=1   == print R4300 instruction count totals (64-bit dynarec only)"
+ 	@echo "    DBG_COMPARE=1 == enable core-synchronized r4300 debugging"
+ 	@echo "    DBG_PROFILE=1 == dump profiling data for r4300 dynarec to data file"
++	@echo "    V=1           == show verbose compiler output"
+ 
+ all: $(TARGET)
+ 
+ install: $(TARGET)
+-	$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
+-	$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
+-	$(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
++	$(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
++	$(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(LIBDIR)"
++	$(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
+ 	$(INSTALL) -m 0644 ../../data/* "$(DESTDIR)$(SHAREDIR)"
+-	$(INSTALL) -d -v "$(DESTDIR)$(INCDIR)"
++	$(INSTALL) -d "$(DESTDIR)$(INCDIR)"
+ 	$(INSTALL) -m 0644 ../../src/api/m64p_*.h "$(DESTDIR)$(INCDIR)"
+-	if [ `id -u` -eq 0 ]; then $(LDCONFIG); fi
++	-$(LDCONFIG) "$(DESTDIR)$(LIBDIR)"
++	if [ ! -e "$(DESTDIR)$(LIBDIR)/$(SONAME)" ]; then ln -sf "$(TARGET)" "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi
+ 
+ uninstall:
+-	$(RM) -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
+-	if [ "$(SONAME)" != "" ]; then $(RM) -f "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi
+-	$(RM) -f $(DESTDIR)$(INCDIR)/m64p_*.h
+-	$(RM) -f "$(DESTDIR)$(SHAREDIR)/mupen64plus.cht"
+-	$(RM) -f "$(DESTDIR)$(SHAREDIR)/mupen64plus.ini"
+-	$(RM) -f "$(DESTDIR)$(SHAREDIR)/font.ttf"
++	$(RM) "$(DESTDIR)$(LIBDIR)/$(TARGET)"
++	if [ "$(SONAME)" != "" ]; then $(RM) "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi
++	$(RM) $(DESTDIR)$(INCDIR)/m64p_*.h
++	$(RM) "$(DESTDIR)$(SHAREDIR)/mupen64plus.cht"
++	$(RM) "$(DESTDIR)$(SHAREDIR)/mupen64plus.ini"
++	$(RM) "$(DESTDIR)$(SHAREDIR)/font.ttf"
++	$(RM) "$(DESTDIR)$(SHAREDIR)/mupencheat.txt"
+ 
+ clean:
+-	$(RM) -rf $(TARGET) $(SONAME) ./_obj
++	$(RM) -r $(TARGET) $(SONAME) ./_obj
+ 
+ # build dependency files
+ CFLAGS += -MD
+@@ -387,23 +423,15 @@ 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
++# standard build rules
++$(OBJDIR)/%.o: $(SRCDIR)/%.c
++	$(COMPILE.c) -o $@ $<
++
++$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
++	$(COMPILE.cc) -o $@ $<
+ 
+-# build rules
+ $(TARGET): $(OBJECTS)
+-	$(Q_LD)$(CXX) $(LDFLAGS) $^ $(LIBS) -o $@
+-	$(STRIP) $@
++	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
+ 	if [ "$(SONAME)" != "" ]; then ln -sf $@ $(SONAME); fi
+ 
+-$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
+-	$(Q_CXX)$(CXX) -o $@ $(CXXFLAGS) -c $<
+-
+-$(OBJDIR)/%.o: $(SRCDIR)/%.c
+-	$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
++.PHONY: all clean install uninstall targets
diff --git a/debian/patches/series b/debian/patches/series
index 9241cbd..9d5f10e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,4 @@
-default-optimisations.patch
+rewrite_makefile.patch
 dejavu-font.patch
 printf_fixup.patch
 api_header.patch

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



More information about the Pkg-games-commits mailing list