From 102c2c073fc195b0f990c765a1e6a7cab53e3ce9 Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 18:10:18 +0000 Subject: [PATCH 1/7] remove SELinux dependency for now --- config/config.h.in | 3 ++- src/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/config.h.in b/config/config.h.in index 6606c78c87f125..8a7b555865f3e0 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -61,7 +61,8 @@ #define HAVE_READLINK 1 #define HAVE_RENAME 1 #define HAVE_SELECT 1 -#define HAVE_SELINUX 1 +// TODO: add proper cmake check +// #define HAVE_SELINUX 1 #define HAVE_SETENV 1 #define HAVE_SETJMP_H 1 #define HAVE_SETPGID 1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65138a6d5de514..37986df1f0b382 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,5 +14,5 @@ file( GLOB IO_SOURCES io/*.c ) add_executable (vim ${NEOVIM_SOURCES} ${IO_SOURCES}) -target_link_libraries (vim m termcap selinux) +target_link_libraries (vim m termcap) include_directories ("${PROJECT_SOURCE_DIR}/src/proto") From 3a71cacb41fbc99ab87c831d4bfe6f2a24e2416e Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 18:46:34 +0000 Subject: [PATCH 2/7] OSX: find libintl.h --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37986df1f0b382..e776a8ee04e71f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,3 +16,9 @@ add_executable (vim ${NEOVIM_SOURCES} ${IO_SOURCES}) target_link_libraries (vim m termcap) include_directories ("${PROJECT_SOURCE_DIR}/src/proto") + +find_path(LIBINTL_INCLUDE_DIR NAMES libintl.h) + +if (LIBINTL_INCLUDE_DIR) + include_directories("${LIBINTL_INCLUDE_DIR}") +endif() From 4e4e10ec2c608dfcf01c2456096ed3407f650635 Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 19:03:17 +0000 Subject: [PATCH 3/7] OSX: fix compile errors --- config/config.h.in | 9 ++++++--- src/os_unix.c | 8 -------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/config/config.h.in b/config/config.h.in index 8a7b555865f3e0..c5664b5578cd06 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -83,11 +83,13 @@ #define HAVE_STRING_H 1 #define HAVE_STRINGS_H 1 #define HAVE_STRNCASECMP 1 -#define HAVE_STROPTS_H 1 +// TODO: add proper cmake check +// #define HAVE_STROPTS_H 1 #define HAVE_STRPBRK 1 #define HAVE_STRTOL 1 #define HAVE_SVR4_PTYS 1 -#define HAVE_SYSCONF 1 +// TODO: add proper cmake check +// #define HAVE_SYSCONF 1 #define HAVE_SYSINFO 1 #define HAVE_SYSINFO_MEM_UNIT 1 #define HAVE_SYS_IOCTL_H 1 @@ -97,7 +99,8 @@ #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_STATFS_H 1 #define HAVE_SYS_SYSCTL_H 1 -#define HAVE_SYS_SYSINFO_H 1 +// TODO: add proper cmake check +// #define HAVE_SYS_SYSINFO_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_UTSNAME_H 1 diff --git a/src/os_unix.c b/src/os_unix.c index 83a65cf9b5252d..cf50cfb28e37eb 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -623,14 +623,6 @@ static char *signal_stack; static void init_signal_stack() { if (signal_stack != NULL) { # ifdef HAVE_SIGALTSTACK -# if defined(__APPLE__) && (!defined(MAC_OS_X_VERSION_MAX_ALLOWED) \ - || MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) - /* missing prototype. Adding it to osdef?.h.in doesn't work, because - * "struct sigaltstack" needs to be declared. */ - extern int sigaltstack __ARGS((const struct sigaltstack *ss, - struct sigaltstack *oss)); -# endif - sigstk.ss_sp = signal_stack; sigstk.ss_size = SIGSTKSZ; sigstk.ss_flags = 0; From c985822a87960dfb46a9eb6e9d73737499390096 Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 22:35:37 +0000 Subject: [PATCH 4/7] OSX: hack around gettext nonsense --- config/CMakeLists.txt | 13 +++++++++++++ config/config.h.in | 3 +-- src/CMakeLists.txt | 6 ------ src/ex_cmds2.c | 9 ++------- src/ex_docmd.c | 9 +++------ src/ex_getln.c | 3 +-- src/mbyte.c | 2 +- src/vim.h | 23 +++++++++-------------- 8 files changed, 30 insertions(+), 38 deletions(-) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 3d9fd04c25a9be..1a1744c8c4d844 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -1,9 +1,22 @@ include(CheckTypeSize) +include(CheckCSourceCompiles) + check_type_size("int" SIZEOF_INT) check_type_size("long" SIZEOF_LONG) check_type_size("time_t" SIZEOF_TIME_T) check_type_size("off_t" SIZEOF_OFF_T) +check_c_source_compiles(" +#include + +int main(int argc, char** argv) { + gettext(\"foo\"); + gettext_noop(\"foo\"); + bindtextdomain(\"foo\", \"bar\"); + bind_textdomain_codeset(\"foo\", \"bar\"); + textdomain(\"foo\"); +}" HAVE_WORKING_LIBINTL) + # generate configuration header and update include directories configure_file ( "${PROJECT_SOURCE_DIR}/config/config.h.in" diff --git a/config/config.h.in b/config/config.h.in index c5664b5578cd06..60729562af5131 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -14,7 +14,6 @@ #define _FILE_OFFSET_BITS 64 #define HAVE_ATTRIBUTE_UNUSED 1 #define HAVE_BCMP 1 -#define HAVE_BIND_TEXTDOMAIN_CODESET 1 #define HAVE_DATE_TIME 1 #define HAVE_DIRENT_H 1 #define HAVE_DLFCN_H 1 @@ -33,7 +32,6 @@ #define HAVE_GETPWNAM 1 #define HAVE_GETPWUID 1 #define HAVE_GETRLIMIT 1 -#define HAVE_GETTEXT 1 #define HAVE_GETTIMEOFDAY 1 #define HAVE_GETWD 1 #define HAVE_ICONV 1 @@ -119,6 +117,7 @@ #define HAVE_UTIMES 1 #define HAVE_WCHAR_H 1 #define HAVE_WCTYPE_H 1 +#cmakedefine HAVE_WORKING_LIBINTL #define RETSIGTYPE void #define SIGRETURN return #define SYS_SELECT_WITH_SYS_TIME 1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e776a8ee04e71f..37986df1f0b382 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,9 +16,3 @@ add_executable (vim ${NEOVIM_SOURCES} ${IO_SOURCES}) target_link_libraries (vim m termcap) include_directories ("${PROJECT_SOURCE_DIR}/src/proto") - -find_path(LIBINTL_INCLUDE_DIR NAMES libintl.h) - -if (LIBINTL_INCLUDE_DIR) - include_directories("${LIBINTL_INCLUDE_DIR}") -endif() diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 42ccf5a416a67f..0162031b75d709 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3349,11 +3349,7 @@ char_u * get_mess_lang() { } /* Complicated #if; matches with where get_mess_env() is used below. */ -#if (defined(FEAT_EVAL) && !((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && defined(LC_MESSAGES))) \ - || ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) \ - && !defined(LC_MESSAGES)) +#ifdef HAVE_WORKING_LIBINTL static char_u *get_mess_env __ARGS((void)); /* @@ -3411,8 +3407,7 @@ void set_lang_var() { set_vim_var_string(VV_LC_TIME, loc, -1); } -#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) +#ifdef HAVE_WORKING_LIBINTL /* * ":language": Set the language (locale). */ diff --git a/src/ex_docmd.c b/src/ex_docmd.c index d3d9c256beefb6..88fe8e1c5d3a97 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -206,8 +206,7 @@ static void ex_X __ARGS((exarg_T *eap)); static void ex_fold __ARGS((exarg_T *eap)); static void ex_foldopen __ARGS((exarg_T *eap)); static void ex_folddo __ARGS((exarg_T *eap)); -#if !((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))) +#ifndef HAVE_WORKING_LIBINTL # define ex_language ex_ni #endif # define ex_sign ex_ni @@ -3161,8 +3160,7 @@ char_u *buff; /* buffer for command string */ xp->xp_pattern = arg; break; -#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) +#ifdef HAVE_WORKING_LIBINTL case CMD_language: p = skiptowhite(arg); if (*p == NUL) { @@ -4452,8 +4450,7 @@ static struct { {EXPAND_HELP, "help"}, {EXPAND_HIGHLIGHT, "highlight"}, {EXPAND_HISTORY, "history"}, -#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) +#ifdef HAVE_WORKING_LIBINTL {EXPAND_LOCALES, "locale"}, #endif {EXPAND_MAPPINGS, "mapping"}, diff --git a/src/ex_getln.c b/src/ex_getln.c index ee9fc079fe36f5..dbef0a9449e346 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3783,8 +3783,7 @@ int options; /* EW_ flags */ {EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE}, {EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE}, {EXPAND_PROFILE, get_profile_name, TRUE, TRUE}, -#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ - && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) +#ifdef HAVE_WORKING_LIBINTL {EXPAND_LANGUAGE, get_lang_arg, TRUE, FALSE}, {EXPAND_LOCALES, get_locales, TRUE, FALSE}, #endif diff --git a/src/mbyte.c b/src/mbyte.c index 66f26826c49acd..8b7abe15eefbd3 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -612,7 +612,7 @@ char_u * mb_init() { set_string_option_direct((char_u *)"fencs", -1, (char_u *)"ucs-bom,utf-8,default,latin1", OPT_FREE, 0); -#if defined(HAVE_BIND_TEXTDOMAIN_CODESET) && defined(FEAT_GETTEXT) +#ifdef HAVE_WORKING_LIBINTL /* GNU gettext 0.10.37 supports this feature: set the codeset used for * translated messages independently from the current locale. */ (void)bind_textdomain_codeset(VIMPACKAGE, diff --git a/src/vim.h b/src/vim.h index 3095dbf54193b2..e25771aec675ef 100644 --- a/src/vim.h +++ b/src/vim.h @@ -336,22 +336,17 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ # define USE_IM_CONTROL #endif -/* - * For dynamically loaded gettext library. Currently, only for Win32. - */ - - -/* - * The _() stuff is for using gettext(). It is a no-op when libintl.h is not - * found or the +multilang feature is disabled. - */ +#ifdef HAVE_WORKING_LIBINTL # include # define _(x) gettext((char *)(x)) -# ifdef gettext_noop -# define N_(x) gettext_noop(x) -# else -# define N_(x) x -# endif +# define N_(x) gettext_noop(x) +#else +# define _(x) ((char *)(x)) +# define N_(x) x +# define bindtextdomain(x, y) /* empty */ +# define bind_textdomain_codeset(x, y) /* empty */ +# define textdomain(x) /* empty */ +#endif /* * flags for update_screen() From 0aae42ee043158f0a7a497fe621e012693fd4ee6 Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 22:48:17 +0000 Subject: [PATCH 5/7] fix gettext on ubuntu --- config/CMakeLists.txt | 1 - src/vim.h | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 1a1744c8c4d844..36ffb0c81067a8 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -11,7 +11,6 @@ check_c_source_compiles(" int main(int argc, char** argv) { gettext(\"foo\"); - gettext_noop(\"foo\"); bindtextdomain(\"foo\", \"bar\"); bind_textdomain_codeset(\"foo\", \"bar\"); textdomain(\"foo\"); diff --git a/src/vim.h b/src/vim.h index e25771aec675ef..93f66cf4380007 100644 --- a/src/vim.h +++ b/src/vim.h @@ -339,7 +339,12 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ #ifdef HAVE_WORKING_LIBINTL # include # define _(x) gettext((char *)(x)) -# define N_(x) gettext_noop(x) +// XXX do we actually need this? +# ifdef gettext_noop +# define N_(x) gettext_noop(x) +# else +# define N_(x) x +# endif #else # define _(x) ((char *)(x)) # define N_(x) x From 67c6c8dd3d130a12d74280d4fa43f45f56b2af5a Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 23:05:26 +0000 Subject: [PATCH 6/7] work around Arch's lack of -ltermcap --- src/CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37986df1f0b382..48aa9250fe2fa5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,5 +14,20 @@ file( GLOB IO_SOURCES io/*.c ) add_executable (vim ${NEOVIM_SOURCES} ${IO_SOURCES}) -target_link_libraries (vim m termcap) +target_link_libraries (vim m) + +include(CheckLibraryExists) +check_library_exists(termcap tgetent "" HAVE_LIBTERMCAP) + +if (HAVE_LIBTERMCAP) + target_link_libraries(vim termcap) +else() + check_library_exists(curses tgetent "" HAVE_LIBCURSES) + if (HAVE_LIBCURSES) + target_link_libraries(vim curses) + else() + message(FATAL_ERROR "can't find something resembling -ltermcap") + endif() +endif() + include_directories ("${PROJECT_SOURCE_DIR}/src/proto") From 6c5a9600302c3e3ffc72a5b04d9c0406bf383094 Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 31 Jan 2014 23:10:16 +0000 Subject: [PATCH 7/7] README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000000000..43a61e4e1bc558 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +Dependencies +============ + +For Ubuntu 12.04: + + sudo apt-get install build-essential cmake libncurses5-dev + +TODO: release the Dockerfile which has this in it + +TODO: Arch instructions + +TODO: OSX instructions + + +Building +======== + +To generate the `Makefile`s: + + make cmake + +To build and run the tests: + + make test + +