ref: 39041cf91b12841636bbc475351157e59623fad2
parent: 629d24630013fb4436e3bb4e6a0fd4b9152dd6e5
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Jan 8 00:58:08 EST 2025
add MacOS m68k cross file
--- /dev/null
+++ b/cross/m68-apple.txt
@@ -1,0 +1,30 @@
+[constants]
+toolchain = '@DIRNAME@/macos-toolchain/'
+path = toolchain + 'bin/'
+prefix = path + 'm68k-apple-macos-'
+
+[built-in options]
+c_args = ['-fdata-sections', '-mcpu=68040', '-ffunction-sections', '-D__macos__']
+cpp_link_args = ['-Wl,-gc-sections', '-mcpu=68040', '-Wl,--mac-strip-macsbug']
+
+[properties]
+rincludes = toolchain + 'RIncludes'
+makepef = path + 'MakePEF'
+rez = path + 'Rez'
+
+[binaries]
+c = prefix + 'gcc'
+as = prefix + 'as'
+ar = prefix + 'ar'
+cpp = prefix + 'g++'
+pkg-config = prefix + 'pkg-config'
+strip = prefix + 'strip'
+
+[host_machine]
+system = 'macos'
+cpu_family = 'm68k'
+cpu = 'm68k'
+endian = 'big'
+
+[project options]
+build-tests = 'disabled'
--- a/meson.build
+++ b/meson.build
@@ -37,7 +37,6 @@
'-Wunused-parameter',
'-Wwrite-strings',
'-D_DEFAULT_SOURCE',
- '-DCOMPUTED_GOTO',
language: 'c',
)
@@ -45,6 +44,7 @@
if host_machine.system() == 'macos'
platform = 'macos'
+ flisp_exe_name = 'flisp.code.bin'
add_languages(
'cpp',
native: false,
@@ -53,12 +53,24 @@
cpp = meson.get_compiler('cpp')
add_project_arguments(
'-DINITIAL_HEAP_SIZE=64*1024',
+ '-D__thread=', # does not make sense anyway
language: 'c',
)
- extras = [cpp.find_library('RetroConsole', required: true)]
+ if host_machine.cpu() != 'm68k'
+ # computed gotos break m68k build
+ add_project_arguments(
+ '-DCOMPUTED_GOTO',
+ language: 'c',
+ )
+ endif
+ extras = [
+ cpp.find_library('RetroConsole', required: true),
+ ]
else
+ flisp_exe_name = 'flisp'
add_project_arguments(
'-DINITIAL_HEAP_SIZE=2*1024*1024',
+ '-DCOMPUTED_GOTO',
language: 'c',
)
extras = []
@@ -212,7 +224,7 @@
)
flisp = executable(
- 'flisp',
+ flisp_exe_name,
sources: [
src,
boot,
@@ -236,38 +248,52 @@
)
if platform == 'macos'
- flisp_pef = custom_target(
- 'flisp.pef',
- input: [
- flisp
- ],
- output: [
+ if host_machine.cpu() == 'm68k'
+ template = 'Retro68APPL.r'
+ rez_data = '--copy'
+ rezflags = []
+ flisp_code = flisp
+ else
+ template = 'RetroPPCAPPL.r'
+ rez_data = '--data'
+ rezflags = ['-DTARGET_API_MAC_CARBON=1']
+ flisp_code = custom_target(
'flisp.pef',
- ],
- command: [
- meson.get_external_property('makepef'), '@INPUT@', '-o', '@OUTPUT@',
- ],
- )
+ input: [
+ flisp
+ ],
+ output: [
+ 'flisp.pef',
+ ],
+ command: [
+ meson.get_external_property('makepef'),
+ '@INPUT@',
+ '-o', '@OUTPUT@',
+ ],
+ )
+ endif
+ rincludes = meson.get_external_property('rincludes')
+
flisp_bin = custom_target(
'flisp.bin',
input: [
- flisp_pef,
+ flisp_code,
],
output: [
'flisp.bin',
+ 'flisp.dsk',
],
command: [
meson.get_external_property('rez'),
- '-I' + meson.get_external_property('rincludes'),
- meson.get_external_property('rincludes') + '/RetroPPCAPPL.r',
+ '-I' + rincludes,
+ ] + rezflags + [
+ rincludes + '/' + template,
'-DCFRAG_NAME="flisp"',
- '-o', '@OUTPUT@',
- #'--cc', 'flisp.dsk',
- #'--cc', 'flisp.APPL',
- #'--cc', '%flisp.ad',
+ '-o', 'flisp.bin',
'-t', 'APPL',
- '-c', 'SGRD',
- '--data', '@INPUT@',
+ '-c', '????',
+ rez_data, '@INPUT@',
+ '--cc', 'flisp.dsk',
],
build_by_default: true,
)