OS X build fixes (#892)

* Fix mising plist files, fix missing directory external/libguisan/dylib

* Fix for not building dylib when .a file exists
Fix for typo in making app bundle directories

* Fixed minor typo

* Disable JIT in GUI on OS X for now

* Fix compilation errors on OS X, sigurbjornl, 20220208

* Fix compilation errors on OS X, sigurbjornl, 20220208

* Default OS X configuration

* Use dylibbundler to bundle libguisan with App bundle on OS X

* Don't need a separate icon for the App bundle, use default icon
This commit is contained in:
Sigurbjorn B. Larusson 2022-02-08 19:22:46 +00:00 committed by GitHub
parent 5ce6f32265
commit 0f264d64aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 132 additions and 17 deletions

10
Entitlements.plist Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
</dict>
</plist>

31
Info.plist.template Normal file
View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Amiberry Info.plist template file -->
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>LONGVERSION</string>
<key>CFBundleExecutable</key>
<string>amiberry</string>
<key>CFBundleIdentifier</key>
<string>com.midwan.amiberry</string>
<key>CFBundleName</key>
<string>Amiberry.app</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundleIconFile</key>
<string>docs/resources/icon.png</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>CFBundleShortVersionString</key>
<string>VERSION</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>MAJOR</integer>
<key>IFMinorVersion</key>
<integer>MINOR</integer>
</dict>
</plist>

45
conf/amiberry-osx.conf Normal file
View file

@ -0,0 +1,45 @@
path=USERDIR/Documents/Amiberry
config_path=USERDIR/Documents/Amiberry/Configurations
controllers_path=USERDIR/Documents/Amiberry/Controllers
logfile_path=USERDIR/Documents/Amiberry/amiberry.log
rom_path=USERDIR/Documents/Amiberry/Kickstarts/
retroarch_config=USERDIR/Documents/Amiberry/Configurations/retroarch.cfg
read_config_descriptions=yes
write_logfile=no
default_line_mode=0
rctrl_as_ramiga=no
gui_joystick_control=yes
use_sdl2_render_thread=no
input_default_mouse_speed=100
input_keyboard_as_joystick_stop_keypresses=no
default_open_gui_key=F12
default_quit_key=
default_ar_key=Pause
default_fullscreen_toggle_key=
rotation_angle=0
default_horizontal_centering=no
default_vertical_centering=no
default_scaling_method=-1
default_frameskip=no
default_correct_aspect_ratio=yes
default_auto_height=no
default_width=720
default_height=568
default_fullscreen_mode=0
default_stereo_separation=7
default_sound_buffer=8192
default_sound_pull=yes
default_joystick_deadzone=33
default_retroarch_quit=yes
default_retroarch_menu=yes
default_retroarch_reset=no
default_controller1=joy0
default_controller2=joy1
default_controller3=
default_controller4=
default_mouse1=mouse
default_mouse2=joy0
default_whd_buttonwait=no
default_whd_showsplash=yes
default_whd_configdelay=0
disable_shutdown_button=no

View file

@ -1,7 +1,7 @@
TARGET = lib/libguisan.a
DYLIB_TARGET = dylib/libguisan.dylib
AR = ar
ARARGS = cr
DIRS =$(shell find ./src -maxdepth 3 -type d)
SOURCE = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.cpp))
@ -10,11 +10,10 @@ DEPS = $(SOURCE:%.cpp=%.d)
ifeq ($(PLATFORM),osx)
# Create DYLIB on OS X
TARGET=dylib/libguisan.dylib
LDFLAGS += -lsdl2 -no_branch_islands
DYLIB=$(CXX) -dynamiclib -std=c++14 -install_name libguisan.dylib -fvisibility=hidden -undefined dynamic_lookup -o $(DYLIB_TARGET) $(OBJS)
CXX=/usr/bin/c++
else
DYLIB=
AR=$(CXX) -dynamiclib -std=c++14 -install_name libguisan.dylib -fvisibility=hidden -undefined dynamic_lookup -o
ARARGS=
endif
CPPFLAGS +=-I./include $(SDL_CFLAGS) -MD -MT $@ -MF $(@:%.o=%.d)
@ -22,8 +21,7 @@ CPPFLAGS +=-I./include $(SDL_CFLAGS) -MD -MT $@ -MF $(@:%.o=%.d)
.PHONY : all clean
$(TARGET) : $(OBJS)
$(AR) cr $(TARGET) $(OBJS)
$(DYLIB)
$(AR) $(ARARGS) $(TARGET) $(OBJS)
all : $(TARGET)

0
external/libguisan/dylib/.gitignore vendored Normal file
View file

View file

@ -35,9 +35,14 @@ cp -R kickstarts Amiberry.app/Contents/Resources
# Overwrite default conf with OSX specific one
mkdir Amiberry.app/Contents/resources/conf
cat conf/amiberry-osx.conf | sed -e "s#USERDIR#$USERDIR#g" >Amiberry.app/Contents/Resources/conf/amiberry.conf
# Use dylibbundler to install into app if exists
dylibbundler -od -b -x Amiberry.app/Contents/MacOS/Amiberry -d Amiberry.app/Contents/libs/ -s external/libguisan/dylib/
if [ $? -gt 0 ]; then
echo "Can't find dylibbundler, use brew to install it, or manually copy external/libguisan/dylib/libguisan.dylib into /usr/local/lib (you'll need sudo)"
fi
# Create application directories
mkdir -p ~/Documents/Amiberry/Hard\ Drives ~/Documents/Amiberry/Configurations ~/Documents/Amiberry/Controllers ~/Documents/Amibery/Logfiles ~Documents/Amiberry/Kickstarts ~Documents/Amiberry/RP9 ~/Documents/Amiberry/Data/Floppy_Sounds ~/Documents/Amiberry/Savestates ~/Documents/Amiberry/Screenshots ~/Documents/Amiberry/Docs
mkdir -p ~/Documents/Amiberry/Hard\ Drives ~/Documents/Amiberry/Configurations ~/Documents/Amiberry/Controllers ~/Documents/Amiberry/Logfiles ~/Documents/Amiberry/Kickstarts ~/Documents/Amiberry/RP9 ~/Documents/Amiberry/Data/Floppy_Sounds ~/Documents/Amiberry/Savestates ~/Documents/Amiberry/Screenshots ~/Documents/Amiberry/Docs
# Copy files to their destination
cp -a conf/* ~/Documents/Amiberry/Configurations

View file

@ -36,7 +36,8 @@ static const DEVPROPKEY DEVPKEY_Device_InstanceId2 = { {0x78c34fc8, 0x104a, 0x4a
DEFINE_GUID(GUID_DEVINTERFACE_COMPORT,0x86e0d1e0, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
#endif
#else
// OS X, sigurbjornl, 20220208
#elif defined __MACH__
#include <sys/stat.h>
#include <dirent.h>
@ -45,6 +46,20 @@ DEFINE_GUID(GUID_DEVINTERFACE_COMPORT,0x86e0d1e0, 0x8089, 0x11d0, 0x9c, 0xe4, 0x
#include <sys/ioctl.h>
#include <errno.h>
#include <cstring>
#include <term.h>
#include <sys/termios.h>
#include <sys/ioctl.h>
#include <IOKit/serial/ioss.h>
#ifndef TIOCINQ
#ifdef FIONREAD
#define TIOCINQ FIONREAD
#else
#define TIOCINQ 0x541B
#endif
#endif
#else
#include <linux/serial.h>
#endif
@ -627,10 +642,10 @@ SerialIO::Response SerialIO::configurePort(const Configuration& configuration) {
#ifdef __APPLE__
if (ioctl(m_portHandle, IOSSIOSPEED, &baud) == -1) return Response::rUnknownError;
#else
if (baud == 9600) {
term.c_cflag &= ~CBAUD;
term.c_cflag |= B9600;
} else {
if (baud == 9600) {
term.c_cflag &= ~CBAUD;
term.c_cflag |= B9600;
} else {
#if defined(BOTHER) && defined(HAVE_STRUCT_TERMIOS2)
term.c_cflag &= ~CBAUD;
term.c_cflag |= BOTHER;
@ -642,8 +657,8 @@ if (baud == 9600) {
term.c_cflag |= CBAUDEX;
if (cfsetspeed(&term, baud) < 0) return Response::rUnknownError;
#endif
}
#endif
}
// Apply that nonsense
tcflush (m_portHandle, TCIFLUSH);
if (tcsetattr(m_portHandle, TCSANOW, &term) != 0) return Response::rUnknownError;
@ -902,4 +917,4 @@ void SerialIO::setWriteTimeouts(unsigned int waitTimetimeout, unsigned int multi
m_writeTimeoutMultiplier = multiplier;
updateTimeouts();
}
}

View file

@ -151,4 +151,4 @@ public:
};
#endif
#endif

View file

@ -470,9 +470,15 @@ void RefreshPanelCPU()
chkCPUCycleExact->setSelected(changed_prefs.cpu_cycle_exact > 0);
chkCPUCycleExact->setEnabled(changed_prefs.cpu_model <= 68010);
// Make JIT not selectable with OS X for now, sigurbjornl, 20220208
#ifndef __MACH__
chkJIT->setEnabled(changed_prefs.cpu_model >= 68020);
chkJIT->setSelected(changed_prefs.cachesize > 0);
#else
chkJIT->setEnabled(false);
chkJIT->setSelected(false);
#endif
switch (changed_prefs.fpu_model)
{
@ -502,6 +508,11 @@ void RefreshPanelCPU()
chkFPUJIT->setSelected(false);
chkFPUJIT->setEnabled(false);
#endif
// Make FPU JIT not selectable with OS X for now, sigurbjornl, 20220208
#ifdef __MACH__
chkFPUJIT->setSelected(false);
chkFPUJIT->setEnabled(false);
#endif
if (changed_prefs.m68k_speed == M68K_SPEED_7MHZ_CYCLES)
opt7Mhz->setSelected(true);