Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#54699 closed submission (fixed)

mame: New port

Reported by: mf2k (Frank Schima) Owned by: mf2k (Frank Schima)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: mame

Description

Here is my current attempt of a Portfile for mame.

It is failing to find Macports libsdl2 files though.

Attachments (5)

Portfile (1.2 KB) - added by mf2k (Frank Schima) 7 years ago.
patch-makefile.diff (403 bytes) - added by mf2k (Frank Schima) 7 years ago.
Portfile.2 (2.0 KB) - added by mf2k (Frank Schima) 7 years ago.
Portfile.3 (2.1 KB) - added by mf2k (Frank Schima) 7 years ago.
patch-rendutil.cpp.diff (388 bytes) - added by mf2k (Frank Schima) 7 years ago.

Download all attachments as: .zip

Change History (17)

Changed 7 years ago by mf2k (Frank Schima)

Attachment: Portfile added

Changed 7 years ago by mf2k (Frank Schima)

Attachment: patch-makefile.diff added

comment:1 Changed 7 years ago by kencu (Ken)

First thing I notice is that configure.cpp doesn't seem to be picking up the correct cpp, at least for me...

build.args-append   CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    CPP=${configure.cpp}
Executing:  cd "/opt/local/var/macports/build/_Users_Shared_Downloads_emulators_mame/mame/work/mame-mame0189" && /usr/bin/make -j4 -w all CC=/opt/local/bin/clang-mp-3.9 CXX=/opt/local/bin/clang++-mp-3.9 CPP=/usr/bin/cpp 
$ /usr/bin/cpp --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

comment:2 Changed 7 years ago by kencu (Ken)

I think you'll need to override this default as well

# USE_BUNDLED_LIB_SDL2 = 1

but even when I try to do that, it insists on trying to build it anyway

Objective-C compiling 3rdparty/SDL2/src/video/cocoa/SDL_cocoaevents.m...
Last edited 7 years ago by kencu (Ken) (previous) (diff)

comment:3 Changed 7 years ago by kencu (Ken)

Frank, it looks to me like the logic to be sorted through is in this file here:

scripts/src/osd/sdl.lua

down around this block:

if BASE_TARGETOS=="unix" then
	if _OPTIONS["targetos"]=="macosx" then

and that logic might need to be reworked a bit to properly interact with MacPorts-installed SDL2.

comment:4 Changed 7 years ago by jmroot (Joshua Root)

It's correct for configure.cpp to be set to /usr/bin/cpp. A lot of software that runs $CPP (as opposed to $CC -E) wants a traditional-style preprocessor, and clang does not provide that. (The tradcpp port exists to provide this for systems that don't have gcc.) Are you sure mame even uses $CPP?

The makefile patch effectively does nothing; it only changes comments. To use our libsdl, USE_LIBSDL=1 needs to be added to the build.args.

Changed 7 years ago by mf2k (Frank Schima)

Attachment: Portfile.2 added

comment:5 Changed 7 years ago by mf2k (Frank Schima)

Here is my latest version that attempts to use as many Macports libraries as possible. But it is failing with jpeg for some reason?!?!?

Error is here:

../../../../../src/emu/rendutil.cpp:15:10: fatal error: 'jpeglib.h' file not
      found
#include "jpeglib.h"
         ^
Compiling src/mame/drivers/hh_hmcs40.cpp...
Compiling src/mame/video/hec2hrp.cpp...
1 error generated.
make[2]: *** [../../../../osx_clang/obj/x64/Release/src/emu/rendutil.o] Error 1

comment:6 Changed 7 years ago by mf2k (Frank Schima)

I see this error now:

:info:build Compiling src/emu/rendutil.cpp...
:info:build ../../../../../src/emu/rendutil.cpp:579:2: error: no matching function for call to 'jpeg_read_header'
:info:build         jpeg_read_header(&cinfo, true);
:info:build         ^~~~~~~~~~~~~~~~
:info:build In file included from ../../../../../src/emu/rendutil.cpp:15:
:info:build /opt/local/include/jpeglib.h:1039:13: note: candidate function not viable: no known conversion from 'bool' to 'boolean' for 2nd argument
:info:build EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
:info:build             ^
:info:build 1 error generated.

comment:7 Changed 7 years ago by jmroot (Joshua Root)

JPEG defines its own boolean type and C++ is being strict about typing. Using TRUE instead of true should work.

comment:8 Changed 7 years ago by kencu (Ken)

As a data point, I took a slightly different approach.

build.args-append   CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    -e

build.env-append    USE_LIBSDL = 1 \
                    USE_BUNDLED_LIB_SDL2=0 \
                    PYTHON_EXECUTABLE=/opt/local/bin/python3.6 \
                    MESA_INSTALL_ROOT=${prefix} \
                    SDL_INSTALL_ROOT=${prefix}

which builds through all the way to:

In file included from ../../../../../src/osd/modules/input/input_common.cpp:36:
In file included from /opt/local/include/SDL2/SDL.h:32:
In file included from /opt/local/include/SDL2/SDL_main.h:25:
In file included from /opt/local/include/SDL2/SDL_stdinc.h:31:
In file included from /opt/local/include/SDL2/SDL_config.h:33:
/opt/local/include/SDL2/SDL_platform.h:73:5: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef]
#if TARGET_OS_TV
    ^

which is actually a minor error in the say the SLD_platform.h is written, which I fixed like this in that header for the moment:

//#if TARGET_OS_TV
#if defined(TARGET_OS_TV)

but in the end (after a very long build) still fails to link at final stages because no SDL2.framework is found.

Linking mame...
ld: framework not found SDL2
clang: error: linker command failed with exit code 1 (use -v to see invocation)

So I'll leave this with you, but I'd still look at fixing this logic. comment:3

Last edited 7 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

Changed 7 years ago by mf2k (Frank Schima)

Attachment: Portfile.3 added

Changed 7 years ago by mf2k (Frank Schima)

Attachment: patch-rendutil.cpp.diff added

comment:9 Changed 7 years ago by mf2k (Frank Schima)

Latest attempt.

comment:10 Changed 7 years ago by mf2k (Frank Schima)

Owner: set to mf2k
Resolution: fixed
Status: newclosed

comment:11 Changed 7 years ago by mf2k (Frank Schima)

I verified that it links properly against all of the dependencies.

comment:12 Changed 7 years ago by kencu (Ken)

FYI, in case of future tickets. On my system, the error: 'TARGET_OS_TV' is not defined comes up just as it did before. It probably happens because I use a newer clang (3.9). Can probably disable that with -Wno-undef if I can figure out how to get that on the build flags - or maybe just set TARGET_OS_TV=0 in the build args.

Also, insists on building 32 bit for some reason. Links and destroot fail (mame instead of mame64 gets built). I think that can be forced with a 64bit flag I saw PTR64 -- dunno why it isn't properly picked up in the first place.

I installed the man files, for my own use.

Last edited 7 years ago by kencu (Ken) (previous) (diff)
Note: See TracTickets for help on using tickets.