Fix build on OSX/Archlinux and add README

- remove SELinux dependency for now
- OSX: find libintl.h
- OSX: fix compile errors
- OSX: use hack around gettext nonsense
- fix gettext on ubuntu
- work around Arch's lack of -ltermcap
- add README.md
This commit is contained in:
aph 2014-01-31 18:10:18 +00:00 committed by Thiago de Arruda
parent 72cf89bce8
commit 2d00ead2e5
10 changed files with 81 additions and 42 deletions

26
README.md Normal file
View File

@ -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

View File

@ -1,9 +1,21 @@
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 <libintl.h>
int main(int argc, char** argv) {
gettext(\"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"

View File

@ -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
@ -61,7 +59,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
@ -82,11 +81,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
@ -96,7 +97,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
@ -115,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

View File

@ -14,5 +14,20 @@ 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)
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")

View File

@ -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).
*/

View File

@ -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"},

View File

@ -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

View File

@ -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,

View File

@ -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;

View File

@ -336,22 +336,22 @@ 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 <libintl.h>
# define _(x) gettext((char *)(x))
// XXX do we actually need this?
# ifdef gettext_noop
# define N_(x) gettext_noop(x)
# define N_(x) gettext_noop(x)
# else
# define N_(x) x
# define N_(x) x
# endif
#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()