Skip to content

Commit

Permalink
Merge pull request #73 from ngwese/fix/macos-hang
Browse files Browse the repository at this point in the history
restore O_NONBLOCK, clean up macos ABI control
  • Loading branch information
tehn authored Mar 4, 2022
2 parents 19da968 + bb54384 commit 7b6c5b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/platform/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int monome_platform_open(monome_t *monome, const monome_devmap_t *m,
struct termios nt, ot;
int fd;

if( (fd = open(dev, O_RDWR | O_NOCTTY)) < 0 ) {
if( (fd = open(dev, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0 ) {
perror("libmonome: could not open monome device");
return 1;
}
Expand Down
9 changes: 6 additions & 3 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def options(opt):
default=False, help="Embed protos in the library")
lm_opts.add_option('--enable-mac-bundle', action='store_true',
default=False, help="look for protocol libraries in a Mac bundle's Frameworks directory")
lm_opts.add_option('--mac-version-min', type=str,
default=False, help="specify minimum macOS ABI version [optional]")

def configure(conf):
# just for output prettifying
Expand Down Expand Up @@ -181,9 +183,10 @@ def configure(conf):
conf.env.append_unique('CFLAGS', "-g")
conf.env.append_unique('LINKFLAGS', "-g")

if conf.env.DEST_OS == "darwin":
conf.env.append_unique("CFLAGS", ["-mmacosx-version-min=10.5"])
conf.env.append_unique("LINKFLAGS", ["-mmacosx-version-min=10.5"])
if conf.env.DEST_OS == "darwin" and conf.options.mac_version_min:
abi_version = "-mmacosx-version-min=" + conf.options.mac_version_min
conf.env.append_unique("CFLAGS", [abi_version])
conf.env.append_unique("LINKFLAGS", [abi_version])

if os.path.basename(conf.env.CC[0]) == "clang":
conf.env.append_unique("CFLAGS", ["-Wno-initializer-overrides"])
Expand Down

0 comments on commit 7b6c5b6

Please sign in to comment.