Skip to content

Commit 4bd13b9

Browse files
committed
macOS build update + some minor changes
1 parent ec5aed5 commit 4bd13b9

17 files changed

+175
-22
lines changed

Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -1678,8 +1678,10 @@ EXTRA_DIST = $(TESTS) $(EXTRA_TESTS) \
16781678
dist/arch.py \
16791679
dist/linux/build.py \
16801680
dist/linux/standalone-linux.py \
1681+
dist/macos/Entitlements.plist \
16811682
dist/macos/fs-uae-config.icns \
16821683
dist/macos/fs-uae.icns \
1684+
dist/macos/notarize.py \
16831685
dist/macos/PkgInfo \
16841686
dist/macos/sign.py \
16851687
dist/macos/standalone.py \

README

+4-2
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,15 @@ screen, or scale up while maintaining the original aspect ratio.
206206

207207
## Supported host operating systems
208208

209-
FS-UAE can be compiled for the following operating systems.
209+
FS-UAE can be compiled for the following operating systems:
210210

211211
- Linux
212212
- Windows XP or newer
213213
- Mac OS X 10.6 or newer
214214
- FreeBSD (Other Unices will probably also work just fine)
215215

216+
See docs/compiling.md for building instructions.
217+
216218
The official FS-UAE binaries may require newer versions of these operating
217219
systems.
218220

@@ -246,7 +248,7 @@ in the floppy list, some may be obscured.
246248

247249
## Copyright and credits
248250

249-
FS-UAE is Copyright (c) 2011-2019, Frode Solheim
251+
FS-UAE is Copyright (c) 2011-2021, Frode Solheim
250252
Large portions are copyrighted by other individuals.
251253

252254
FS-UAE is based on the fantastic work of the original UAE authors, the authors

dist/macos/Entitlements.plist

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
6+
<true/>
7+
<key>com.apple.security.cs.disable-library-validation</key>
8+
<true/>
9+
</dict>
10+
</plist>

dist/macos/Makefile.in

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ bundle:
5050
cp Info.plist FS-UAE.app/Contents/
5151
cp ./PkgInfo FS-UAE.app/Contents/
5252
cp ../../fs-uae FS-UAE.app/Contents/MacOS/
53-
cp ../../fs-uae.dat FS-UAE.app/Contents/MacOS/
5453
cp ../../fs-uae-device-helper FS-UAE.app/Contents/MacOS/
5554

55+
cp ../../fs-uae.dat FS-UAE.app/Contents/Resources/
5656
mkdir -p FS-UAE.app/Contents/Resources/fs-uae
5757
touch FS-UAE.app/Contents/Resources/fs-uae/share-dir
5858
cp -pPR ../../share/locale FS-UAE.app/Contents/Resources/Locale
59+
5960
cp -pPR ../../data/* FS-UAE.app/Contents/Resources
6061

6162
strip FS-UAE.app/Contents/MacOS/*
@@ -65,4 +66,5 @@ bundle:
6566
# cp ./../../COPYING FS-UAE.app/Contents/Resources/
6667
# cp ./../../README FS-UAE.app/Contents/Resources/
6768
./standalone.py FS-UAE.app
68-
python3 ./sign.py FS-UAE.app
69+
./sign.py FS-UAE.app
70+
./notarize.py FS-UAE.app no.fengestad.fs-uae

dist/macos/notarize.py

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import sys
5+
import time
6+
import xml.etree.ElementTree as ET
7+
8+
if os.environ.get("SIGN", "") == "0":
9+
print("SIGN=0 via environment, skipping notarization step")
10+
sys.exit(0)
11+
if os.environ.get("NOTARIZE", "") == "0":
12+
print("NOTARIZE=0 via environment, skipping notarization step")
13+
sys.exit(0)
14+
if not os.environ.get("APPLE_ID_USER", ""):
15+
print("APPLE_ID_USER not specified, skipping notarization step")
16+
sys.exit(0)
17+
18+
app = sys.argv[1]
19+
app_id = sys.argv[2]
20+
21+
apple_id_user = os.environ.get("APPLE_ID_USER", "")
22+
itc_provider = os.environ.get("ITC_PROVIDER", "")
23+
if os.path.exists(".env"):
24+
f = open(".env", "r")
25+
for line in f:
26+
line = line.strip()
27+
if not line:
28+
continue
29+
key, value = line.split("=")
30+
os.environ[key] = value
31+
if key == "APPLE_ID_USER":
32+
apple_id_user = value
33+
if key == "ITC_PROVIDER":
34+
itc_provider = value
35+
36+
37+
def shell(cmd):
38+
print(cmd)
39+
return os.popen(cmd).read()
40+
41+
42+
shell("rm -f Notarize.zip")
43+
shell("zip -r Notarize.zip \"{}\"".format(app))
44+
result = shell("xcrun altool --notarize-app -t osx -f Notarize.zip " \
45+
"--primary-bundle-id {} -u {} -p @env:APPLE_ID_PASS " \
46+
"-itc_provider {} --output-format xml".format(
47+
app_id, apple_id_user, itc_provider))
48+
49+
print(result)
50+
root = ET.fromstring(result)
51+
dict = root.find("dict")
52+
print(dict)
53+
request_uuid = dict.find("dict").find("string").text
54+
print(request_uuid)
55+
56+
while True:
57+
time.sleep(10.0)
58+
result = shell("xcrun altool --notarization-info {} " \
59+
"-u {} -p @env:APPLE_ID_PASS " \
60+
"-itc_provider {} --output-format xml".format(
61+
request_uuid, apple_id_user, itc_provider))
62+
if "<string>success</string>" in result:
63+
break
64+
elif "<string>in progress</string>" in result:
65+
print("in progress...")
66+
continue
67+
else:
68+
print(result)
69+
raise Exception("...")
70+
71+
print("xcrun stapler staple \"{}\"".format(app))
72+
assert os.system("xcrun stapler staple \"{}\"".format(app)) == 0
73+
shell("rm Notarize.zip")

dist/macos/sign.py

100644100755
+16
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
1+
#!/usr/bin/env python3
2+
3+
import os
14
import sys
25
import time
36
import subprocess
47

8+
if os.environ.get("SIGN", "") == "0":
9+
print("SIGN=0 via environment, skipping signing step")
10+
sys.exit(0)
11+
if not os.environ.get("APPLE_ID_USER", ""):
12+
print("APPLE_ID_USER not specified, skipping signing step")
13+
sys.exit(0)
14+
515
do_sign = True
616
tries = 0
717

18+
# Signing sometimes fails due to Apple errors (timeouts, etc). So we try
19+
# multiple times before giving up.
20+
821
while do_sign:
922
args = [
1023
"codesign",
1124
"-f",
1225
"--deep",
26+
"--options=runtime",
27+
"--entitlements",
28+
"Entitlements.plist",
1329
"-s",
1430
"Developer ID Application",
1531
sys.argv[1],

docs/compiling.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Compiling FS-UAE
22

3-
First, you need to prepare your build environment
3+
These instructions are for you if you want to build your own version of FS-UAE
4+
for any reason.
5+
6+
Please note that the resulting build may not be built in a way that's suitable
7+
for distribution to other users. Often, you need to take additional steps to
8+
ensure that the packages work on systems with older operating system versions.
49

510
## Setting up a build environment
611

12+
First, you need to prepare your build environment. Instructions for several
13+
operating systems are listed below.
14+
715
### Debian / Ubuntu
816

917
Install dependencies for bootstrapping and building FS-UAE:
@@ -34,6 +42,19 @@ Install dependencies for bootstrapping and building FS-UAE:
3442
mingw-w64-x86_64-openal mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf \
3543
pkg-config zip
3644

45+
## macOS
46+
47+
Install homebrew from https://brew.sh (follow their instructions) and then
48+
open a new terminal.
49+
50+
Install dependencies for bootstrapping and building FS-UAE:
51+
52+
brew install autoconf automake freetype gettext glew glib jpeg libmpeg2 \
53+
libpng libtool openal-soft pkg-config sdl2 sdl2_ttf zlib
54+
55+
In order build FS-UAE itself, you need to have Apple's Xcode installed and
56+
command line tools for Xcode enabled.
57+
3758
## Configuring and building FS-UAE
3859

3960
If you are using the git repository, you need to bootstrap with

fsemu/src/fsemu-all.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ extern "C" {
1414
// ----------------------------------------------------------------------------
1515

1616
#include "fsemu-action.c"
17-
#include "fsemu-audio-alsa.c"
18-
#include "fsemu-audio-buffer.c"
17+
#include "fsemu-alsaaudio.c"
1918
#include "fsemu-audio.c"
19+
#include "fsemu-audiobuffer.c"
2020
#include "fsemu-background.c"
2121
#include "fsemu-common.c"
2222
#include "fsemu-config.c"
@@ -29,9 +29,11 @@ extern "C" {
2929
#include "fsemu-font.c"
3030
#include "fsemu-fontcache.c"
3131
#include "fsemu-frame.c"
32+
#include "fsemu-frameinfo.c"
3233
#include "fsemu-gamemode.c"
3334
#include "fsemu-glvideo.c"
3435
#include "fsemu-gui.c"
36+
#include "fsemu-helpbar.c"
3537
#include "fsemu-helper.c"
3638
#include "fsemu-hud.c"
3739
#include "fsemu-image.c"
@@ -41,6 +43,8 @@ extern "C" {
4143
#include "fsemu-inputmode.c"
4244
#include "fsemu-inputport.c"
4345
#include "fsemu-layout.c"
46+
#include "fsemu-led.c"
47+
#include "fsemu-leds.c"
4448
#include "fsemu-log.c"
4549
#include "fsemu-main.c"
4650
#include "fsemu-mainmenu.c"
@@ -58,6 +62,7 @@ extern "C" {
5862
#include "fsemu-path.c"
5963
#include "fsemu-perfgui.c"
6064
#include "fsemu-quit.c"
65+
#include "fsemu-recording.c"
6166
#include "fsemu-refable.c"
6267
#include "fsemu-savestate.c"
6368
#include "fsemu-screenshot.c"

fsemu/src/fsemu-all.h

+5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
#include "fsemu-font.h"
2222
#include "fsemu-fontcache.h"
2323
#include "fsemu-frame.h"
24+
#include "fsemu-frameinfo.h"
2425
#include "fsemu-gamemode.h"
2526
#include "fsemu-glvideo.h"
2627
#include "fsemu-gui.h"
28+
#include "fsemu-helpbar.h"
2729
#include "fsemu-helper.h"
2830
#include "fsemu-hud.h"
2931
#include "fsemu-image.h"
@@ -36,6 +38,8 @@
3638
#include "fsemu-keyboard.h"
3739
#include "fsemu-layer.h"
3840
#include "fsemu-layout.h"
41+
#include "fsemu-led.h"
42+
#include "fsemu-leds.h"
3943
#include "fsemu-log.h"
4044
#include "fsemu-main.h"
4145
#include "fsemu-mainmenu.h"
@@ -53,6 +57,7 @@
5357
#include "fsemu-path.h"
5458
#include "fsemu-perfgui.h"
5559
#include "fsemu-quit.h"
60+
#include "fsemu-recording.h"
5661
#include "fsemu-refable.h"
5762
#include "fsemu-savestate.h"
5863
#include "fsemu-screenshot.h"

fsemu/src/fsemu-background.h

-7
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@
99
extern "C" {
1010
#endif
1111

12-
typedef fsemu_gui_item_t fsemu_widget_t;
13-
1412
void fsemu_background_init(void);
1513

16-
/*
17-
void fsemu_widget_init(fsemu_widget_t *widget);
18-
void fsemu_widget_set_image(fsemu_widget_t *widget, fsemu_image_t *image);
19-
*/
20-
2114
#define fsemu_background_log(format, ...) \
2215
fsemu_log("[FSE] [BCK] " format, ##__VA_ARGS__)
2316

fsemu/src/fsemu-config.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
#ifdef FSEMU_INTERNAL
1212
#pragma GCC diagnostic warning "-Wall"
1313
// #pragma GCC diagnostic warning "-Wconversion"
14+
#ifdef __APPLE__
15+
// Not supported?
16+
#else
1417
#pragma GCC diagnostic warning "-Wdiscarded-qualifiers"
18+
#endif
1519
#pragma GCC diagnostic warning "-Wformat"
1620
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
1721
#pragma GCC diagnostic warning "-Wnarrowing"
@@ -100,11 +104,12 @@
100104
// Feature defines
101105
// ----------------------------------------------------------------------------
102106

107+
// #define FSEMU_GLAD 1
103108
#define FSEMU_GLIB 1
109+
#define FSEMU_MANYMOUSE 1
104110
#define FSEMU_OPENGL 1
105111
#define FSEMU_PNG 1
106112
#define FSEMU_SDL 1
107-
#define FSEMU_MANYMOUSE 1
108113

109114
#ifdef FSUAE
110115
// FS-UAE adjusts audio frequency internally

fsemu/src/fsemu-frame.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121

2222
// ----------------------------------------------------------------------------
2323

24+
#ifdef FSFUSE
25+
int fsemu_frame_log_level = FSEMU_LOG_LEVEL_TRACE;
26+
#else
27+
int fsemu_frame_log_level = FSEMU_LOG_LEVEL_INFO;
28+
#endif
29+
2430
static struct {
2531
bool initialized;
2632
// Will not overflow for over a year @60 Hz
@@ -71,8 +77,6 @@ int64_t fsemu_frame_extra_duration = 0;
7177
int64_t fsemu_frame_gui_duration = 0;
7278
int64_t fsemu_frame_render_duration = 0;
7379

74-
int fsemu_frame_log_level = 1;
75-
7680
bool fsemu_frame_check_load_state(int *slot)
7781
{
7882
if (fsemu_frame.load_state != -1) {
@@ -121,6 +125,7 @@ void fsemu_frame_reset_epoch(void)
121125

122126
void fsemu_frame_end(void)
123127
{
128+
fsemu_frame_log_trace("%s\n", __func__);
124129
fsemu_thread_assert_emu();
125130
fsemu_frame_log_epoch("Frame end\n");
126131
fsemu_assert(fsemu_frame.initialized);
@@ -975,6 +980,7 @@ static void fsemu_frame_start_2(double hz)
975980
// FIXME: Rename to fsemu_frame_begin?
976981
void fsemu_frame_start(double hz)
977982
{
983+
fsemu_frame_log_trace("%s hz=%f\n", __func__, hz);
978984
fsemu_thread_assert_emu();
979985

980986
fsemu_frame_start_2(hz);

fsemu/src/fsemu-glvideo.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -700,15 +700,16 @@ extern int64_t laaaast_vsync_at;
700700
void fsemu_glvideo_display(void)
701701
{
702702
int n = fsemu_frame_number_displaying % 2;
703-
fsemu_assert(n >= 0);
703+
fsemu_assert_release(n >= 0);
704704
if (fsemu_glvideo.swap_sync[n]) {
705+
printf(
706+
"Must wait for previous swap "
707+
"(fsemu_frame_number_displaying=%d)\n",
708+
fsemu_frame_number_displaying);
705709
while (fsemu_glvideo.swap_sync[n]) {
706-
printf(
707-
"Must wait for previous swap "
708-
"(fsemu_frame_number_displaying=%d)\n",
709-
fsemu_frame_number_displaying);
710710
fsemu_sleep_us(10000);
711711
}
712+
printf("Wait done\n");
712713
// // wait_for_swap(50000);
713714
}
714715

fsemu/src/fsemu-log.c

+2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
#include "fsemu-option.h"
99
#include "fsemu-time.h"
1010

11+
#ifdef FSUAE
1112
// For now...
1213
#include <fs/log.h>
14+
#endif
1315

1416
static struct {
1517
bool initialized;

0 commit comments

Comments
 (0)