diff --git a/docs/maintainers/vcpkg_build_make.md b/docs/maintainers/vcpkg_build_make.md index 5161ba3ce69d1c..0c665ed6f78acf 100644 --- a/docs/maintainers/vcpkg_build_make.md +++ b/docs/maintainers/vcpkg_build_make.md @@ -4,9 +4,36 @@ Build a linux makefile project. ## Usage: ```cmake -vcpkg_build_make([TARGET ]) +vcpkg_build_make( + [MAKE_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] + [MAKE_OPTIONS_RELEASE <-DOPTIMIZE=1>...] + [MAKE_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] + [MAKE_INSTALL_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] + [MAKE_INSTALL_OPTIONS_RELEASE <-DOPTIMIZE=1>...] + [MAKE_INSTALL_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] + [TARGET ] +) ``` +## Parameters: +### MAKE_OPTIONS +Additional options passed to make during the generation. + +### MAKE_OPTIONS_RELEASE +Additional options passed to make during the Release generation. These are in addition to `MAKE_OPTIONS`. + +### MAKE_OPTIONS_DEBUG +Additional options passed to make during the Debug generation. These are in addition to `MAKE_OPTIONS`. + +### MAKE_INSTALL_OPTIONS +Additional options passed to make during the installation. + +### MAKE_INSTALL_OPTIONS_RELEASE +Additional options passed to make during the Release installation. These are in addition to `MAKE_INSTALL_OPTIONS`. + +### MAKE_INSTALL_OPTIONS_DEBUG +Additional options passed to make during the Debug installation. These are in addition to `MAKE_INSTALL_OPTIONS`. + ### TARGET The target passed to the configure/make build command (`./configure/make/make install`). If not specified, no target will be passed. @@ -16,15 +43,16 @@ Adds the appropriate Release and Debug `bin\` directories to the path during the ## Notes: This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md). -You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the +You can use the alias [`vcpkg_install_make()`](vcpkg_install_make.md) function if your CMake script supports the "install" target ## Examples +* [luajit](https://github.com/Microsoft/vcpkg/blob/master/ports/luajit/portfile.cmake) * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake) * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) ## Source -[scripts/cmake/vcpkg_build_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_build_make.cmake) +[scripts/cmake/vcpkg_build_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_build_make.cmake) diff --git a/docs/maintainers/vcpkg_configure_make.md b/docs/maintainers/vcpkg_configure_make.md index a18621794a544c..fb1033aad6f5b7 100644 --- a/docs/maintainers/vcpkg_configure_make.md +++ b/docs/maintainers/vcpkg_configure_make.md @@ -14,9 +14,9 @@ vcpkg_configure_make( [SKIP_CONFIGURE] [PROJECT_SUBPATH <${PROJ_SUBPATH}>] [PRERUN_SHELL <${SHELL_PATH}>] - [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] - [OPTIONS_RELEASE <-DOPTIMIZE=1>...] - [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] + [OPTIONS <--use-this-in-all-builds>...] + [OPTIONS_RELEASE <--optimize>...] + [OPTIONS_DEBUG <--debuggable>...] ) ``` @@ -69,10 +69,11 @@ This command supplies many common arguments to configure. To see the full list, ## Examples +* [luajit](https://github.com/Microsoft/vcpkg/blob/master/ports/luajit/portfile.cmake) * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake) * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) ## Source -[scripts/cmake/vcpkg_configure_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_configure_make.cmake) +[scripts/cmake/vcpkg_configure_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_configure_make.cmake) diff --git a/docs/maintainers/vcpkg_install_make.md b/docs/maintainers/vcpkg_install_make.md index 3460778cc9f372..3731556b9bd821 100644 --- a/docs/maintainers/vcpkg_install_make.md +++ b/docs/maintainers/vcpkg_install_make.md @@ -4,21 +4,45 @@ Build and install a make project. ## Usage: ```cmake -vcpkg_install_make(...) +vcpkg_install_make( + [MAKE_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] + [MAKE_OPTIONS_RELEASE <-DOPTIMIZE=1>...] + [MAKE_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] + [MAKE_INSTALL_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] + [MAKE_INSTALL_OPTIONS_RELEASE <-DOPTIMIZE=1>...] + [MAKE_INSTALL_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +) ``` ## Parameters: -See [`vcpkg_build_make()`](vcpkg_build_make.md). +### MAKE_OPTIONS +Additional options passed to make during the generation. + +### MAKE_OPTIONS_RELEASE +Additional options passed to make during the Release generation. These are in addition to `MAKE_OPTIONS`. + +### MAKE_OPTIONS_DEBUG +Additional options passed to make during the Debug generation. These are in addition to `MAKE_OPTIONS`. + +### MAKE_INSTALL_OPTIONS +Additional options passed to make during the installation. + +### MAKE_INSTALL_OPTIONS_RELEASE +Additional options passed to make during the Release installation. These are in addition to `MAKE_INSTALL_OPTIONS`. + +### MAKE_INSTALL_OPTIONS_DEBUG +Additional options passed to make during the Debug installation. These are in addition to `MAKE_INSTALL_OPTIONS`. ## Notes: This command transparently forwards to [`vcpkg_build_make()`](vcpkg_build_make.md), adding `ENABLE_INSTALL` ## Examples +* [luajit](https://github.com/Microsoft/vcpkg/blob/master/ports/luajit/portfile.cmake) * [x264](https://github.com/Microsoft/vcpkg/blob/master/ports/x264/portfile.cmake) * [tcl](https://github.com/Microsoft/vcpkg/blob/master/ports/tcl/portfile.cmake) * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) ## Source -[scripts/cmake/vcpkg_install_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_install_make.cmake) +[scripts/cmake/vcpkg_install_make.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_install_make.cmake) diff --git a/ports/freexl/portfile.cmake b/ports/freexl/portfile.cmake index 8253788371e95e..9f6d53279d6e26 100644 --- a/ports/freexl/portfile.cmake +++ b/ports/freexl/portfile.cmake @@ -1,4 +1,3 @@ -include(vcpkg_common_functions) set(FREEXL_VERSION_STR "1.0.4") vcpkg_download_distfile(ARCHIVE @@ -66,17 +65,7 @@ elseif (CMAKE_HOST_UNIX OR CMAKE_HOST_APPLE) # Build in UNIX ) vcpkg_configure_make( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS_DEBUG - INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}" - "LINK_FLAGS=/debug" - "CL_FLAGS=${CL_FLAGS_DBG}" - "LIBS_ALL=${LIBS_ALL_DBG}" - OPTIONS_RELEASE - INSTALLED_ROOT="${CURRENT_INSTALLED_DIR}" - "LINK_FLAGS=" - "CL_FLAGS=${CL_FLAGS_REL}" - "LIBS_ALL=${LIBS_ALL_REL}" + SOURCE_PATH ${SOURCE_PATH} ) vcpkg_install_make() diff --git a/ports/libdeflate/CONTROL b/ports/libdeflate/CONTROL new file mode 100644 index 00000000000000..970b620cc6a133 --- /dev/null +++ b/ports/libdeflate/CONTROL @@ -0,0 +1,4 @@ +Source: libdeflate +Version: 1.5 +Homepage: https://github.com/ebiggers/libdeflate +Description: Heavily optimized library for DEFLATE/zlib/gzip compression and decompression diff --git a/ports/libdeflate/makefile.patch b/ports/libdeflate/makefile.patch new file mode 100644 index 00000000000000..ee31befa385813 --- /dev/null +++ b/ports/libdeflate/makefile.patch @@ -0,0 +1,31 @@ +diff --git a/Makefile.msc b/Makefile.msc +index 901131d..00f0568 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -10,7 +10,7 @@ + CC = cl + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. -Icommon ++CFLAGS = $(CL_FLAGS) -I. -Icommon + LDFLAGS = + + STATIC_LIB = libdeflatestatic.lib +@@ -60,6 +60,14 @@ gunzip.exe:gzip.exe + copy $** $@ + + clean: +- -del *.dll *.exe *.exp libdeflate.lib libdeflatestatic.lib gzip.lib \ +- lib\*.obj lib\*\*.obj lib\*.dllobj lib\*\*.dllobj \ +- programs\*.obj 2>nul ++ -del /s /q *.dll *.exe *.exp libdeflate.lib libdeflatestatic.lib gzip.lib \ ++ lib\*.obj lib\*.dllobj \ ++ programs\*.obj ++ ++install: all ++ -xcopy /i /y "gzip.exe" "$(INSTALLDIR)/bin\" ++ -xcopy /i /y "gunzip.exe" "$(INSTALLDIR)/bin\" ++ -xcopy /i /y "$(SHARED_LIB)" "$(INSTALLDIR)/bin\" ++ -xcopy /i /y "$(STATIC_LIB)" "$(INSTALLDIR)/lib\" ++ -xcopy /i /y "$(IMPORT_LIB)" "$(INSTALLDIR)/lib\" ++ -xcopy /i /y "libdeflate.h" "$(INSTALLDIR)/include\" diff --git a/ports/libdeflate/portfile.cmake b/ports/libdeflate/portfile.cmake new file mode 100644 index 00000000000000..f7e555780a865d --- /dev/null +++ b/ports/libdeflate/portfile.cmake @@ -0,0 +1,74 @@ +vcpkg_fail_port_install(ON_TARGET "Linux" "UWP") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ebiggers/libdeflate + REF v1.5 + SHA512 8e86e87733bb1b2b2d4dda6ce0be96b57a125776c1f81804d5fc6f51516dd52796d9bb800ca4044c637963136ae390cfaf5cd804e9ae8b5d93d36853d0e807f6 + HEAD_REF master + PATCHES + makefile.patch +) + +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_install_nmake( + SOURCE_PATH ${SOURCE_PATH} + PROJECT_NAME Makefile.msc + ) + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + + file(COPY ${CURRENT_PACKAGES_DIR}/debug/bin/gzip.exe DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}) + file(COPY ${CURRENT_PACKAGES_DIR}/debug/bin/gunzip.exe DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}) + + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/gzip.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/gunzip.exe) + + if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libdeflatestatic.lib) + elseif (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libdeflate.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libdeflatestatic.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libdeflate.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/libdeflate.dll) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) + endif() + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(COPY ${CURRENT_PACKAGES_DIR}/bin/gzip.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) + file(COPY ${CURRENT_PACKAGES_DIR}/bin/gunzip.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) + + file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/gzip.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/gunzip.exe) + + if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libdeflatestatic.lib) + elseif (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libdeflate.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libdeflatestatic.lib ${CURRENT_PACKAGES_DIR}/lib/libdeflate.lib) + file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/libdeflate.dll) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + endif() + endif() +else() + vcpkg_configure_make( + SOURCE_PATH ${SOURCE_PATH} + SKIP_CONFIGURE + ) + + vcpkg_install_make( + MAKE_INSTALL_OPTIONS_DEBUG + "PREFIX=${CURRENT_PACKAGES_DIR}/debug" + "BINDIR=${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}" + MAKE_INSTALL_OPTIONS_RELEASE + "PREFIX=${CURRENT_PACKAGES_DIR}" + "BINDIR=${CURRENT_PACKAGES_DIR}/tools/${PORT}" + ) + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + endif() +endif() + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/luajit/003-fix-macos-catalina.patch b/ports/luajit/003-fix-macos-catalina.patch new file mode 100644 index 00000000000000..af6957dadd773a --- /dev/null +++ b/ports/luajit/003-fix-macos-catalina.patch @@ -0,0 +1,410 @@ +--- a/src/lj_alloc.c ++++ b/src/lj_alloc.c +@@ -72,13 +72,56 @@ + + #define IS_DIRECT_BIT (SIZE_T_ONE) + ++ ++/* Determine system-specific block allocation method. */ + #if LJ_TARGET_WINDOWS + + #define WIN32_LEAN_AND_MEAN + #include + ++#define LJ_ALLOC_VIRTUALALLOC 1 ++ ++#if LJ_64 && !LJ_GC64 ++#define LJ_ALLOC_NTAVM 1 ++#endif ++ ++#else ++ ++#include ++/* If this include fails, then rebuild with: -DLUAJIT_USE_SYSMALLOC */ ++#include ++ ++#define LJ_ALLOC_MMAP 1 ++ + #if LJ_64 + ++#define LJ_ALLOC_MMAP_PROBE 1 ++ ++#if LJ_GC64 ++#define LJ_ALLOC_MBITS 47 /* 128 TB in LJ_GC64 mode. */ ++#elif LJ_TARGET_X64 && LJ_HASJIT ++/* Due to limitations in the x64 compiler backend. */ ++#define LJ_ALLOC_MBITS 31 /* 2 GB on x64 with !LJ_GC64. */ ++#else ++#define LJ_ALLOC_MBITS 32 /* 4 GB on other archs with !LJ_GC64. */ ++#endif ++ ++#endif ++ ++#if LJ_64 && !LJ_GC64 && defined(MAP_32BIT) ++#define LJ_ALLOC_MMAP32 1 ++#endif ++ ++#if LJ_TARGET_LINUX ++#define LJ_ALLOC_MREMAP 1 ++#endif ++ ++#endif ++ ++ ++#if LJ_ALLOC_VIRTUALALLOC ++ ++#if LJ_ALLOC_NTAVM + /* Undocumented, but hey, that's what we all love so much about Windows. */ + typedef long (*PNTAVM)(HANDLE handle, void **addr, ULONG zbits, + size_t *size, ULONG alloctype, ULONG prot); +@@ -89,14 +132,15 @@ + */ + #define NTAVM_ZEROBITS 1 + +-static void INIT_MMAP(void) ++static void init_mmap(void) + { + ntavm = (PNTAVM)GetProcAddress(GetModuleHandleA("ntdll.dll"), + "NtAllocateVirtualMemory"); + } ++#define INIT_MMAP() init_mmap() + + /* Win64 32 bit MMAP via NtAllocateVirtualMemory. */ +-static LJ_AINLINE void *CALL_MMAP(size_t size) ++static void *CALL_MMAP(size_t size) + { + DWORD olderr = GetLastError(); + void *ptr = NULL; +@@ -107,7 +151,7 @@ + } + + /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ +-static LJ_AINLINE void *DIRECT_MMAP(size_t size) ++static void *DIRECT_MMAP(size_t size) + { + DWORD olderr = GetLastError(); + void *ptr = NULL; +@@ -119,23 +163,21 @@ + + #else + +-#define INIT_MMAP() ((void)0) +- + /* Win32 MMAP via VirtualAlloc */ +-static LJ_AINLINE void *CALL_MMAP(size_t size) ++static void *CALL_MMAP(size_t size) + { + DWORD olderr = GetLastError(); +- void *ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); ++ void *ptr = LJ_WIN_VALLOC(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + SetLastError(olderr); + return ptr ? ptr : MFAIL; + } + + /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ +-static LJ_AINLINE void *DIRECT_MMAP(size_t size) ++static void *DIRECT_MMAP(size_t size) + { + DWORD olderr = GetLastError(); +- void *ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, +- PAGE_READWRITE); ++ void *ptr = LJ_WIN_VALLOC(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, ++ PAGE_READWRITE); + SetLastError(olderr); + return ptr ? ptr : MFAIL; + } +@@ -143,7 +185,7 @@ + #endif + + /* This function supports releasing coalesed segments */ +-static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size) ++static int CALL_MUNMAP(void *ptr, size_t size) + { + DWORD olderr = GetLastError(); + MEMORY_BASIC_INFORMATION minfo; +@@ -163,10 +205,7 @@ + return 0; + } + +-#else +- +-#include +-#include ++#elif LJ_ALLOC_MMAP + + #define MMAP_PROT (PROT_READ|PROT_WRITE) + #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +@@ -174,105 +213,152 @@ + #endif + #define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) + +-#if LJ_64 +-/* 64 bit mode needs special support for allocating memory in the lower 2GB. */ +- +-#if defined(MAP_32BIT) +- +-#if defined(__sun__) +-#define MMAP_REGION_START ((uintptr_t)0x1000) ++#if LJ_ALLOC_MMAP_PROBE ++ ++#ifdef MAP_TRYFIXED ++#define MMAP_FLAGS_PROBE (MMAP_FLAGS|MAP_TRYFIXED) + #else +-/* Actually this only gives us max. 1GB in current Linux kernels. */ +-#define MMAP_REGION_START ((uintptr_t)0) +-#endif +- +-static LJ_AINLINE void *CALL_MMAP(size_t size) +-{ ++#define MMAP_FLAGS_PROBE MMAP_FLAGS ++#endif ++ ++#define LJ_ALLOC_MMAP_PROBE_MAX 30 ++#define LJ_ALLOC_MMAP_PROBE_LINEAR 5 ++ ++#define LJ_ALLOC_MMAP_PROBE_LOWER ((uintptr_t)0x4000) ++ ++/* No point in a giant ifdef mess. Just try to open /dev/urandom. ++** It doesn't really matter if this fails, since we get some ASLR bits from ++** every unsuitable allocation, too. And we prefer linear allocation, anyway. ++*/ ++#include ++#include ++ ++static uintptr_t mmap_probe_seed(void) ++{ ++ uintptr_t val; ++ int fd = open("/dev/urandom", O_RDONLY); ++ if (fd != -1) { ++ int ok = ((size_t)read(fd, &val, sizeof(val)) == sizeof(val)); ++ (void)close(fd); ++ if (ok) return val; ++ } ++ return 1; /* Punt. */ ++} ++ ++static void *mmap_probe(size_t size) ++{ ++ /* Hint for next allocation. Doesn't need to be thread-safe. */ ++ static uintptr_t hint_addr = 0; ++ static uintptr_t hint_prng = 0; + int olderr = errno; +- void *ptr = mmap((void *)MMAP_REGION_START, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0); +- errno = olderr; +- return ptr; +-} +- +-#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) || LJ_TARGET_CYGWIN +- +-/* OSX and FreeBSD mmap() use a naive first-fit linear search. +-** That's perfect for us. Except that -pagezero_size must be set for OSX, +-** otherwise the lower 4GB are blocked. And the 32GB RLIMIT_DATA needs +-** to be reduced to 250MB on FreeBSD. +-*/ +-#if LJ_TARGET_OSX || defined(__DragonFly__) +-#define MMAP_REGION_START ((uintptr_t)0x10000) +-#elif LJ_TARGET_PS4 +-#define MMAP_REGION_START ((uintptr_t)0x4000) +-#else +-#define MMAP_REGION_START ((uintptr_t)0x10000000) +-#endif +-#define MMAP_REGION_END ((uintptr_t)0x80000000) +- +-#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4 +-#include +-#endif +- +-static LJ_AINLINE void *CALL_MMAP(size_t size) +-{ +- int olderr = errno; +- /* Hint for next allocation. Doesn't need to be thread-safe. */ +- static uintptr_t alloc_hint = MMAP_REGION_START; +- int retry = 0; +-#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4 +- static int rlimit_modified = 0; +- if (LJ_UNLIKELY(rlimit_modified == 0)) { +- struct rlimit rlim; +- rlim.rlim_cur = rlim.rlim_max = MMAP_REGION_START; +- setrlimit(RLIMIT_DATA, &rlim); /* Ignore result. May fail below. */ +- rlimit_modified = 1; +- } +-#endif +- for (;;) { +- void *p = mmap((void *)alloc_hint, size, MMAP_PROT, MMAP_FLAGS, -1, 0); +- if ((uintptr_t)p >= MMAP_REGION_START && +- (uintptr_t)p + size < MMAP_REGION_END) { +- alloc_hint = (uintptr_t)p + size; ++ int retry; ++ for (retry = 0; retry < LJ_ALLOC_MMAP_PROBE_MAX; retry++) { ++ void *p = mmap((void *)hint_addr, size, MMAP_PROT, MMAP_FLAGS_PROBE, -1, 0); ++ uintptr_t addr = (uintptr_t)p; ++ if ((addr >> LJ_ALLOC_MBITS) == 0 && addr >= LJ_ALLOC_MMAP_PROBE_LOWER && ++ ((addr + size) >> LJ_ALLOC_MBITS) == 0) { ++ /* We got a suitable address. Bump the hint address. */ ++ hint_addr = addr + size; + errno = olderr; + return p; + } +- if (p != CMFAIL) munmap(p, size); +-#if defined(__sun__) || defined(__DragonFly__) +- alloc_hint += 0x1000000; /* Need near-exhaustive linear scan. */ +- if (alloc_hint + size < MMAP_REGION_END) continue; +-#endif +- if (retry) break; +- retry = 1; +- alloc_hint = MMAP_REGION_START; ++ if (p != MFAIL) { ++ munmap(p, size); ++ } else if (errno == ENOMEM) { ++ return MFAIL; ++ } ++ if (hint_addr) { ++ /* First, try linear probing. */ ++ if (retry < LJ_ALLOC_MMAP_PROBE_LINEAR) { ++ hint_addr += 0x1000000; ++ if (((hint_addr + size) >> LJ_ALLOC_MBITS) != 0) ++ hint_addr = 0; ++ continue; ++ } else if (retry == LJ_ALLOC_MMAP_PROBE_LINEAR) { ++ /* Next, try a no-hint probe to get back an ASLR address. */ ++ hint_addr = 0; ++ continue; ++ } ++ } ++ /* Finally, try pseudo-random probing. */ ++ if (LJ_UNLIKELY(hint_prng == 0)) { ++ hint_prng = mmap_probe_seed(); ++ } ++ /* The unsuitable address we got has some ASLR PRNG bits. */ ++ hint_addr ^= addr & ~((uintptr_t)(LJ_PAGESIZE-1)); ++ do { /* The PRNG itself is very weak, but see above. */ ++ hint_prng = hint_prng * 1103515245 + 12345; ++ hint_addr ^= hint_prng * (uintptr_t)LJ_PAGESIZE; ++ hint_addr &= (((uintptr_t)1 << LJ_ALLOC_MBITS)-1); ++ } while (hint_addr < LJ_ALLOC_MMAP_PROBE_LOWER); + } + errno = olderr; +- return CMFAIL; +-} +- ++ return MFAIL; ++} ++ ++#endif ++ ++#if LJ_ALLOC_MMAP32 ++ ++#if defined(__sun__) ++#define LJ_ALLOC_MMAP32_START ((uintptr_t)0x1000) + #else +- +-#error "NYI: need an equivalent of MAP_32BIT for this 64 bit OS" +- +-#endif +- ++#define LJ_ALLOC_MMAP32_START ((uintptr_t)0) ++#endif ++ ++static void *mmap_map32(size_t size) ++{ ++#if LJ_ALLOC_MMAP_PROBE ++ static int fallback = 0; ++ if (fallback) ++ return mmap_probe(size); ++#endif ++ { ++ int olderr = errno; ++ void *ptr = mmap((void *)LJ_ALLOC_MMAP32_START, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0); ++ errno = olderr; ++ /* This only allows 1GB on Linux. So fallback to probing to get 2GB. */ ++#if LJ_ALLOC_MMAP_PROBE ++ if (ptr == MFAIL) { ++ fallback = 1; ++ return mmap_probe(size); ++ } ++#endif ++ return ptr; ++ } ++} ++ ++#endif ++ ++#if LJ_ALLOC_MMAP32 ++#define CALL_MMAP(size) mmap_map32(size) ++#elif LJ_ALLOC_MMAP_PROBE ++#define CALL_MMAP(size) mmap_probe(size) + #else +- +-/* 32 bit mode is easy. */ +-static LJ_AINLINE void *CALL_MMAP(size_t size) ++static void *CALL_MMAP(size_t size) + { + int olderr = errno; + void *ptr = mmap(NULL, size, MMAP_PROT, MMAP_FLAGS, -1, 0); + errno = olderr; + return ptr; + } +- +-#endif +- +-#define INIT_MMAP() ((void)0) +-#define DIRECT_MMAP(s) CALL_MMAP(s) +- +-static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size) ++#endif ++ ++#if LJ_64 && !LJ_GC64 && ((defined(__FreeBSD__) && __FreeBSD__ < 10) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4 ++ ++#include ++ ++static void init_mmap(void) ++{ ++ struct rlimit rlim; ++ rlim.rlim_cur = rlim.rlim_max = 0x10000; ++ setrlimit(RLIMIT_DATA, &rlim); /* Ignore result. May fail later. */ ++} ++#define INIT_MMAP() init_mmap() ++ ++#endif ++ ++static int CALL_MUNMAP(void *ptr, size_t size) + { + int olderr = errno; + int ret = munmap(ptr, size); +@@ -280,10 +366,9 @@ + return ret; + } + +-#if LJ_TARGET_LINUX ++#if LJ_ALLOC_MREMAP + /* Need to define _GNU_SOURCE to get the mremap prototype. */ +-static LJ_AINLINE void *CALL_MREMAP_(void *ptr, size_t osz, size_t nsz, +- int flags) ++static void *CALL_MREMAP_(void *ptr, size_t osz, size_t nsz, int flags) + { + int olderr = errno; + ptr = mremap(ptr, osz, nsz, flags); +@@ -294,13 +379,22 @@ + #define CALL_MREMAP(addr, osz, nsz, mv) CALL_MREMAP_((addr), (osz), (nsz), (mv)) + #define CALL_MREMAP_NOMOVE 0 + #define CALL_MREMAP_MAYMOVE 1 +-#if LJ_64 ++#if LJ_64 && !LJ_GC64 + #define CALL_MREMAP_MV CALL_MREMAP_NOMOVE + #else + #define CALL_MREMAP_MV CALL_MREMAP_MAYMOVE + #endif + #endif + ++#endif ++ ++ ++#ifndef INIT_MMAP ++#define INIT_MMAP() ((void)0) ++#endif ++ ++#ifndef DIRECT_MMAP ++#define DIRECT_MMAP(s) CALL_MMAP(s) + #endif + + #ifndef CALL_MREMAP diff --git a/ports/luajit/CONTROL b/ports/luajit/CONTROL index 9b02c5b2bf67df..03b778e9a8a2bb 100644 --- a/ports/luajit/CONTROL +++ b/ports/luajit/CONTROL @@ -1,4 +1,4 @@ Source: luajit -Version: 2.0.5-2 +Version: 2.0.5-3 Homepage: https://github.com/LuaJIT/LuaJIT Description: LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. diff --git a/ports/luajit/portfile.cmake b/ports/luajit/portfile.cmake index dff84bfcbd77ca..7356a4c9232841 100644 --- a/ports/luajit/portfile.cmake +++ b/ports/luajit/portfile.cmake @@ -13,63 +13,91 @@ vcpkg_from_github( PATCHES 001-fixStaticBuild.patch 002-fix-build-path.patch + 003-fix-macos-catalina.patch # https://github.com/Homebrew/homebrew-core/pull/46928 ) -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set (LJIT_STATIC "") -else() - set (LJIT_STATIC "static") -endif() - -if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL debug) - message(STATUS "Building ${TARGET_TRIPLET}-dbg") - file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") - file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") - - vcpkg_execute_required_process_repeat( - COUNT 1 - COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${SOURCE_PATH}/src debug ${LJIT_STATIC} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" - LOGNAME build-${TARGET_TRIPLET}-dbg - ) - - file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/luajit.exe DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools) - file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) - +if (VCPKG_TARGET_IS_WINDOWS) if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + set (LJIT_STATIC "") + else() + set (LJIT_STATIC "static") endif() - vcpkg_copy_pdbs() -endif() + if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL debug) + message(STATUS "Building ${TARGET_TRIPLET}-dbg") + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") + + vcpkg_execute_required_process_repeat( + COUNT 1 + COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${SOURCE_PATH}/src debug ${LJIT_STATIC} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" + LOGNAME build-${TARGET_TRIPLET}-dbg + ) + + file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/luajit.exe DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools) + file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lua51.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + endif() + vcpkg_copy_pdbs() + endif() -if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL release) - message(STATUS "Building ${TARGET_TRIPLET}-rel") - file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") - file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") - - vcpkg_execute_required_process_repeat(d8un - COUNT 1 - COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${SOURCE_PATH}/src ${LJIT_STATIC} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" - LOGNAME build-${TARGET_TRIPLET}-rel - ) - - file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/luajit.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) - file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) - - if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + + if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL release) + message(STATUS "Building ${TARGET_TRIPLET}-rel") + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") + + vcpkg_execute_required_process_repeat(d8un + COUNT 1 + COMMAND "${SOURCE_PATH}/src/msvcbuild.bat" ${SOURCE_PATH}/src ${LJIT_STATIC} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" + LOGNAME build-${TARGET_TRIPLET}-rel + ) + + file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/luajit.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) + file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lua51.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + endif() + vcpkg_copy_pdbs() endif() - vcpkg_copy_pdbs() -endif() -file(INSTALL ${SOURCE_PATH}/src/lua.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) -file(INSTALL ${SOURCE_PATH}/src/luajit.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) -file(INSTALL ${SOURCE_PATH}/src/luaconf.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) -file(INSTALL ${SOURCE_PATH}/src/lualib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) -file(INSTALL ${SOURCE_PATH}/src/lauxlib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) -file(INSTALL ${SOURCE_PATH}/src/lua.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) + file(INSTALL ${SOURCE_PATH}/src/lua.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) + file(INSTALL ${SOURCE_PATH}/src/luajit.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) + file(INSTALL ${SOURCE_PATH}/src/luaconf.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) + file(INSTALL ${SOURCE_PATH}/src/lualib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) + file(INSTALL ${SOURCE_PATH}/src/lauxlib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) + file(INSTALL ${SOURCE_PATH}/src/lua.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT}) +else() + vcpkg_configure_make( + SOURCE_PATH ${SOURCE_PATH} + SKIP_CONFIGURE + ) + + vcpkg_install_make( + MAKE_OPTIONS + MACOSX_DEPLOYMENT_TARGET=10.6 # https://github.com/LuaJIT/LuaJIT/issues/484 + MAKE_INSTALL_OPTIONS_RELEASE + "PREFIX=${CURRENT_PACKAGES_DIR}" + "INSTALL_BIN=${CURRENT_PACKAGES_DIR}/tools/${PORT}" + "INSTALL_INC=${CURRENT_PACKAGES_DIR}/include/${PORT}" + MAKE_INSTALL_OPTIONS_DEBUG + "PREFIX=${CURRENT_PACKAGES_DIR}/debug" + "INSTALL_BIN=${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}" + ) + + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + + # Delete empty directories + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/lua) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/lua) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/lua) +endif() # Handle copyright file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) \ No newline at end of file diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 64969ecb59f393..232e49c0c0596e 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -706,6 +706,9 @@ libcopp:arm-uwp=fail libcopp:x64-windows-static=fail libdatrie:x64-linux=fail libdatrie:x64-osx=fail +libdeflate:x64-linux=fail +libdeflate:x64-uwp=fail +libdeflate:arm-uwp=fail libdisasm:arm-uwp=fail libdisasm:x64-uwp=fail libdshowcapture:arm64-windows=fail @@ -984,7 +987,6 @@ luafilesystem:x64-osx=fail luajit:arm64-windows = skip luajit:arm-uwp = skip luajit:x64-linux = skip -luajit:x64-osx = skip luajit:x64-uwp = skip luajit:x64-windows = skip luajit:x64-windows-static = skip diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake index 202ef33f41c293..8451ac4e10953c 100644 --- a/scripts/cmake/vcpkg_build_make.cmake +++ b/scripts/cmake/vcpkg_build_make.cmake @@ -4,9 +4,35 @@ ## ## ## Usage: ## ```cmake -## vcpkg_build_make([TARGET ]) +## vcpkg_build_make( +## [MAKE_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [MAKE_OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [MAKE_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## [MAKE_INSTALL_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [MAKE_INSTALL_OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [MAKE_INSTALL_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## [TARGET ]) ## ``` ## +## ## Parameters +## ### MAKE_OPTIONS +## Additional options passed to make during the generation. +## +## ### MAKE_OPTIONS_RELEASE +## Additional options passed to make during the Release generation. These are in addition to `MAKE_OPTIONS`. +## +## ### MAKE_OPTIONS_DEBUG +## Additional options passed to make during the Debug generation. These are in addition to `MAKE_OPTIONS`. +## +## ### MAKE_INSTALL_OPTIONS +## Additional options passed to make during the installation. +## +## ### MAKE_INSTALL_OPTIONS_RELEASE +## Additional options passed to make during the Release installation. These are in addition to `MAKE_INSTALL_OPTIONS`. +## +## ### MAKE_INSTALL_OPTIONS_DEBUG +## Additional options passed to make during the Debug installation. These are in addition to `MAKE_INSTALL_OPTIONS`. +## ## ### TARGET ## The target passed to the configure/make build command (`./configure/make/make install`). If not specified, no target will ## be passed. @@ -16,7 +42,7 @@ ## ## ## Notes: ## This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md). -## You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the +## You can use the alias [`vcpkg_install_make()`](vcpkg_install_make.md) function if your CMake script supports the ## "install" target ## ## ## Examples @@ -26,7 +52,12 @@ ## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake) ## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) function(vcpkg_build_make) - cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT" "" ${ARGN}) + cmake_parse_arguments(_bc + "ADD_BIN_TO_PATH;ENABLE_INSTALL" + "LOGFILE_ROOT" + "MAKE_OPTIONS;MAKE_OPTIONS_DEBUG;MAKE_OPTIONS_RELEASE;MAKE_INSTALL_OPTIONS;MAKE_INSTALL_OPTIONS_DEBUG;MAKE_INSTALL_OPTIONS_RELEASE" + ${ARGN} + ) if(NOT _bc_LOGFILE_ROOT) set(_bc_LOGFILE_ROOT "build") @@ -37,8 +68,8 @@ function(vcpkg_build_make) endif() set(MAKE ) - set(MAKE_OPTS ) - set(INSTALL_OPTS ) + set(MAKE_OPTS_BASE ) + set(INSTALL_OPTS_BASE ) if (_VCPKG_MAKE_GENERATOR STREQUAL "make") if (CMAKE_HOST_WIN32) # Compiler requriements @@ -54,15 +85,15 @@ function(vcpkg_build_make) # Set make command and install command set(MAKE ${BASH} --noprofile --norc -c "${_VCPKG_PROJECT_SUBPATH}make") # Must use absolute path to call make in windows - set(MAKE_OPTS -j ${VCPKG_CONCURRENCY}) - set(INSTALL_OPTS install -j ${VCPKG_CONCURRENCY}) + set(MAKE_OPTS_BASE -j ${VCPKG_CONCURRENCY} ${_bc_MAKE_OPTIONS}) + set(INSTALL_OPTS_BASE install -j ${VCPKG_CONCURRENCY} ${_bc_MAKE_INSTALL_OPTIONS}) else() # Compiler requriements find_program(MAKE make REQUIRED) set(MAKE make;) # Set make command and install command - set(MAKE_OPTS -j;${VCPKG_CONCURRENCY}) - set(INSTALL_OPTS install;-j;${VCPKG_CONCURRENCY}) + set(MAKE_OPTS_BASE -j;${VCPKG_CONCURRENCY};${_bc_MAKE_OPTIONS}) + set(INSTALL_OPTS_BASE install;-j;${VCPKG_CONCURRENCY};${_bc_MAKE_INSTALL_OPTIONS}) endif() elseif (_VCPKG_MAKE_GENERATOR STREQUAL "nmake") find_program(NMAKE nmake REQUIRED) @@ -72,8 +103,8 @@ function(vcpkg_build_make) set(ENV{CL} "$ENV{CL} /MP") # Set make command and install command set(MAKE ${NMAKE} /NOLOGO /G /U) - set(MAKE_OPTS -f makefile all) - set(INSTALL_OPTS install) + set(MAKE_OPTS_BASE -f makefile all ${_bc_MAKE_OPTIONS}) + set(INSTALL_OPTS_BASE install ${_bc_MAKE_INSTALL_OPTIONS}) else() message(FATAL_ERROR "${_VCPKG_MAKE_GENERATOR} not supported.") endif() @@ -82,12 +113,15 @@ function(vcpkg_build_make) foreach(BUILDTYPE "debug" "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) + set(MAKE_OPTS ${MAKE_OPTS_BASE}) if(BUILDTYPE STREQUAL "debug") # Skip debug generate if (_VCPKG_NO_DEBUG) continue() endif() set(SHORT_BUILDTYPE "-dbg") + # Add options + list(APPEND MAKE_OPTS ${_bc_MAKE_OPTIONS_DEBUG}) else() # In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory. if (_VCPKG_NO_DEBUG) @@ -95,6 +129,8 @@ function(vcpkg_build_make) else() set(SHORT_BUILDTYPE "-rel") endif() + # Add options + list(APPEND MAKE_OPTS ${_bc_MAKE_OPTIONS_RELEASE}) endif() if (CMAKE_HOST_WIN32) @@ -143,12 +179,15 @@ function(vcpkg_build_make) if (_bc_ENABLE_INSTALL) foreach(BUILDTYPE "debug" "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) + set(INSTALL_OPTS ${INSTALL_OPTS_BASE}) if(BUILDTYPE STREQUAL "debug") # Skip debug generate if (_VCPKG_NO_DEBUG) continue() endif() set(SHORT_BUILDTYPE "-dbg") + # Add options + list(APPEND INSTALL_OPTS ${_bc_MAKE_INSTALL_OPTIONS_DEBUG}) else() # In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory. if (_VCPKG_NO_DEBUG) @@ -156,6 +195,8 @@ function(vcpkg_build_make) else() set(SHORT_BUILDTYPE "-rel") endif() + # Add options + list(APPEND INSTALL_OPTS ${_bc_MAKE_INSTALL_OPTIONS_RELEASE}) endif() message(STATUS "Installing ${TARGET_TRIPLET}${SHORT_BUILDTYPE}") diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index 1a691a9458c280..530805b574e221 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -14,9 +14,9 @@ ## [SKIP_CONFIGURE] ## [PROJECT_SUBPATH <${PROJ_SUBPATH}>] ## [PRERUN_SHELL <${SHELL_PATH}>] -## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] -## [OPTIONS_RELEASE <-DOPTIMIZE=1>...] -## [OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## [OPTIONS <--use-this-in-all-builds>...] +## [OPTIONS_RELEASE <--optimize>...] +## [OPTIONS_DEBUG <--debuggable>...] ## ) ## ``` ## diff --git a/scripts/cmake/vcpkg_install_make.cmake b/scripts/cmake/vcpkg_install_make.cmake index 1672d7c5a51249..702a5da84ed032 100644 --- a/scripts/cmake/vcpkg_install_make.cmake +++ b/scripts/cmake/vcpkg_install_make.cmake @@ -4,11 +4,33 @@ ## ## ## Usage: ## ```cmake -## vcpkg_install_make(...) +## vcpkg_install_make( +## [MAKE_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [MAKE_OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [MAKE_OPTIONS_DEBUG <-DDEBUGGABLE=1>...] +## [MAKE_INSTALL_OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] +## [MAKE_INSTALL_OPTIONS_RELEASE <-DOPTIMIZE=1>...] +## [MAKE_INSTALL_OPTIONS_DEBUG <-DDEBUGGABLE=1>...]) ## ``` ## ## ## Parameters: -## See [`vcpkg_build_make()`](vcpkg_build_make.md). +## ### MAKE_OPTIONS +## Additional options passed to make during the generation. +## +## ### MAKE_OPTIONS_RELEASE +## Additional options passed to make during the Release generation. These are in addition to `MAKE_OPTIONS`. +## +## ### MAKE_OPTIONS_DEBUG +## Additional options passed to make during the Debug generation. These are in addition to `MAKE_OPTIONS`. +## +## ### MAKE_INSTALL_OPTIONS +## Additional options passed to make during the installation. +## +## ### MAKE_INSTALL_OPTIONS_RELEASE +## Additional options passed to make during the Release installation. These are in addition to `MAKE_INSTALL_OPTIONS`. +## +## ### MAKE_INSTALL_OPTIONS_DEBUG +## Additional options passed to make during the Debug installation. These are in addition to `MAKE_INSTALL_OPTIONS`. ## ## ## Notes: ## This command transparently forwards to [`vcpkg_build_make()`](vcpkg_build_make.md), adding `ENABLE_INSTALL` @@ -21,5 +43,19 @@ ## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake) function(vcpkg_install_make) - vcpkg_build_make(LOGFILE_ROOT ENABLE_INSTALL) + cmake_parse_arguments(_ic + "" + "" + "MAKE_OPTIONS;MAKE_OPTIONS_DEBUG;MAKE_OPTIONS_RELEASE;MAKE_INSTALL_OPTIONS;MAKE_INSTALL_OPTIONS_DEBUG;MAKE_INSTALL_OPTIONS_RELEASE" + ${ARGN} + ) + + vcpkg_build_make(LOGFILE_ROOT ENABLE_INSTALL + MAKE_OPTIONS ${_ic_MAKE_OPTIONS} + MAKE_OPTIONS_RELEASE ${_ic_MAKE_OPTIONS_RELEASE} + MAKE_OPTIONS_DEBUG ${_ic_MAKE_OPTIONS_DEBUG} + MAKE_INSTALL_OPTIONS ${_ic_MAKE_INSTALL_OPTIONS} + MAKE_INSTALL_OPTIONS_RELEASE ${_ic_MAKE_INSTALL_OPTIONS_RELEASE} + MAKE_INSTALL_OPTIONS_DEBUG ${_ic_MAKE_INSTALL_OPTIONS_DEBUG} + ) endfunction()