- Add ONLY_FOR_ARCHS_REASON.

- Add USE_DOS2UNIX to avoid CR characters in patches.
- Remove FreeBSD 4.x support.
- Remove SDL fix for old non-standard location.
- Fix building with GCC 4.x [1].
- Respect CFLAGS and LDFLAGS.

Reported by:	pointyhat [1]
This commit is contained in:
Alejandro Pulver 2007-04-08 03:11:22 +00:00
parent d224288b54
commit 5650140fa4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=189461
5 changed files with 79 additions and 156 deletions

View File

@ -19,6 +19,8 @@ COMMENT= Sega Master System emulator
BUILD_DEPENDS= nasm:${PORTSDIR}/devel/nasm
ONLY_FOR_ARCHS= i386
ONLY_FOR_ARCHS_REASON= uses i386 assembly code
USE_DOS2UNIX= yes
USE_ZIP= yes
USE_GMAKE= yes
USE_SDL= sdl
@ -31,23 +33,8 @@ PORTDOCS= readme.txt
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 500000
EXTRA_PATCHES= ${FILESDIR}/extra-patch-freebsd4
.endif
post-patch:
# Fix Makefile.
@${REINPLACE_CMD} -e 's|\(-Dlinux\)|${CFLAGS} \1| ; \
s|sdl-config|${SDL_CONFIG}|' \
${WRKSRC}/${MAKEFILE}
# Fix SDL include statement.
@${REINPLACE_CMD} -e 's|\(#include.*\)SDL/\(SDL.*\)|\1\2|' \
${WRKSRC}/*.h
# Enable/disable compilation optimizations.
.if defined(WITHOUT_OPTIMIZED_CFLAGS)
@${REINPLACE_CMD} -e 's|-O3||g' ${WRKSRC}/${MAKEFILE}
.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
MAKE_ENV+= OPTIMIZED_CFLAGS=yes
.endif
do-install:

View File

@ -1,110 +0,0 @@
--- InputDevice.h.orig Wed Jul 27 23:08:41 2005
+++ InputDevice.h Wed Jul 27 23:09:05 2005
@@ -17,6 +17,7 @@
#ifndef INPUT_DEVICE_H
#define INPUT_DEVICE_H
+#include <string>
#include <SDL/SDL.h>
#include <iostream>
--- Options.h.orig Wed Jul 27 22:33:50 2005
+++ Options.h Wed Jul 27 22:34:08 2005
@@ -14,6 +14,7 @@
#ifndef OPTIONS_H
#define OPTIONS_H
+#include <string.h>
#include <iostream>
#include <iomanip>
#include "Bits.h"
--- OsmoseCore.cpp.orig Wed Jul 27 03:33:44 2005
+++ OsmoseCore.cpp Wed Jul 27 03:34:13 2005
@@ -12,6 +12,7 @@
*
* URL: http://bcz.emu-france.com/
*****************************************************************************/
+#include <string>
#include "OsmoseCore.h"
#define TIME_LIMITE 7*60
--- SN76489.h.orig Wed Jul 27 22:26:47 2005
+++ SN76489.h Wed Jul 27 22:31:08 2005
@@ -13,6 +13,7 @@
*****************************************************************************/
#ifndef SN76489_H
#define SN76489_H
+#include <string.h>
#include <iomanip>
#include <iostream>
#include <SDL/SDL.h>
--- TextWriter.h.orig Wed Jul 27 23:06:45 2005
+++ TextWriter.h Wed Jul 27 23:06:53 2005
@@ -15,6 +15,7 @@
#ifndef TEXT_WRITER_H
#define TEXT_WRITER_H
+#include <string>
#include <iomanip>
#include <SDL/SDL.h>
--- VDP.h.orig Wed Jul 27 21:55:01 2005
+++ VDP.h Wed Jul 27 21:55:33 2005
@@ -13,6 +13,7 @@
*****************************************************************************/
#ifndef VDP_H
#define VDP_H
+#include <string.h>
#include <SDL/SDL.h>
#include <iomanip>
#include <iostream>
--- VideoFilter.h.orig Wed Jul 27 23:04:17 2005
+++ VideoFilter.h Wed Jul 27 23:04:36 2005
@@ -35,6 +35,7 @@
#ifndef VIDEO_FILTER_H
#define VIDEO_FILTER_H
+#include <string>
#include <SDL/SDL.h>
#include <iostream>
--- main.cpp.orig Sun May 22 19:43:10 2005
+++ main.cpp Wed Jul 27 03:20:22 2005
@@ -31,6 +31,7 @@
* URL: http://bcz.emu-france.com/
*****************************************************************************/
+#include <string>
#include <iostream>
#include <iomanip>
#include "OsmoseCore.h"
@@ -155,7 +156,7 @@
// If actual argument nbr < argument number eg is there any args ?
if (i < a-1)
{
- opt.acceleration = atof( rv[i+1]);
+ opt.acceleration = strtod(rv[i+1], (char **)NULL);
if (opt.acceleration == 0)
{
cerr << "No valid acceleration parameter was given. Using default " << (float)DEFAULT_ACCELERATION << " value." << endl;
--- MemoryMapper.h.orig Mon Apr 11 20:07:36 2005
+++ MemoryMapper.h Thu Jul 28 07:57:32 2005
@@ -14,6 +14,8 @@
*****************************************************************************/
#ifndef MEMORY_MAPPER_H
#define MEMORY_MAPPER_H
+#include <stdlib.h>
+#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
--- OsmoseConfiguration.h.orig Mon Jan 24 11:28:46 2005
+++ OsmoseConfiguration.h Thu Jul 28 07:59:39 2005
@@ -15,6 +15,7 @@
#ifndef OSMOSE_CONFIGURATION_H
#define OSMOSE_CONFIGURATION_H
+#include <string>
#include <SDL/SDL.h>
#include <iostream>
#include <iomanip>

View File

@ -1,29 +1,54 @@
--- Makefile.orig Thu Jul 28 07:51:45 2005
+++ Makefile Thu Jul 28 07:53:34 2005
@@ -43,11 +43,11 @@
# Compiler/Linker Flags
# add -O3 to CFLAGS for speedup -pg on LFLAGS and CFLAGS for gprof
-CFLAGS = -Wall -O3
-LFLAGS = -lSDL
+CFLAGS = -Dlinux `sdl-config --cflags` -O3
+LFLAGS = `sdl-config --libs`
AFLAGS = -f elf
-CC = g++
-C_COMP = gcc
+CC = ${CXX}
+C_COMP = ${CC}
ASM = nasm
# Our needed rules. $* is current file, without suffix.
@@ -84,8 +84,8 @@
rm -f *.o core $(OSM_EXE)
libs:
- cd $(Z_LIB_DIR) && make libz.a
- cd $(UNZIP_DIR) && make unzip.a
+ cd $(Z_LIB_DIR) && ${MAKE} libz.a
+ cd $(UNZIP_DIR) && ${MAKE} unzip.a
--- Makefile.orig Sat Apr 7 20:42:59 2007
+++ Makefile Sat Apr 7 20:44:04 2007
@@ -43,21 +43,25 @@
# Compiler/Linker Flags
# add -O3 to CFLAGS for speedup -pg on LFLAGS and CFLAGS for gprof
-CFLAGS = -Wall -O3
-LFLAGS = -lSDL
+CFLAGS += -Dlinux `sdl-config --cflags`
+
+ifdef OPTIMIZED_CFLAGS
+CFLAGS += -O3
+endif
+
+LFLAGS = $(LDFLAGS) `sdl-config --libs`
AFLAGS = -f elf
-CC = g++
-C_COMP = gcc
+CXX ?= g++
ASM = nasm
# Our needed rules. $* is current file, without suffix.
.SUFFIXES: .cxx .o
.cxx.o:
- $(CC) $(CFLAGS) -c $*.cxx -o $*.o
+ $(CXX) $(CFLAGS) -c $*.cxx -o $*.o
.SUFFIXES: .cpp .o
.cpp.o:
- $(CC) $(CFLAGS) -c $*.cpp -o $*.o
+ $(CXX) $(CFLAGS) -c $*.cpp -o $*.o
.SUFFIXES: .asm .o
.asm.o:
@@ -66,7 +70,7 @@
all: disasm z80_lib libs osmose
osmose: $(z80_lib) $(OSM_OBJS) $(OPT_OBJS)
- $(CC) $(CFLAGS) $(OSM_OBJS) $(Z80_LIB) $(OPT_OBJS) $(UNZIP_LIB) $(Z_LIB) -o $(OSM_EXE) $(LFLAGS)
+ $(CXX) $(CFLAGS) $(OSM_OBJS) $(Z80_LIB) $(OPT_OBJS) $(UNZIP_LIB) $(Z_LIB) -o $(OSM_EXE) $(LFLAGS)
z80_lib: $(Z80_OBJS)
ar -rv $(Z80_LIB) $(Z80_DIR)/*.o
@@ -84,8 +88,8 @@
rm -f *.o core $(OSM_EXE)
libs:
- cd $(Z_LIB_DIR) && make libz.a
- cd $(UNZIP_DIR) && make unzip.a
+ cd $(Z_LIB_DIR) && ${MAKE} libz.a
+ cd $(UNZIP_DIR) && ${MAKE} unzip.a

View File

@ -0,0 +1,10 @@
--- ./PrecisionTimer.h.orig Sat Apr 7 19:48:42 2007
+++ ./PrecisionTimer.h Sat Apr 7 19:49:31 2007
@@ -81,6 +81,6 @@
unsigned long long tick_per_second; // Self explanatory.
unsigned long long T0; // Self explanatory.
unsigned long long T1; // Self explanatory.
- double PrecisionTimer::getOneShotDuration();
+ double getOneShotDuration();
};
#endif

View File

@ -0,0 +1,11 @@
--- ./TvVideoFilter.h.orig Sat Apr 7 19:48:42 2007
+++ ./TvVideoFilter.h Sat Apr 7 19:49:43 2007
@@ -19,7 +19,7 @@
class TvVideoFilter : public VideoFilter {
public:
- TvVideoFilter::TvVideoFilter();
+ TvVideoFilter();
int getFinalOutputWidth();
int getFinalOutputHeight();
void Filter(SDL_Surface *s, SDL_Surface *d);