diff --git a/ports/readline/CMakeLists.txt b/ports/readline/CMakeLists.txt new file mode 100644 index 000000000..7a2e403da --- /dev/null +++ b/ports/readline/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.0) +project(readline C) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(LIB_SUFFIX d) +endif() + +add_definitions(-DREADLINE_LIBRARY) +add_definitions(-DBUILD_READLINE_DLL) +add_definitions(-DHAVE_CONFIG_H) +add_definitions(-D_CRT_SECURE_NO_WARNINGS) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + add_definitions(-D_DEBUG) +endif() + +add_definitions(-D_WINDOWS) +add_definitions(-D_USRDLL) +add_definitions(-DREADLINE_EXPORTS) + +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 + 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 + search.c + shell.c + savestring.c + tilde.c + text.c + misc.c + compat.c + mbutil.c + support/wcwidth.c) + +install(TARGETS readline + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/ports/readline/CONTROL b/ports/readline/CONTROL new file mode 100644 index 000000000..669e1da12 --- /dev/null +++ b/ports/readline/CONTROL @@ -0,0 +1,3 @@ +Source: readline +Version: 5.0-1 +Description: GNU readline \ No newline at end of file diff --git a/ports/readline/config.h b/ports/readline/config.h new file mode 100644 index 000000000..de0a352fe --- /dev/null +++ b/ports/readline/config.h @@ -0,0 +1,58 @@ +#define RETSIGTYPE void +#define VOID_SIGHANDLER 1 +#define PROTOTYPES 1 +#define HAVE_ISASCII 1 +#define HAVE_ISXDIGIT 1 +#define HAVE_MBRLEN 1 +#define HAVE_MBRTOWC 1 +#define HAVE_MBRTOWC 1 +#define HAVE_MBSRTOWCS 1 +#define HAVE_MEMMOVE 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_SETLOCALE 1 +#define HAVE_STRCOLL 1 +#define STRCOLL_BROKEN 1 +#define HAVE_STRPBRK 1 +#define HAVE_TCGETATTR 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_WCTOMB 1 +#define HAVE_WCWIDTH 1 +#define STDC_HEADERS 1 +#define HAVE_LANGINFO_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WCTYPE_H 1 +#define HAVE_MBSTATE_T 1 +#define HAVE_LANGINFO_CODESET 1 +#define VOID_SIGHANDLER 1 +#define STRUCT_WINSIZE_IN_SYS_IOCTL 1 +#define HAVE_GETPW_DECLS 1 +#define MUST_REINSTALL_SIGHANDLERS 1 +#define CTYPE_NON_ASCII 1 + +/* 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 + +#if defined (STRCOLL_BROKEN) +# define HAVE_STRCOLL 1 +#endif + +#if defined (__STDC__) && defined (HAVE_STDARG_H) +# define PREFER_STDARG +# define USE_VARARGS +#else +# if defined (HAVE_VARARGS_H) +# define PREFER_VARARGS +# define USE_VARARGS +# endif +#endif diff --git a/ports/readline/portfile.cmake b/ports/readline/portfile.cmake new file mode 100644 index 000000000..24114c059 --- /dev/null +++ b/ports/readline/portfile.cmake @@ -0,0 +1,48 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/readline-vs/src/readline/5.0/readline-5.0-src) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/lltcggie/readline/archive/vs.zip" + FILENAME "readline-5.0-1-src.zip" + SHA512 c67908b9c868aa611a48dfc4db43718169cbdc6784107beb22cd1a4d28f0c4aa88f30cae0839a530c481c74173e1d7a2bf0000596099ed9b940c05c9dc7d5ebc +) + +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h DESTINATION ${SOURCE_PATH}) + +if(VCPKG_CRT_LINKAGE STREQUAL static) + set(LIBVPX_CRT_LINKAGE --enable-static-msvcrt) + set(LIBVPX_CRT_SUFFIX mt) +else() + set(LIBVPX_CRT_SUFFIX md) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA) + +vcpkg_install_cmake() + +# Copy headers +file (MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/include/readline) + +file(GLOB headers "${SOURCE_PATH}/*.h") +file(COPY ${headers} DESTINATION ${CURRENT_PACKAGES_DIR}/include/readline) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/readline RENAME copyright)