uobikiemukot / yaskk

yet another skk for terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OSX対応

saitoha opened this issue · comments

Mac環境では以下の修正をしてビルドしました

diff --git a/common.h b/common.h
index 030af58..cb65f79 100644
--- a/common.h
+++ b/common.h
@@ -2,8 +2,13 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <ctype.h>
-#include <pty.h>
-#include <signal.h>
+++ b/common.h
@@ -2,8 +2,13 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <ctype.h>
-#include <pty.h>
-#include <signal.h>
+#if defined(__APPLE__)
+#  include <sys/ioctl.h>
+#  include <util.h>
+#  define SIGWINCH 28
+#else
+#  include <pty.h>
+#endif
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/makefile b/makefile
index 514f697..04b7655 100644
--- a/makefile
+++ b/makefile
@@ -1,6 +1,6 @@
 CC = gcc
 CFLAGS = -Wall -std=c99 -pedantic \
-       -march=native -Os -pipe -Wall
+      -Os -pipe -Wall
        #-march=native -Ofast -flto -pipe -s
        #-pg -g -rdynamic
 LDFLAGS =

ご報告ありがとうございます.

c9e26fa
にて以下の修正をしました

-makefileの-march=nativeを削除
-common.hのincludeするヘッダからpty.hを削除・sys/ioctl.hを追加

Mac OS Xだとsignal.hがなくてSIGWINCHを自分で定義する必要があるのでしょうか?

うごくようになりました。ありがとうございます。
SIGWINCHは適当にやっただけなのでもっときれいなやり方がありそうです。

a959cb0
にてSIGWINCHが定義されない問題を修正しました.

原因は#define _XOPEN_SOURCE 600としたときに,_POSIX_C_SOURCE 20112Lが暗黙のうちに指定され,
_POSIX_C_SOURCEが定義されている場合にはSIGWINCHが定義されなくなってしまうためでした.(/usr/include/sys/signal.hを参照)
makefileでOSの判別をして,Darwinの場合には_DARWIN_C_SOURCEを定義するようにしました.