From: Javier S. Pedro Date: Thu, 10 Sep 2009 01:12:31 +0000 (+0200) Subject: new build system; package can be built in i386 X-Git-Tag: drnoksnes_1_1_0~2 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=b017c0ee002a0d7b48da5b891055a4e8d2106c38;p=drnoksnes new build system; package can be built in i386 --- diff --git a/Makefile b/Makefile index f23764b..6910b95 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,24 @@ #!/usr/bin/make -CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11 xsp) -I/usr/include/hgw -LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11 xsp) -lpopt -lhgw - -# Default CFLAGS for building in N8x0 -ARCH ?= armel -CFLAGS ?= -DMAEMO -DMAEMO_VERSION=4 -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O2 -g -Wall -static-libgcc -ASFLAGS ?= -march=armv6j -mfpu=vfp -mfloat-abi=softfp -g -CXXFLAGS ?= $(CFLAGS) - -# Default CFLAGS for building in PC -#ARCH := i386 -#CFLAGS := -DMAEMO -DMAEMO_VERSION=4 -O2 -g -Wall -#ASFLAGS := -g -#CXXFLAGS := $(CFLAGS) - -GAME_VERSION ?= $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')-git -export GAME_VERSION +CPPFLAGS := -I. $(shell sdl-config --cflags) $(shell pkg-config --cflags x11) -I/usr/include/hgw +LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11) -lpopt -lhgw + +-include config.mk + +# GUI needs this export DESTDIR # Configuration settings CONF_BUILD_ASM_CPU=0 CONF_BUILD_ASM_SPC700=0 CONF_BUILD_ASM_SA1=0 # Still not there +CONF_XSP=0 +# Sane defaults (override if needed) ifeq ($(ARCH),armel) CONF_BUILD_ASM_CPU=1 CONF_BUILD_ASM_SPC700=1 + CONF_XSP=1 CONF_BUILD_MISC_ROUTINES=misc_armel else ifeq ($(ARCH),i386) CONF_BUILD_MISC_ROUTINES=misc_i386 @@ -56,6 +48,11 @@ else OBJS += sa1cpu.o endif +ifeq ($(CONF_XSP), 1) + CPPFLAGS += -DCONF_XSP=1 $(shell pkg-config --cflags xsp) + LDLIBS += $(shell pkg-config --libs xsp) +endif + OBJS += $(CONF_BUILD_MISC_ROUTINES).o # from open-whatever sdk @@ -96,9 +93,9 @@ deps: $(DEPS) gui: $(MAKE) -C gui all - + gui_clean: $(MAKE) -C gui clean - + .PHONY: all clean remake deps install gui gui_clean diff --git a/debian/control.m4 b/debian/control.m4 index e5222c9..3c4bdf6 100644 --- a/debian/control.m4 +++ b/debian/control.m4 @@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 5), pkg-config, maemo-version, m4, libsdl1.2-dev, Standards-Version: 3.7.2 Package: drnoksnes -Architecture: armel +Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, osso-games-startup ifelse(eval(MAEMO_MAJOR < 5), 1, `Pre-Depends: maemo-select-menu-location', `dnl') Description: Super Nintendo Entertainment System emulator @@ -174,7 +174,7 @@ ifelse(eval(MAEMO_MAJOR < 5), 1, `dnl ')dnl Package: drnoksnes-dbg -Architecture: armel +Architecture: any Section: devel Depends: drnoksnes (= ${Source-Version}) Description: Debug symbols for the DrNokSnes emulator diff --git a/debian/rules b/debian/rules index 16d3b6b..429398d 100755 --- a/debian/rules +++ b/debian/rules @@ -13,6 +13,7 @@ # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) # Determine Maemo version MAEMO_VERSION := $(shell cut -d"." -f1 /etc/maemo_version) @@ -20,25 +21,34 @@ MAEMO_VERSION := $(shell cut -d"." -f1 /etc/maemo_version) # Determine app version from debian changelog GAME_VERSION := $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g') +# Default CFLAGS CFLAGS = -Wall -g -DMAEMO -DMAEMO_VERSION=$(MAEMO_VERSION) -GUI_CFLAGS := $(CFLAGS) +GUI_CFLAGS := -fPIC -shared $(CFLAGS) LDFLAGS = -Wl,-z,defs +GUI_LDFLAGS := -export-dynamic -avoid-version -module -shared $(LDFLAGS) +ASFLAGS = -g M4=m4 M4DEFS=-DMAEMO_MAJOR=$(MAEMO_VERSION) +# Architecture specific CFLAGS ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 -else ifneq (,$(findstring arm,$(DEB_BUILD_GNU_TYPE))) +else ifneq (,$(findstring armel,$(ARCH))) CFLAGS += -O2 GUI_CFLAGS += -Os ifneq (,$(findstring vfp,$(DEB_BUILD_OPTIONS))) CFLAGS += -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp + ASFLAGS += -march=armv6j -mfpu=vfp -mfloat-abi=softfp endif - # Fixes hang while exiting on Diablo. + # Fixes hang while exiting in Diablo. CFLAGS += -static-libgcc -else # x86 - crash ## Cannot build in x86 +else ifneq (,$(findstring i386,$(ARCH))) + CFLAGS += -O2 + GUI_CFLAGS += -O2 +else + # Don't support anything else yet + crash endif debian/control: debian/control.m4 @@ -49,12 +59,23 @@ configure-stamp: dh_testdir $(M4) $(M4DEFS) debian/control.m4 > debian/control $(M4) $(M4DEFS) debian/drnoksnes.postinst.m4 > debian/drnoksnes.postinst + + echo ARCH="$(ARCH)" > config.mk + echo ASFLAGS="$(ASFLAGS)" >> config.mk + echo CFLAGS="$(CFLAGS)" >> config.mk + echo CXXFLAGS="$(CFLAGS)" >> config.mk + echo LDFLAGS="$(LDFLAGS)" >> config.mk + + echo CFLAGS="$(GUI_CFLAGS)" > gui/config.mk + echo LDFLAGS="$(GUI_LDFLAGS)" >> gui/config.mk + echo GAME_VERSION="$(GAME_VERSION)" >> gui/config.mk + touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir - $(MAKE) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" GUI_CFLAGS="$(GUI_CFLAGS)" GAME_VERSION="$(GAME_VERSION)" + $(MAKE) touch $@ clean: @@ -62,6 +83,7 @@ clean: dh_testroot rm -f build-stamp configure-stamp -$(MAKE) clean + rm -f config.mk gui/config.mk dh_clean install: build diff --git a/gui/Makefile b/gui/Makefile index a7501c6..adda67e 100644 --- a/gui/Makefile +++ b/gui/Makefile @@ -2,16 +2,7 @@ PKGS:=gtk+-2.0 hildon-1 hildon-fm-2 libhildonmime gconf-2.0 gnome-vfs-2.0 CPPFLAGS:=$(shell pkg-config --cflags $(PKGS)) -DGAME_VERSION=$(GAME_VERSION) LDLIBS:=$(shell pkg-config --libs $(PKGS)) -ifdef GUI_CFLAGS - override CFLAGS:=$(GUI_CFLAGS) -else - override CFLAGS:= -g -Os -Wall -fpic -shared -DMAEMO -endif -ifdef GUI_LDFLAGS - override LDFLAGS:=$(GUI_LDFLAGS) -else - override LDFLAGS:= -export-dynamic -avoid-version -module -shared -Wl,-z,defs -endif +-include config.mk #GAME_VERSION GAME_SHARE_PATH=/usr/share/games/drnoksnes diff --git a/gui/plugin.c b/gui/plugin.c index c0f4151..115c031 100644 --- a/gui/plugin.c +++ b/gui/plugin.c @@ -196,7 +196,7 @@ static GtkWidget * load_plugin(void) gtk_box_pack_start(framerate_box, GTK_WIDGET(framerate_combo), FALSE, FALSE, 0); #endif - gtk_combo_box_append_text(framerate_combo, "Best"); + gtk_combo_box_append_text(framerate_combo, "Auto"); for (i = 1; i < 10; i++) { gchar buffer[20]; sprintf(buffer, "%d-%d", 50/i, 60/i); diff --git a/platform/sdlv.cpp b/platform/sdlv.cpp index 5cdc1aa..e8c38fb 100644 --- a/platform/sdlv.cpp +++ b/platform/sdlv.cpp @@ -2,10 +2,13 @@ #include #include -#include #include #include +#if CONF_XSP +# include +#endif + #include "snes9x.h" #include "platform.h" #include "display.h" @@ -28,7 +31,7 @@ static bool gotWindowSize, gotScreenSize; /** Inside the surface, where are we drawing */ static SDL_Rect renderArea; -#ifdef MAEMO +#if CONF_XSP static void setDoubling(bool enable) { SDL_SysWMinfo wminfo; @@ -127,7 +130,11 @@ static void setupVideoSurface() GUI.Width = windowSize.w; GUI.Height = windowSize.h; } - +#else + GUI.Width = gameWidth; + GUI.Height = gameHeight; +#endif +#if CONF_XSP // So, can we enable Xsp? if (gameWidth * 2 < GUI.Width && gameHeight * 2 < GUI.Height) { Config.xsp = true; @@ -136,8 +143,7 @@ static void setupVideoSurface() setDoubling(false); // Before switching video modes; avoids flicker. } #else - GUI.Width = gameWidth; - GUI.Height = gameHeight; + Config.xsp = false; #endif // Safeguard @@ -159,7 +165,7 @@ static void setupVideoSurface() GFX.PixSize = screen->format->BitsPerPixel / 8; // Ok, calculate renderArea -#ifdef MAEMO +#if CONF_XSP if (Config.xsp) { setDoubling(true); centerRectangle(renderArea, GUI.Width, GUI.Height, @@ -188,7 +194,7 @@ static void setupVideoSurface() GUI.RenderW = renderArea.w; GUI.RenderH = renderArea.h; -#ifdef MAEMO +#if CONF_XSP if (Config.xsp) { // Do not update 2x the area. renderArea.w /= 2; @@ -226,9 +232,11 @@ void S9xVideoToggleFullscreen() void S9xVideoOutputFocus(bool hasFocus) { +#if CONF_XSP if (Config.xsp) { setDoubling(hasFocus); } +#endif } // This is here for completeness, but palette mode is useless on N8x0