Skip to content

Commit

Permalink
[readline] readline port builds for MacOS (#22000)
Browse files Browse the repository at this point in the history
* [readline] New readline-osx port for MacOS

* Bump port-version of readline and fix version database.

* Remove unnecessary -D_CRT_SECURE_NO_WARNINGS.

Co-authored-by: Billy Robert O'Neal III <[email protected]>
  • Loading branch information
zekoz and BillyONeal authored Dec 29, 2021
1 parent 9502b20 commit 7862c10
Show file tree
Hide file tree
Showing 8 changed files with 429 additions and 2 deletions.
60 changes: 60 additions & 0 deletions ports/readline-osx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required(VERSION 3.0)
project(readline C)

add_definitions(-DREADLINE_LIBRARY)
add_definitions(-DHAVE_CONFIG_H)

if(BUILD_SHARED_LIBS)
add_definitions(-DBUILD_READLINE_DLL)
else()
add_definitions(-DREADLINE_STATIC)
endif()

include_directories(
${CMAKE_CURRENT_SOURCE_DIR} # thats where the config.h is located
)

add_library(
readline
readline.c
funmap.c
keymaps.c
vi_mode.c
parens.c
rltty.c
complete.c
bind.c
colors.c
isearch.c
display.c
signals.c
util.c
kill.c
undo.c
macro.c
input.c
callback.c
terminal.c
xmalloc.c
history.c
histsearch.c
histexpand.c
histfile.c
nls.c
parse-colors.c
search.c
shell.c
savestring.c
tilde.c
text.c
misc.c
compat.c
mbutil.c
xfree.c
support/wcwidth.c)

install(
TARGETS readline
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
303 changes: 303 additions & 0 deletions ports/readline-osx/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Maintained by hand. */

/* Template definitions for autoconf */
#define __EXTENSIONS__ 1
#define _ALL_SOURCE 1
#define _GNU_SOURCE 1
/* #undef _POSIX_SOURCE */
/* #undef _POSIX_1_SOURCE */
#define _POSIX_PTHREAD_SEMANTICS 1
#define _TANDEM_SOURCE 1
/* #undef _MINIX */

/* Define NO_MULTIBYTE_SUPPORT to not compile in support for multibyte
characters, even if the OS supports them. */
/* #undef NO_MULTIBYTE_SUPPORT */

/* #undef _FILE_OFFSET_BITS */

/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void

#define VOID_SIGHANDLER 1

/* Characteristics of the compiler. */
/* #undef sig_atomic_t */

/* #undef size_t */

/* #undef ssize_t */

/* #undef const */

/* #undef volatile */

#define PROTOTYPES 1
#define __PROTOTYPES 1

/* #undef __CHAR_UNSIGNED__ */

/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */

/* Define if you have the chown function. */
#define HAVE_CHOWN 1

/* Define if you have the fcntl function. */
#define HAVE_FCNTL 1

/* Define if you have the fnmatch function. */
#define HAVE_FNMATCH 1

/* Define if you have the getpwent function. */
#define HAVE_GETPWENT 1

/* Define if you have the getpwnam function. */
#define HAVE_GETPWNAM 1

/* Define if you have the getpwuid function. */
#define HAVE_GETPWUID 1

/* Define if you have the isascii function. */
#define HAVE_ISASCII 1

/* Define if you have the iswctype function. */
#define HAVE_ISWCTYPE 1

/* Define if you have the iswlower function. */
#define HAVE_ISWLOWER 1

/* Define if you have the iswupper function. */
#define HAVE_ISWUPPER 1

/* Define if you have the isxdigit function. */
#define HAVE_ISXDIGIT 1

/* Define if you have the kill function. */
#define HAVE_KILL 1

/* Define if you have the lstat function. */
#define HAVE_LSTAT 1

/* Define if you have the mbrlen function. */
#define HAVE_MBRLEN 1

/* Define if you have the mbrtowc function. */
#define HAVE_MBRTOWC 1

/* Define if you have the mbsrtowcs function. */
#define HAVE_MBSRTOWCS 1

/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1

/* Define if you have the pselect function. */
#define HAVE_PSELECT 1

/* Define if you have the putenv function. */
#define HAVE_PUTENV 1

/* Define if you have the readlink function. */
#define HAVE_READLINK 1

/* Define if you have the select function. */
#define HAVE_SELECT 1

/* Define if you have the setenv function. */
#define HAVE_SETENV 1

/* Define if you have the setlocale function. */
#define HAVE_SETLOCALE 1

/* Define if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1

/* Define if you have the strcoll function. */
#define HAVE_STRCOLL 1

/* #undef STRCOLL_BROKEN */

/* Define if you have the strpbrk function. */
#define HAVE_STRPBRK 1

/* Define if you have the tcgetattr function. */
#define HAVE_TCGETATTR 1

/* Define if you have the towlower function. */
#define HAVE_TOWLOWER 1

/* Define if you have the towupper function. */
#define HAVE_TOWUPPER 1

/* Define if you have the vsnprintf function. */
#define HAVE_VSNPRINTF 1

/* Define if you have the wcrtomb function. */
#define HAVE_WCRTOMB 1

/* Define if you have the wcscoll function. */
#define HAVE_WCSCOLL 1

/* Define if you have the wctype function. */
#define HAVE_WCTYPE 1

/* Define if you have the wcwidth function. */
#define HAVE_WCWIDTH 1

/* and whether it works */
/* #undef WCWIDTH_BROKEN */

#define STDC_HEADERS 1

/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1

/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1

/* Define if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1

/* Define if you have the <libaudit.h> header file. */
/* #undef HAVE_LIBAUDIT_H */

/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1

/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1

/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */

/* Define if you have the <ncurses/termcap.h> header file. */
/* #undef HAVE_NCURSES_TERMCAP_H */

/* Define if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1

/* Define if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1

/* Define if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1

/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define if you have the <sys/dir.h> header file. */
/* #undef HAVE_SYS_DIR_H */

/* Define if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1

/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1

/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */

/* Define if you have the <sys/pte.h> header file. */
/* #undef HAVE_SYS_PTE_H */

/* Define if you have the <sys/ptem.h> header file. */
/* #undef HAVE_SYS_PTEM_H */

/* Define if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1

/* Define if you have the <sys/stream.h> header file. */
/* #undef HAVE_SYS_STREAM_H */

/* Define if you have the <termcap.h> header file. */
#define HAVE_TERMCAP_H 1

/* Define if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */

/* Define if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1

/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define if you have the <varargs.h> header file. */
/* #undef HAVE_VARARGS_H */

/* Define if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1

/* Define if you have the <wctype.h> header file. */
#define HAVE_WCTYPE_H 1

#define HAVE_MBSTATE_T 1

/* Define if you have wchar_t in <wctype.h>. */
#define HAVE_WCHAR_T 1

/* Define if you have wctype_t in <wctype.h>. */
#define HAVE_WCTYPE_T 1

/* Define if you have wint_t in <wctype.h>. */
#define HAVE_WINT_T 1

/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#define HAVE_LANGINFO_CODESET 1

/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */
#define HAVE_DECL_AUDIT_USER_TTY 0

/* Definitions pulled in from aclocal.m4. */
#define VOID_SIGHANDLER 1

/* #undef GWINSZ_IN_SYS_IOCTL */

#define STRUCT_WINSIZE_IN_SYS_IOCTL 1

/* #undef STRUCT_WINSIZE_IN_TERMIOS */

#define TIOCSTAT_IN_SYS_IOCTL 1

#define FIONREAD_IN_SYS_IOCTL 1

/* #undef SPEED_T_IN_SYS_TYPES */

#define HAVE_GETPW_DECLS 1

#define HAVE_STRUCT_DIRENT_D_INO 1

#define HAVE_STRUCT_DIRENT_D_FILENO 1

/* #undef HAVE_STRUCT_DIRENT_D_NAMLEN */

/* #undef HAVE_BSD_SIGNALS */

#define HAVE_POSIX_SIGNALS 1

/* #undef HAVE_USG_SIGHOLD */

/* #undef MUST_REINSTALL_SIGHANDLERS */

#define HAVE_POSIX_SIGSETJMP 1

#define CTYPE_NON_ASCII 1

/* modify settings or make new ones based on what autoconf tells us. */

/* Ultrix botches type-ahead when switching from canonical to
non-canonical mode, at least through version 4.3 */
#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix)
# define TERMIOS_MISSING
#endif

/* VARARGS defines moved to rlstdc.h */
26 changes: 26 additions & 0 deletions ports/readline-osx/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
vcpkg_download_distfile(
ARCHIVE
URLS https://ftp.gnu.org/gnu/readline/readline-8.1.tar.gz
FILENAME readline-8.1.tar.gz
SHA512 27790d0461da3093a7fee6e89a51dcab5dc61928ec42e9228ab36493b17220641d5e481ea3d8fee5ee0044c70bf960f55c7d3f1a704cf6b9c42e5c269b797e00
)

vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}")

file(
COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt"
DESTINATION "${SOURCE_PATH}")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h" DESTINATION "${SOURCE_PATH}")

vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")

vcpkg_cmake_install()

file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include/readline")
file(GLOB headers "${SOURCE_PATH}/*.h")
file(COPY ${headers} DESTINATION "${CURRENT_PACKAGES_DIR}/include/readline")

file(
INSTALL "${SOURCE_PATH}/COPYING"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
RENAME copyright)
Loading

0 comments on commit 7862c10

Please sign in to comment.