diff -Nru neko-2.1.0/CHANGES neko-2.2.0/CHANGES --- neko-2.1.0/CHANGES 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/CHANGES 2017-12-19 06:38:08.000000000 +0000 @@ -1,3 +1,23 @@ +2017-12-19 : 2.2.0 + nekotools : added `nekotools boot -c *.n`, which generates a C file that contains the input Neko bytecode (#130) + nekotools : fixed `nekotools boot` not able to find neko when a value in PATH does not have a trailing slash (#148) + cmake : recognize common install location variables by using GNUInstallDirs + cmake : fixed various build issues, particularly for FreeBSD (Thanks, ppenzin!), and cygwin + cmake : added NekoConfig.cmake to ease building ndll or native program using Neko with CMake + cmake : replaces WITH_NDLLS with WITH_* (#157) + cmake : does not recompile nekoc/nekoml unless RECOMPILE_NEKOC_NEKOML (#171) + all : added NEKO_MODULE_PATH in neko.h that points to the installation path of the ndll files + std : bugfix in utf8_compare (https://github.com/HaxeFoundation/haxe/issues/5308) + ssl : handle MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY (#150) + ssl : allow partial failure on loading certificates (#160) + mysql : use eof terminated string when appropriated (#159) + jit : disable jit for win64, which never worked + all : introduced NEKO_BIG_ENDIAN and NEKO_LITTLE_ENDIAN to replace IS_BIG_ENDIAN, IS_LITTLE_ENDIAN, LITTLE_ENDIAN, BIG_ENDIAN, and BYTE_ORDER + all : renamed TAG_BITS to NEKO_TAG_BITS + all : add NEKO_JIT_DISABLE and NEKO_JIT_DEBUG CMake options + all : VS2015 and 2017 compatiblity (#133 #172) + sqlite : fixed reading 32-bit int from sqlite (#167) + 2016-05-08 : 2.1.0 all : switched to use CMake for building (#122) mod_neko/tora : use remote_ip (fixes Apache 2.2 returning 0.0.0.0 in 64 bits ?) diff -Nru neko-2.1.0/cmake/FindAPACHE.cmake neko-2.2.0/cmake/FindAPACHE.cmake --- neko-2.1.0/cmake/FindAPACHE.cmake 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/cmake/FindAPACHE.cmake 2017-12-19 06:38:08.000000000 +0000 @@ -10,7 +10,13 @@ # find_path(APACHE_INCLUDE_DIR NAMES httpd.h - PATH_SUFFIXES httpd apache apache2 + PATH_SUFFIXES httpd apache apache2 apache22 apache24 +) + +set(HTTPD_NAMES ${HTTPD_NAMES} httpd) +find_library(HTTPD_LIBRARIES + NAMES ${HTTPD_NAMES} + PATHS /usr/lib /usr/local/lib ) if(NOT DEFINED APACHE_MODULE_DIR) @@ -29,4 +35,4 @@ # handle the QUIETLY and REQUIRED arguments and set APACHE_FOUND to TRUE if # all listed variables are TRUE find_package_handle_standard_args(APACHE DEFAULT_MSG APACHE_INCLUDE_DIR ) -mark_as_advanced(APACHE_INCLUDE_DIR) +mark_as_advanced(APACHE_INCLUDE_DIR HTTPD_LIBRARIES) diff -Nru neko-2.1.0/cmake/FindAPR.cmake neko-2.2.0/cmake/FindAPR.cmake --- neko-2.1.0/cmake/FindAPR.cmake 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/cmake/FindAPR.cmake 2017-12-19 06:38:08.000000000 +0000 @@ -27,21 +27,17 @@ # APR first. FIND_PATH(APR_INCLUDE_DIR apr.h -/usr/local/include/apr-1 -/usr/local/include/apr-1.0 -/usr/include/apr-1 -/usr/include/apr-1.0 + PATH_SUFFIXES apr-1 apr-1.0 ) SET(APR_NAMES ${APR_NAMES} apr-1) FIND_LIBRARY(APR_LIBRARY NAMES ${APR_NAMES} - PATHS /usr/lib /usr/local/lib - ) +) IF (APR_LIBRARY AND APR_INCLUDE_DIR) - SET(APR_LIBRARIES ${APR_LIBRARY}) - SET(APR_FOUND "YES") + SET(APR_LIBRARIES ${APR_LIBRARY}) + SET(APR_FOUND "YES") ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) SET(APR_FOUND "NO") ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) @@ -64,26 +60,22 @@ MARK_AS_ADVANCED( APR_LIBRARY APR_INCLUDE_DIR - ) +) # Next, APRUTIL. FIND_PATH(APRUTIL_INCLUDE_DIR apu.h -/usr/local/include/apr-1 -/usr/local/include/apr-1.0 -/usr/include/apr-1 -/usr/include/apr-1.0 + PATH_SUFFIXES apr-1 apr-1.0 ) SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1) FIND_LIBRARY(APRUTIL_LIBRARY NAMES ${APRUTIL_NAMES} - PATHS /usr/local/lib /usr/lib - ) +) IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) - SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) - SET(APRUTIL_FOUND "YES") + SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) + SET(APRUTIL_FOUND "YES") ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) SET(APRUTIL_FOUND "NO") ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) @@ -106,4 +98,4 @@ MARK_AS_ADVANCED( APRUTIL_LIBRARY APRUTIL_INCLUDE_DIR - ) \ No newline at end of file +) \ No newline at end of file diff -Nru neko-2.1.0/cmake/FindBoehmGC.cmake neko-2.2.0/cmake/FindBoehmGC.cmake --- neko-2.1.0/cmake/FindBoehmGC.cmake 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/cmake/FindBoehmGC.cmake 2017-12-19 06:38:08.000000000 +0000 @@ -1,10 +1,16 @@ find_path(GC_INCLUDE_DIR gc.h PATH_SUFFIXES include) -find_library(GC_STATIC_LIBRARIES libgc.a +if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(GC_NAME "gc-threaded") +else() + set(GC_NAME "gc") +endif() + +find_library(GC_STATIC_LIBRARIES "lib${GC_NAME}.a" PATH_SUFFIXES lib lib64) -find_library(GC_LIBRARIES gc +find_library(GC_LIBRARIES "${GC_NAME}" PATH_SUFFIXES lib lib64) if (NOT GC_LIBRARIES AND NOT GC_STATIC_LIBRARIES) @@ -23,4 +29,4 @@ GC_STATIC_LIBRARIES GC_STATIC GC_STATIC_FOUND -) \ No newline at end of file +) diff -Nru neko-2.1.0/cmake/flatten.cmake.in neko-2.2.0/cmake/flatten.cmake.in --- neko-2.1.0/cmake/flatten.cmake.in 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/cmake/flatten.cmake.in 2017-12-19 06:38:08.000000000 +0000 @@ -1,16 +1,31 @@ # Detect if the install is run by CPack. if (${CMAKE_INSTALL_PREFIX} MATCHES "/_CPack_Packages/.*/(TGZ|ZIP)/") # Flatten the directory structure such that everything except the header files is placed in root. - file(GLOB bin_files LIST_DIRECTORIES FALSE ${CMAKE_INSTALL_PREFIX}/bin/*) - file(GLOB lib_files LIST_DIRECTORIES FALSE ${CMAKE_INSTALL_PREFIX}/lib/* ${CMAKE_INSTALL_PREFIX}/lib/**/*) - foreach(file ${bin_files} ${lib_files}) - get_filename_component(file_name ${file} NAME) - execute_process( - COMMAND ${CMAKE_COMMAND} -E rename - ${file} - ${CMAKE_INSTALL_PREFIX}/${file_name} - ) - endforeach() + if (${CMAKE_VERSION} VERSION_LESS 3.3) + file(GLOB bin_files ${CMAKE_INSTALL_PREFIX}/bin/*) + file(GLOB lib_files ${CMAKE_INSTALL_PREFIX}/lib/* ${CMAKE_INSTALL_PREFIX}/lib/**/*) + foreach(file ${bin_files} ${lib_files}) + if (NOT IS_DIRECTORY ${file}) + get_filename_component(file_name ${file} NAME) + execute_process( + COMMAND ${CMAKE_COMMAND} -E rename + ${file} + ${CMAKE_INSTALL_PREFIX}/${file_name} + ) + endif() + endforeach() + else() + file(GLOB bin_files LIST_DIRECTORIES FALSE ${CMAKE_INSTALL_PREFIX}/bin/*) + file(GLOB lib_files LIST_DIRECTORIES FALSE ${CMAKE_INSTALL_PREFIX}/lib/* ${CMAKE_INSTALL_PREFIX}/lib/**/*) + foreach(file ${bin_files} ${lib_files}) + get_filename_component(file_name ${file} NAME) + execute_process( + COMMAND ${CMAKE_COMMAND} -E rename + ${file} + ${CMAKE_INSTALL_PREFIX}/${file_name} + ) + endforeach() + endif() execute_process( COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/bin) execute_process( COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/lib) diff -Nru neko-2.1.0/cmake/NekoConfig.cmake.in neko-2.2.0/cmake/NekoConfig.cmake.in --- neko-2.1.0/cmake/NekoConfig.cmake.in 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/cmake/NekoConfig.cmake.in 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,28 @@ +# - Config file for the Neko package +# It defines the following variables +# NEKO_INCLUDE_DIRS - include directories for Neko +# NEKO_LIBRARIES - libraries to link against +# NEKO_EXECUTABLE - the Neko VM executable +# NEKOC_EXECUTABLE - the Neko compiler executable +# NEKOML_EXECUTABLE - the NekoML compiler executable +# NEKOTOOLS_EXECUTABLE - the nekotools executable + +@PACKAGE_INIT@ + +# Our library dependencies (contains definitions for IMPORTED targets) +if(NOT TARGET neko) + include("@PACKAGE_NEKO_TARGETS_FILE@") +endif() + +# Use set instead of set_and_check, which doesn't handle lists properly +# https://gitlab.kitware.com/cmake/cmake/issues/16219 +set(NEKO_INCLUDE_DIRS "@PACKAGE_NEKO_INCLUDE_DIRS@") + +# These are IMPORTED targets created by NekoTargets.cmake +set(NEKO_LIBRARIES libneko) +set(NEKO_EXECUTABLE nekovm) +set(NEKOC_EXECUTABLE nekoc) +set(NEKOML_EXECUTABLE nekoml) +set(NEKOTOOLS_EXECUTABLE nekotools) + +check_required_components(Neko) diff -Nru neko-2.1.0/cmake/patch_openssl.cmake neko-2.2.0/cmake/patch_openssl.cmake --- neko-2.1.0/cmake/patch_openssl.cmake 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/cmake/patch_openssl.cmake 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,14 @@ +set(configure ${openssl_source}/Configure) + +file(READ ${configure} content) + +# Make it possible to disable building and running tests +# https://github.com/openssl/openssl/pull/1514/files +string(REPLACE + "my @disablables = \(" + "my @disablables = \( \"tests\"," + content "${content}" +) + + +file(WRITE ${configure} "${content}") \ No newline at end of file diff -Nru neko-2.1.0/cmake/upload_to_ppa.cmake neko-2.2.0/cmake/upload_to_ppa.cmake --- neko-2.1.0/cmake/upload_to_ppa.cmake 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/cmake/upload_to_ppa.cmake 2017-12-19 06:38:08.000000000 +0000 @@ -65,11 +65,11 @@ ) set(distros - precise trusty - vivid - wily xenial + zesty + artful + bionic ) if (DEFINED ENV{PPA}) diff -Nru neko-2.1.0/CMakeLists.txt neko-2.2.0/CMakeLists.txt --- neko-2.1.0/CMakeLists.txt 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -1,10 +1,19 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.12) -project(neko C) +include(GNUInstallDirs) +include(CheckCCompilerFlag) +include(CheckIncludeFile) +include(TestBigEndian) +project(Neko C) set(CMAKE_OSX_ARCHITECTURES x86_64) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + # FreeBSD puts all thirdparty libraries in /usr/local + link_directories(/usr/local/lib) +endif() + # put output in "bin" set(OUTPUT_DIR ${CMAKE_BINARY_DIR}/bin) @@ -21,51 +30,72 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTPUT_DIR} ) endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) -# target_include_directories for old cmake versions -if (${CMAKE_VERSION} VERSION_LESS 2.8.8) - function(target_include_directories target visibility) - include_directories(${ARGN}) - endfunction() -elseif (${CMAKE_VERSION} VERSION_LESS 2.8.11) - function(target_include_directories target visibility) - set_target_properties(${target} - PROPERTIES - INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES} ${ARGN}" - ) - endfunction() -endif() - -# add_compile_options for old cmake versions -if (${CMAKE_VERSION} VERSION_LESS 2.8.12) - macro(add_compile_options) - foreach(opt ${ARGN}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${opt}") - endforeach() - endmacro() +# Make sure CMAKE_INSTALL_LIBDIR is relative +if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR}) + file(RELATIVE_PATH CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_LIBDIR}) endif() set(NEKO_VERSION_MAJOR 2) -set(NEKO_VERSION_MINOR 1) +set(NEKO_VERSION_MINOR 2) set(NEKO_VERSION_PATCH 0) +set(NEKO_VERSION ${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH}) + +# Determine target endianness +TEST_BIG_ENDIAN(NEKO_BIG_ENDIAN) + +option(WITH_REGEXP "Build Perl-compatible regex support." ON) +option(WITH_UI "Build GTK-2 UI support." ON) +option(WITH_SSL "Build SSL support." ON) +option(WITH_MYSQL "Build MySQL support." ON) +option(WITH_SQLITE "Build Sqlite support." ON) +option(WITH_APACHE "Build Apach modules." ON) +option(WITH_NEKOML "Build NekoML." ON) + +# Process common headers in libraries +# TODO libraries should not be built from this file, but rather by traversing the tree using add_subdirectory +#add_subdirectory(libs) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + if (${CMAKE_OSX_ARCHITECTURES} STREQUAL "i386") + set(arch_64 "") + elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64") + set(arch_64 "64") + else() + message( FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be i386 or x86_64." ) + endif() +else() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(arch_64 "64") + else() + set(arch_64 "") + endif() +endif() + +if(WIN32) + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set (CMAKE_INSTALL_PREFIX "C:/HaxeToolkit/neko" CACHE PATH "default install path" FORCE) + endif() + set(NEKO_MODULE_PATH ${CMAKE_INSTALL_PREFIX}) +else() + set(NEKO_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/neko) +endif() + +if(APPLE AND STATIC_DEPS STREQUAL "all") + if(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "CMAKE_OSX_DEPLOYMENT_TARGET" FORCE) + endif() +endif() + +check_include_file(xlocale.h NEKO_XLOCALE_H) + +option(NEKO_JIT_DISABLE "Disable Neko JIT." OFF) +option(NEKO_JIT_DEBUG "Debug Neko JIT." OFF) configure_file ( "${CMAKE_SOURCE_DIR}/vm/neko.h.in" "${CMAKE_BINARY_DIR}/neko.h" ) -set(ndll_targets - std.ndll - zlib.ndll - mysql.ndll - mysql5.ndll - regexp.ndll - sqlite.ndll - ui.ndll - mod_neko2.ndll - mod_tora2.ndll - ssl.ndll -) - set(external_deps BoehmGC Zlib @@ -79,14 +109,10 @@ MbedTLS ) -set(WITH_NDLLS ${ndll_targets} CACHE STRING "A list of ndll files to be built.") - -set(STATIC_DEPS_DOC "Dependencies that should be linked statically. Can be \"all\", \"none\", or a list of library names (e.g. \"${external_deps}\").") - if (WIN32) - set(STATIC_DEPS "all") + set(STATIC_DEPS_DEFAULT "all") else() - set(STATIC_DEPS "none" CACHE STRING "${STATIC_DEPS_DOC}") + set(STATIC_DEPS_DEFAULT "none") option(RELOCATABLE "Set RPATH to $ORIGIN (Linux) / @executable_path (Mac)." ON) @@ -95,12 +121,8 @@ endif() endif() - -# These ndll cannot be skipped. -set(core_ndll_targets - std.ndll - zlib.ndll -) +set(STATIC_DEPS_DOC "Dependencies that should be linked statically. Can be \"all\", \"none\", or a list of library names (e.g. \"${external_deps}\").") +set(STATIC_DEPS ${STATIC_DEPS_DEFAULT} CACHE STRING "${STATIC_DEPS_DOC}") # Validate STATIC_DEPS if (STATIC_DEPS STREQUAL "all") @@ -117,20 +139,6 @@ endif() endforeach() -# Validate WITH_NDLLS -foreach(ndll ${WITH_NDLLS}) - list(FIND ndll_targets ${ndll} idx) - if(idx EQUAL -1) - message(FATAL_ERROR "Invalid WITH_NDLLS. There is no ${ndll} in the list of ${idx}.") - endif() -endforeach() -foreach(ndll ${core_ndll_targets}) - list(FIND WITH_NDLLS ${ndll} idx) - if(idx EQUAL -1) - message(FATAL_ERROR "${ndll} must be built. Add it to WITH_NDLLS.") - endif() -endforeach() - # Set STATIC_* variables according to STATIC_DEPS. foreach(dep ${external_deps}) string(TOUPPER ${dep} var) @@ -142,18 +150,6 @@ endif() endforeach() -# Set EXCLUDE_*_NDLL_FROM_ALL variables according to WITH_NDLLS. -foreach(ndll ${ndll_targets}) - string(REPLACE . _ var ${ndll}) - string(TOUPPER ${var} var) - list(FIND WITH_NDLLS ${ndll} ndll_idx) - if (ndll_idx EQUAL -1) - set(EXCLUDE_${var}_FROM_ALL EXCLUDE_FROM_ALL) - else() - set(EXCLUDE_${var}_FROM_ALL "") - endif() -endforeach() - include(ExternalProject) @@ -181,17 +177,18 @@ add_definitions(-D_GNU_SOURCE) add_compile_options(-fno-omit-frame-pointer) - if (${CMAKE_VERSION} VERSION_LESS 2.8.10) - add_compile_options(-fPIC) - set(ARG_PIC -DCMAKE_C_FLAGS=-fPIC) - else() - set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) - set(ARG_PIC -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE) - endif() + set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + set(ARG_PIC -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE) # https://github.com/HaxeFoundation/neko/pull/17 if(CMAKE_SIZEOF_VOID_P EQUAL 4) - add_compile_options(-mincoming-stack-boundary=2) + check_c_compiler_flag(-mincoming-stack-boundary=2 HAS_MINCOMING_STACK_BOUNDARY) + check_c_compiler_flag(-mstack-alignment=2 HAS_MSTACK_ALIGNMENT) + if(HAS_MINCOMING_STACK_BOUNDARY) + add_compile_options(-mincoming-stack-boundary=2) + elseif(HAS_MSTACK_ALIGNMENT) + add_compile_options(-mstack-alignment=2) + endif() endif() find_package(PkgConfig REQUIRED) @@ -209,6 +206,7 @@ # ExternalProject configs set(EP_CONFIGS PREFIX ${CMAKE_BINARY_DIR}/libs + DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/libs/download ) if(NOT ${CMAKE_VERSION} VERSION_LESS 3.1) list(APPEND EP_CONFIGS @@ -235,6 +233,13 @@ libs/common ) +file(GLOB libneko_public_headers + vm/neko*.h +) +list(APPEND libneko_public_headers + ${CMAKE_BINARY_DIR}/neko.h +) + add_library(libneko SHARED vm/alloc.c vm/builtins.c @@ -250,58 +255,51 @@ vm/threads.c ) -add_library(std.ndll MODULE - libs/std/buffer.c - libs/std/date.c - libs/std/file.c - libs/std/init.c - libs/std/int32.c - libs/std/math.c - libs/std/string.c - libs/std/random.c - libs/std/serialize.c - libs/std/socket.c - libs/std/sys.c - libs/std/xml.c - libs/std/module.c - libs/common/sha1.c - libs/std/md5.c - libs/std/unicode.c - libs/std/utf8.c - libs/std/memory.c - libs/std/misc.c - libs/std/thread.c - libs/std/process.c - libs/std/elf_update.c -) - add_executable(nekovm vm/stats.c vm/main.c ) if (STATIC_BOEHMGC) + ExternalProject_Add(libatomic_ops + ${EP_CONFIGS} + URL https://github.com/ivmai/libatomic_ops/releases/download/v7.6.0/libatomic_ops-7.6.0.tar.gz + URL_MD5 4d4cd729e55fafb56d48f667c3e46331 + CONFIGURE_COMMAND echo skip config + BUILD_COMMAND echo skip build + INSTALL_COMMAND echo skip install + ) + + set(BoehmGC_URL "http://www.hboehm.info/gc/gc_source/gc-7.6.0.tar.gz") + if (NOT ${CMAKE_VERSION} VERSION_LESS 3.7) + list(APPEND BoehmGC_URL + "https://github.com/ivmai/bdwgc/files/1005477/gc-7.6.0.tar.gz" + ) + endif() + + set ( + BoehmGC_CONFIGS + DEPENDS libatomic_ops + URL ${BoehmGC_URL} + URL_MD5 bf46ccbdaccfa3186c2ab87191c8855a + ) + if (WIN32) ExternalProject_Add(BoehmGC ${EP_CONFIGS} - URL http://www.hboehm.info/gc/gc_source/gc-7.1.tar.gz - URL_MD5 2ff9924c7249ef7f736ecfe6f08f3f9b + ${BoehmGC_CONFIGS} CMAKE_ARGS -Wno-dev -Denable_threads=ON + -Denable_parallel_mark=ON -DCMAKE_USE_WIN32_THREADS_INIT=ON - PATCH_COMMAND - ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/libs/gc/CMakeLists.txt - ${CMAKE_BINARY_DIR}/libs/src/BoehmGC/CMakeLists.txt - && cd ${CMAKE_BINARY_DIR}/libs/src/BoehmGC && - ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace --whitespace=nowarn --unsafe-paths ${CMAKE_SOURCE_DIR}/libs/gc/av_safety.patch + PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/libs/src/libatomic_ops ${CMAKE_BINARY_DIR}/libs/src/BoehmGC/libatomic_ops INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/libs/src/BoehmGC/include ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/include/gc ) - set(GC_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/include) + set(GC_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/include) set(GC_LIBRARIES ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/${CMAKE_CFG_INTDIR}/gcmt-dll.lib ) @@ -314,20 +312,20 @@ ) add_dependencies(nekovm gcmt-dll.dll) else() - ExternalProject_Add(libatomic_ops - ${EP_CONFIGS} - URL http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-7.4.2.tar.gz - URL_MD5 1d6538604b314d2fccdf86915e5c0857 - CONFIGURE_COMMAND echo skip config - BUILD_COMMAND echo skip build - INSTALL_COMMAND echo skip install + if (APPLE) + set(GC_CFLAGS "-w -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + else() + set(GC_CFLAGS "-w") + endif() + + set(GC_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/include) + set(GC_LIBRARIES + ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/lib/libgc.a ) ExternalProject_Add(BoehmGC ${EP_CONFIGS} - DEPENDS libatomic_ops - URL http://hboehm.info/gc/gc_source/gc-7.4.2.tar.gz - URL_MD5 12c05fd2811d989341d8c6d81f66af87 + ${BoehmGC_CONFIGS} PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/libs/src/libatomic_ops ${CMAKE_BINARY_DIR}/libs/src/BoehmGC/libatomic_ops CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/BoehmGC && ./configure @@ -339,19 +337,16 @@ --enable-silent-rules --silent BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/BoehmGC && - make CFLAGS=-w - INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/BoehmGC && + make "CFLAGS=${GC_CFLAGS}" + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/BoehmGC && make install + BYPRODUCTS + ${GC_LIBRARIES} ) # don't want to add libatomic_ops to external_deps, # but want download_static_deps depends on it add_dependencies(BoehmGC-download libatomic_ops-download) - - set(GC_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/include) - set(GC_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/BoehmGC-build/lib/libgc.a - ) endif() set_target_properties(BoehmGC PROPERTIES ${EP_PROPS}) add_dependencies(libneko BoehmGC) @@ -359,679 +354,38 @@ find_package(BoehmGC REQUIRED) endif() -target_include_directories(libneko PRIVATE ${GC_INCLUDE_DIRS}) +target_include_directories(libneko PRIVATE ${GC_INCLUDE_DIR}) target_link_libraries(libneko ${GC_LIBRARIES}) -target_link_libraries(std.ndll libneko) target_link_libraries(nekovm libneko) -if(WIN32) - target_link_libraries(std.ndll ws2_32) -endif() - if(UNIX) + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(DL_LIB "dl") + endif() find_package(Threads) - target_link_libraries(libneko dl m ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(libneko ${DL_LIB} m ${CMAKE_THREAD_LIBS_INIT}) endif() -set_target_properties(nekovm - PROPERTIES - OUTPUT_NAME neko -) - set_target_properties(nekovm libneko PROPERTIES OUTPUT_NAME neko ) + set_target_properties(libneko PROPERTIES - VERSION ${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH} + VERSION ${NEKO_VERSION} SOVERSION ${NEKO_VERSION_MAJOR} COMPILE_DEFINITIONS "_USRDLL;NEKOVM_DLL_EXPORTS;NEKO_SOURCES" -) -set_target_properties(std.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME std - SUFFIX .ndll -) - -###################### -# OpenSSL - -if (STATIC_OPENSSL) - if (APPLE) - if (${CMAKE_OSX_ARCHITECTURES} STREQUAL "i386") - set(OPENSSL_CONF ./Configure darwin-i386-cc) - elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64") - set(OPENSSL_CONF ./Configure darwin64-x86_64-cc) - endif() - else() - set(OPENSSL_CONF ./config) - endif() - if (WIN32) - # perl is needed to run the openssl Configure script... - find_package(Perl REQUIRED) - set(OPENSSL_CONFS - CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/OpenSSL && - ${PERL_EXECUTABLE} Configure VC-WIN32 no-asm --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix && - call ms/do_ms.bat - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/OpenSSL && - nmake /S -f ms/nt.mak - INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/OpenSSL && - nmake /S -f ms/nt.mak install - ) - else() - set(OPENSSL_CONFS - CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/OpenSSL && - ${OPENSSL_CONF} --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/OpenSSL && - make depend && make - INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/OpenSSL && - make install - ) - endif() - ExternalProject_Add(OpenSSL - ${EP_CONFIGS} - URL https://www.openssl.org/source/openssl-1.0.2h.tar.gz - URL_MD5 9392e65072ce4b614c1392eefc1f23d0 - ${OPENSSL_CONFS} - ) - set_target_properties(OpenSSL PROPERTIES ${EP_PROPS}) - if (WIN32) - set(OPENSSL_LIBRARIES - Crypt32 - ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libeay32.lib - ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/ssleay32.lib - ) - endif() -endif() - -###################### -# zlib.ndll - -add_library(zlib.ndll MODULE ${EXCLUDE_ZLIB_NDLL_FROM_ALL} libs/zlib/zlib.c) - - -if (STATIC_ZLIB) - set(ZLIB_CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix - -Wno-dev - ) - if (UNIX) - list(APPEND ZLIB_CMAKE_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - ${ARG_PIC} - ) - endif() - ExternalProject_Add(Zlib - ${EP_CONFIGS} - URL http://zlib.net/zlib-1.2.8.tar.gz - URL_MD5 44d667c142d7cda120332623eab69f40 - CMAKE_ARGS ${ZLIB_CMAKE_ARGS} - ) - set_target_properties(Zlib PROPERTIES ${EP_PROPS}) - set(ZLIB_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include) - if (WIN32) - set(ZLIB_LIBRARIES - optimized ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/zlibstatic.lib - debug ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/zlibstaticd.lib - ) - else() - set(ZLIB_LIBRARIES ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libz.a) - endif() - add_dependencies(zlib.ndll Zlib) -else() - pkg_check_modules(ZLIB REQUIRED zlib) -endif() - -target_include_directories(zlib.ndll PRIVATE ${ZLIB_INCLUDE_DIRS}) -target_link_libraries(zlib.ndll libneko ${ZLIB_LIBRARIES}) - -set_target_properties(zlib.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME zlib - SUFFIX .ndll -) - -###################### -# mysql.ndll - -add_library(mysql.ndll MODULE ${EXCLUDE_MYSQL_NDLL_FROM_ALL} libs/mysql/mysql.c) - -if (STATIC_MARIADBCONNECTOR) - if (STATIC_OPENSSL) - set(OPENSSL_CONF -DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix) - set(OPENSSL_DEP OpenSSL) - elseif() - set(OPENSSL_CONF "") - set(OPENSSL_DEP "") - endif() - ExternalProject_Add(MariaDBConnector - ${EP_CONFIGS} - DEPENDS ${OPENSSL_DEP} - URL https://downloads.mariadb.org/f/connector-c-2.2.3/mariadb-connector-c-2.2.3-src.tar.gz - URL_MD5 07d068bf6b6b3406a6cd65edee4211f5 - CMAKE_ARGS - -Wno-dev - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DWITH_OPENSSL=ON - ${OPENSSL_CONF} - PATCH_COMMAND ${CMAKE_COMMAND} -Dmariadb_source=${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector -P ${CMAKE_SOURCE_DIR}/cmake/patch_mariadb.cmake - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build && - ${CMAKE_COMMAND} --build . --target mariadbclient --config ${CMAKE_CFG_INTDIR} - INSTALL_COMMAND echo skip install - ) - set_target_properties(MariaDBConnector PROPERTIES ${EP_PROPS}) - set(MARIADB_CONNECTOR_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector/include) - if (WIN32) - set(MARIADB_CONNECTOR_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build/libmariadb/${CMAKE_CFG_INTDIR}/mariadbclient.lib - ) - else() - set(MARIADB_CONNECTOR_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build/libmariadb/libmariadbclient.a - ) - endif() - add_dependencies(mysql.ndll MariaDBConnector) -else() - find_package(MariaDBConnector REQUIRED) - if (NOT APPLE) - find_package(OpenSSL REQUIRED) - endif() -endif() - -target_include_directories(mysql.ndll - PRIVATE - ${MARIADB_CONNECTOR_INCLUDE_DIR} -) - -target_link_libraries(mysql.ndll libneko ${OPENSSL_LIBRARIES} ${MARIADB_CONNECTOR_LIBRARIES}) - -set_target_properties(mysql.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME mysql - SUFFIX .ndll -) - -###################### -# mysql5.ndll - -add_library(mysql5.ndll MODULE ${EXCLUDE_MYSQL5_NDLL_FROM_ALL} - libs/common/sha1.c - libs/common/socket.c - libs/mysql/my_proto/my_proto.c - libs/mysql/my_proto/my_api.c - libs/mysql/mysql.c -) - -target_include_directories(mysql5.ndll - PRIVATE - libs/mysql/my_proto -) - -target_link_libraries(mysql5.ndll libneko) - -if (WIN32) - target_link_libraries(mysql5.ndll ws2_32) -endif() - -set_target_properties(mysql5.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME mysql5 - SUFFIX .ndll -) - -###################### -# regexp.ndll - -add_library(regexp.ndll MODULE ${EXCLUDE_REGEXP_NDLL_FROM_ALL} libs/regexp/regexp.c) -if (STATIC_PCRE) - if (WIN32) - ExternalProject_Add(PCRE - ${EP_CONFIGS} - URL http://downloads.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz - URL_MD5 8a353fe1450216b6655dfcf3561716d9 - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix - -Wno-dev - -DPCRE_BUILD_PCRECPP=OFF - -DPCRE_BUILD_PCREGREP=OFF - -DPCRE_BUILD_TESTS=OFF - -DPCRE_SUPPORT_JIT=ON - -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON - ) - set(PCRE_LIBRARIES - optimized ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/pcre.lib - debug ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/pcred.lib - ) - else() - ExternalProject_Add(PCRE - ${EP_CONFIGS} - URL ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz - URL_MD5 8a353fe1450216b6655dfcf3561716d9 - CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/PCRE && - ./configure - --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix - --with-pic - --enable-unicode-properties - --enable-silent-rules - --enable-jit - --disable-cpp - --enable-shared=no - --enable-static=yes - --silent - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/PCRE && - make CFLAGS=-w - INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/PCRE && - make install - ) - set(PCRE_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libpcre.a - ) - endif() - set_target_properties(PCRE PROPERTIES ${EP_PROPS}) - set(PCRE_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include) - add_dependencies(regexp.ndll PCRE) -else() - find_package(PCRE REQUIRED) -endif() - -target_include_directories(regexp.ndll PRIVATE ${PCRE_INCLUDE_DIRS}) -target_link_libraries(regexp.ndll libneko ${PCRE_LIBRARIES}) - -set_target_properties(regexp.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME regexp - SUFFIX .ndll -) - -###################### -# sqlite.ndll - -if (STATIC_SQLITE3) - if (NOT EXISTS ${CMAKE_BINARY_DIR}/libs/src/Sqlite3) - message(STATUS "Downloading sqlite...") - set(sqlite_version sqlite-autoconf-3120200) - file(DOWNLOAD https://www.sqlite.org/2016/${sqlite_version}.tar.gz ${CMAKE_BINARY_DIR}/libs/src/${sqlite_version}.tar.gz) - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar x ${sqlite_version}.tar.gz - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/libs/src - ) - file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/libs/src/Sqlite3) - file(RENAME ${CMAKE_BINARY_DIR}/libs/src/${sqlite_version} ${CMAKE_BINARY_DIR}/libs/src/Sqlite3) - message(STATUS "Downloading sqlite... done") - endif() - - add_library(sqlite.ndll MODULE ${EXCLUDE_SQLITE_NDLL_FROM_ALL} - libs/sqlite/sqlite.c - ${CMAKE_BINARY_DIR}/libs/src/Sqlite3/sqlite3.c - ) - target_include_directories(sqlite.ndll PRIVATE ${CMAKE_BINARY_DIR}/libs/src/Sqlite3) - target_link_libraries(sqlite.ndll libneko) - target_compile_definitions(sqlite.ndll PRIVATE SQLITE_MAX_VARIABLE_NUMBER=250000 SQLITE_ENABLE_RTREE=1) -else() - add_library(sqlite.ndll MODULE ${EXCLUDE_SQLITE_NDLL_FROM_ALL} libs/sqlite/sqlite.c) - pkg_check_modules(SQLITE3 REQUIRED sqlite3) - target_include_directories(sqlite.ndll PRIVATE ${SQLITE3_INCLUDE_DIRS}) - target_link_libraries(sqlite.ndll libneko ${SQLITE3_LIBRARIES}) -endif() - - -set_target_properties(sqlite.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME sqlite - SUFFIX .ndll -) - -###################### -# ui.ndll - -add_library(ui.ndll MODULE ${EXCLUDE_UI_NDLL_FROM_ALL} libs/ui/ui.c) - -target_link_libraries(ui.ndll libneko) - -if(APPLE) - find_library(CARBON_LIBRARY Carbon REQUIRED) - target_link_libraries(ui.ndll ${CARBON_LIBRARY}) -elseif(UNIX) - pkg_check_modules(GTK2 REQUIRED gtk+-2.0) - target_include_directories(ui.ndll PRIVATE - ${GTK2_INCLUDE_DIRS} - ) - target_link_libraries(ui.ndll ${GTK2_LIBRARIES}) -endif() - -set_target_properties(ui.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME ui - SUFFIX .ndll + PUBLIC_HEADER "${libneko_public_headers}" + PDB_NAME libneko ) -###################### -# mod_neko2.ndll - -add_library(mod_neko2.ndll MODULE ${EXCLUDE_MOD_NEKO2_NDLL_FROM_ALL} - vm/stats.c - libs/mod_neko/mod_neko.c - libs/mod_neko/cgi.c -) - - -if (STATIC_APACHE) - if (STATIC_OPENSSL) - set(OPENSSL_CONF --with-openssl=${CMAKE_BINARY_DIR}/libs/src/install-prefix) - set(OPENSSL_DEP OpenSSL) - elseif() - set(OPENSSL_CONF "") - set(OPENSSL_DEP "") - endif() - if (STATIC_APR) - set(APR_CONF --with-apr=${CMAKE_BINARY_DIR}/libs/src/install-prefix) - set(APR_DEP APR) - elseif() - set(APR_CONF "") - set(APR_DEP "") - endif() - if (STATIC_APRUTIL) - set(APRUTIL_CONF --with-apr-util=${CMAKE_BINARY_DIR}/libs/src/install-prefix) - set(APRUTIL_DEP APRutil) - elseif() - set(APRUTIL_CONF "") - set(APRUTIL_DEP "") - endif() - if (STATIC_PCRE) - set(PCRE_CONF --with-pcre=${CMAKE_BINARY_DIR}/libs/src/install-prefix) - set(PCRE_DEP PCRE) - elseif() - set(PCRE_CONF "") - set(PCRE_DEP "") - endif() - if (STATIC_ZLIB) - set(ZLIB_CONF --with-z=${CMAKE_BINARY_DIR}/libs/src/install-prefix) - set(ZLIB_DEP Zlib) - elseif() - set(ZLIB_CONF "") - set(ZLIB_DEP "") - endif() - - if(WIN32) - set(APR_CONFIGS - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix - -Wno-dev - -DAPR_INSTALL_PRIVATE_H=ON - -DINSTALL_PDB=OFF - ) - else() - set(APR_CONFIGS - CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && - ./configure --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix - --enable-shared=no - --enable-static=yes - --silent - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && - make CFLAGS=-w - INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && - make install - ) - endif() - ExternalProject_Add(APR - ${EP_CONFIGS} - URL http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz - URL_MD5 98492e965963f852ab29f9e61b2ad700 - ${APR_CONFIGS} - ) - set_target_properties(APR PROPERTIES ${EP_PROPS}) - - - if(WIN32) - set(APRutil_CONFIGS - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix - -Wno-dev - -DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix - -DINSTALL_PDB=OFF - ) - else() - set(APRutil_CONFIGS - CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && - ./configure - --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix - --silent - ${APR_CONF} - ${OPENSSL_CONF} - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && - make CFLAGS=-w - INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && - make install - ) - endif() - ExternalProject_Add(APRutil - ${EP_CONFIGS} - DEPENDS ${APR_DEP} ${OPENSSL_DEP} - URL http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz - URL_MD5 866825c04da827c6e5f53daff5569f42 - ${APRutil_CONFIGS} - ) - set_target_properties(APRutil PROPERTIES ${EP_PROPS}) - - - if(WIN32) - set(Apache_CONFIGS - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix - -Wno-dev - -DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix - "-DEXTRA_COMPILE_FLAGS=/D PCRE_STATIC" - -DEXTRA_LIBS=Ws2_32 - BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Apache-build && - ${CMAKE_COMMAND} --build . --target libhttpd --config ${CMAKE_CFG_INTDIR} - INSTALL_COMMAND echo skip install - ) - set(APACHE_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include - ${CMAKE_BINARY_DIR}/libs/src/Apache/include - ${CMAKE_BINARY_DIR}/libs/src/Apache/os/win32 - ${CMAKE_BINARY_DIR}/libs/src/Apache-build - ) - set(APACHE_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libapr-1.lib - ${CMAKE_BINARY_DIR}/libs/src/Apache-build/${CMAKE_CFG_INTDIR}/libhttpd.lib - ) - else() - set(Apache_CONFIGS - CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Apache && - ./configure - --prefix=${CMAKE_BINARY_DIR}/libs/src/Apache-build - --silent - ${APR_CONF} - ${APRUTIL_CONF} - ${OPENSSL_CONF} - ${PCRE_CONF} - ${ZLIB_CONF} - BUILD_COMMAND echo skip build - INSTALL_COMMAND echo skip install - ) - set(APACHE_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include/apr-1 - ${CMAKE_BINARY_DIR}/libs/src/Apache/include - ${CMAKE_BINARY_DIR}/libs/src/Apache/os/unix - ) - set(APACHE_LIBRARIES - - ) - endif() - ExternalProject_Add(Apache - ${EP_CONFIGS} - DEPENDS ${APR_DEP} ${APRUTIL_DEP} ${OPENSSL_DEP} ${PCRE_DEP} - URL http://archive.apache.org/dist/httpd/httpd-2.4.20.tar.gz - URL_MD5 e725c268624737a163dc844e28f720d1 - ${Apache_CONFIGS} - ) - set_target_properties(Apache PROPERTIES ${EP_PROPS}) - add_dependencies(mod_neko2.ndll Apache APR APRutil) -else() - find_package(APACHE REQUIRED) - find_package(APR REQUIRED) - set(APACHE_LIBRARIES ${APR_LIBRARIES} ${APRUTIL_LIBRARIES}) - set(APACHE_INCLUDE_DIRS ${APACHE_INCLUDE_DIR} ${APR_INCLUDE_DIR} ${APRUTIL_INCLUDE_DIR}) -endif() - -target_include_directories(mod_neko2.ndll - PRIVATE - ${APACHE_INCLUDE_DIRS} -) - -target_link_libraries(mod_neko2.ndll libneko ${APACHE_LIBRARIES}) - -set_target_properties(mod_neko2.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME mod_neko2 - SUFFIX .ndll -) - -if(APPLE) - set_target_properties(mod_neko2.ndll - PROPERTIES - LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" - ) -endif(APPLE) - -###################### -# mod_tora2.ndll - -add_library(mod_tora2.ndll MODULE ${EXCLUDE_MOD_TORA2_NDLL_FROM_ALL} - libs/common/socket.c - libs/mod_tora/protocol.c - libs/mod_tora/mod_tora.c -) - -add_dependencies(mod_tora2.ndll mod_neko2.ndll) - -target_include_directories(mod_tora2.ndll - PRIVATE - ${APACHE_INCLUDE_DIRS} -) - -target_link_libraries(mod_tora2.ndll ${APACHE_LIBRARIES}) -if (WIN32) - target_link_libraries(mod_tora2.ndll ws2_32) -endif() - -set_target_properties(mod_tora2.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME mod_tora2 - SUFFIX .ndll -) - -###################### -# ssl.ndll - -add_library(ssl.ndll MODULE ${EXCLUDE_SSL_NDLL_FROM_ALL} libs/ssl/ssl.c) - -if (STATIC_MBEDTLS) - set(MBEDTLS_CMAKE_ARGS - -Wno-dev - -DENABLE_PROGRAMS=OFF - -DENABLE_TESTING=OFF - -DUSE_STATIC_MBEDTLS_LIBRARY=ON - ) - if (UNIX) - list(APPEND MBEDTLS_CMAKE_ARGS - -DLINK_WITH_PTHREAD=ON - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - ${ARG_PIC} - ) - endif() - ExternalProject_Add(MbedTLS - ${EP_CONFIGS} - URL https://tls.mbed.org/download/mbedtls-2.2.1-apache.tgz - URL_MD5 77751c0e370ed2ab01934e4c5e1d380f - CMAKE_ARGS ${MBEDTLS_CMAKE_ARGS} - PATCH_COMMAND ${CMAKE_COMMAND} -Dsource=${CMAKE_SOURCE_DIR} -DMbedTLS_source=${CMAKE_BINARY_DIR}/libs/src/MbedTLS -P ${CMAKE_SOURCE_DIR}/cmake/patch_mbedtls.cmake - INSTALL_COMMAND echo skip install - ) - set_target_properties(MbedTLS PROPERTIES ${EP_PROPS}) - set(MBEDTLS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libs/src/MbedTLS/include) - - if (WIN32) - set(MBEDTLS_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/${CMAKE_CFG_INTDIR}/mbedx509.lib - ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/${CMAKE_CFG_INTDIR}/mbedtls.lib - ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/${CMAKE_CFG_INTDIR}/mbedcrypto.lib - ) - target_link_libraries(ssl.ndll ws2_32 Advapi32 Crypt32) - else() - set(MBEDTLS_LIBRARIES - ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/libmbedx509.a - ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/libmbedtls.a - ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/libmbedcrypto.a - ) - endif() - add_dependencies(ssl.ndll MbedTLS) -else() - find_package(MbedTLS REQUIRED) -endif() - -target_include_directories(ssl.ndll - PRIVATE - ${MBEDTLS_INCLUDE_DIR} -) - -if(APPLE) - find_library(SECURITY_LIBRARY Security REQUIRED) - find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED) - target_link_libraries(ssl.ndll ${COREFOUNDATION_LIBRARY} ${SECURITY_LIBRARY}) -endif() - -target_link_libraries(ssl.ndll libneko ${MBEDTLS_LIBRARIES}) - -set_target_properties(ssl.ndll - PROPERTIES - PREFIX "" - OUTPUT_NAME ssl - SUFFIX .ndll -) - - -####################### - -if(APPLE) - set_target_properties(mod_tora2.ndll mysql.ndll - PROPERTIES - LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" - ) -endif(APPLE) - - ####################### # compilers # nekoc, nekoml, nekotools, and test.n -if (WIN32) - set(compilers_outputs - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.exe - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.exe - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.exe - ) -else() - set(compilers_outputs - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools - ) -endif() - if (CMAKE_HOST_WIN32) set(set_neko_env set NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) set(neko_exec $) @@ -1043,71 +397,130 @@ set(neko_exec LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) endif() -file(GLOB neko_files - src/**/*.neko -) - -file(GLOB nml_files - src/**/*.nml +file(GLOB compilers_src + src/neko/*.nml + src/nekoml/*.nml + boot/*.n ) -add_custom_command(OUTPUT ${compilers_outputs} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test.n - COMMAND ${set_neko_env} +if (RECOMPILE_NEKOC_NEKOML) + add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n + COMMAND ${set_neko_env} - COMMAND ${neko_exec} ../boot/nekoml.n -nostd neko/Main.nml nekoml/Main.nml - COMMAND ${neko_exec} ../boot/nekoc.n -link ../boot/nekoc.n neko/Main - COMMAND ${neko_exec} ../boot/nekoc.n -link ../boot/nekoml.n nekoml/Main + COMMAND ${neko_exec} ../boot/nekoml.n -nostd neko/Main.nml nekoml/Main.nml + COMMAND ${neko_exec} ../boot/nekoc.n -link ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n neko/Main + COMMAND ${neko_exec} ../boot/nekoc.n -link ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n nekoml/Main - COMMAND ${CMAKE_COMMAND} -E copy ../boot/nekoc.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy ../boot/nekoml.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + VERBATIM + DEPENDS nekovm std.ndll ${compilers_src} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + ) +else() + add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n + COMMAND ${CMAKE_COMMAND} -E copy ../boot/nekoc.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ../boot/nekoml.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - # compile some neko sources + DEPENDS std.ndll + VERBATIM + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + ) +endif() - COMMAND ${neko_exec} ../boot/nekoc.n tools/test.neko +add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test.n + COMMAND ${set_neko_env} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n tools/test.neko COMMAND ${CMAKE_COMMAND} -E copy tools/test.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E remove tools/test.n + VERBATIM + DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_SOURCE_DIR}/src/tools/test.neko + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src +) +add_custom_target(test.n ALL DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test.n) - COMMAND ${neko_exec} ../boot/nekoc.n tools/nekoboot.neko - COMMAND ${neko_exec} ../boot/nekoml.n -nostd -p tools Tools.nml - COMMAND ${neko_exec} ../boot/nekoc.n -link tools/nekotools.n Tools - COMMAND ${CMAKE_COMMAND} -E copy tools/nekotools.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - - COMMAND ${neko_exec} tools/nekoboot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n - COMMAND ${neko_exec} tools/nekoboot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n - COMMAND ${neko_exec} tools/nekoboot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n - COMMAND ${CMAKE_COMMAND} -E remove - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n - +add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n + COMMAND ${set_neko_env} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n tools/nekoboot.neko + COMMAND ${CMAKE_COMMAND} -E copy tools/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + # COMMAND ${CMAKE_COMMAND} -E remove tools/nekoboot.n VERBATIM - DEPENDS nekovm std.ndll ${nml_files} ${neko_files} + DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_SOURCE_DIR}/src/tools/nekoboot.neko WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src ) -file(GLOB CORE_NMLS RELATIVE ${CMAKE_SOURCE_DIR}/src src/core/*.nml) -set(nekoml_std ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.std) -add_custom_command(OUTPUT ${nekoml_std} +file(GLOB nekotools_src + src/tools/*.nml +) + +add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n COMMAND ${set_neko_env} - COMMAND ${neko_exec} ../boot/nekoml.n -nostd neko/Main.nml nekoml/Main.nml ${CORE_NMLS} -pack ${nekoml_std} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -nostd -p tools Tools.nml + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n -link ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n Tools VERBATIM - DEPENDS zlib.ndll ${compilers_outputs} + DEPENDS nekovm std.ndll + ${nekotools_src} + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src ) -add_custom_target(compilers ALL - DEPENDS ${compilers_outputs} ${nekoml_std} +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/nekoc.c + COMMAND ${set_neko_env} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.c ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.c + VERBATIM + DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +) +add_executable(nekoc ${CMAKE_BINARY_DIR}/nekoc.c) +target_link_libraries(nekoc libneko) + +if (WITH_NEKOML) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/nekoml.c + COMMAND ${set_neko_env} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.c ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.c + VERBATIM + DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + add_executable(nekoml ${CMAKE_BINARY_DIR}/nekoml.c) + target_link_libraries(nekoml libneko) +endif() + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/nekotools.c + COMMAND ${set_neko_env} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.c ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.c + VERBATIM + DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) +add_executable(nekotools ${CMAKE_BINARY_DIR}/nekotools.c) +target_link_libraries(nekotools libneko) + +if (WITH_NEKOML) + file(GLOB CORE_NMLS RELATIVE ${CMAKE_SOURCE_DIR}/src src/core/*.nml) + set(nekoml_std ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.std) + add_custom_command(OUTPUT ${nekoml_std} + COMMAND ${set_neko_env} + COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -nostd neko/Main.nml nekoml/Main.nml ${CORE_NMLS} -pack ${nekoml_std} + VERBATIM + DEPENDS zlib.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + ) + add_custom_target(nekoml.std ALL DEPENDS ${nekoml_std}) +endif() ####################### add_custom_target(download_static_deps) - -foreach(dep ${STATIC_DEPS}) - if (NOT dep STREQUAL Sqlite3) - add_dependencies(download_static_deps ${dep}-download) - endif() -endforeach() +if (STATIC_BOEHMGC) + add_dependencies(download_static_deps BoehmGC-download) +endif() ####################### @@ -1122,7 +535,7 @@ set(source_archive_format tar.gz) endif() -set(source_archive_name_we neko-${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH}-src) +set(source_archive_name_we neko-${NEKO_VERSION}-src) set(source_archive_name ${source_archive_name_we}.${source_archive_format}) add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${source_archive_name} @@ -1138,7 +551,7 @@ # source_archive_fat # It is source_archive + STATIC_DEPS placed in libs/src. -set(source_archive_fat_name_we neko-${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH}-src-fat) +set(source_archive_fat_name_we neko-${NEKO_VERSION}-src-fat) set(source_archive_fat_name ${source_archive_fat_name_we}.${source_archive_format}) add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${source_archive_fat_name} @@ -1167,6 +580,7 @@ set(DEST_BIN .) set(DEST_LIB .) set(DEST_NDLL .) + set(DEST_INCLUDE "include") set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .) include(InstallRequiredSystemLibraries) @@ -1175,56 +589,121 @@ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gcmt-dll.dll DESTINATION . ) - - if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set (CMAKE_INSTALL_PREFIX "C:/HaxeToolkit/neko" CACHE PATH "default install path" FORCE) - endif() else() - set(DEST_BIN bin) - set(DEST_LIB lib) - set(DEST_NDLL lib/neko) + set(DEST_BIN ${CMAKE_INSTALL_BINDIR}) + set(DEST_LIB ${CMAKE_INSTALL_LIBDIR}) + set(DEST_NDLL ${CMAKE_INSTALL_LIBDIR}/neko) # should match NEKO_MODULE_PATH + set(DEST_INCLUDE ${CMAKE_INSTALL_INCLUDEDIR}) endif() install ( - TARGETS nekovm - DESTINATION ${DEST_BIN} -) -install ( - PROGRAMS ${compilers_outputs} - DESTINATION ${DEST_BIN} + TARGETS + nekovm + nekoc + nekotools + libneko + EXPORT NekoTargets + RUNTIME DESTINATION ${DEST_BIN} + LIBRARY DESTINATION ${DEST_LIB} + PUBLIC_HEADER DESTINATION ${DEST_INCLUDE} ) -install ( - TARGETS libneko - DESTINATION ${DEST_LIB} + +if (WITH_NEKOML) + install ( + TARGETS + nekoml + EXPORT NekoTargets + RUNTIME DESTINATION ${DEST_BIN} + LIBRARY DESTINATION ${DEST_LIB} + PUBLIC_HEADER DESTINATION ${DEST_INCLUDE} + ) + install ( + FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.std + DESTINATION ${DEST_NDLL} + ) +endif() + +include(CMakePackageConfigHelpers) + +if(WIN32 AND NOT CYGWIN) + set(DEF_INSTALL_CMAKE_DIR CMake) +else() + set(DEF_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/Neko) +endif() +set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH + "Installation directory for CMake files") + + +export(TARGETS + nekovm + nekoc + nekotools + libneko + FILE "${CMAKE_BINARY_DIR}/NekoTargets.cmake") +if (WITH_NEKOML) + export(TARGETS + nekoml + FILE "${CMAKE_BINARY_DIR}/NekoTargets.cmake") +endif() + +export(PACKAGE Neko) + +# NekoConfig referencing build dir + +set(NEKO_INCLUDE_DIRS "${CMAKE_BINARY_DIR};${CMAKE_SOURCE_DIR}/vm") +set(NEKO_TARGETS_FILE "${CMAKE_BINARY_DIR}/NekoTargets.cmake") + +configure_package_config_file( + cmake/NekoConfig.cmake.in + "${CMAKE_BINARY_DIR}/NekoConfig.cmake" + INSTALL_DESTINATION ${CMAKE_BINARY_DIR} + PATH_VARS NEKO_INCLUDE_DIRS NEKO_TARGETS_FILE ) -install ( - TARGETS ${WITH_NDLLS} - DESTINATION ${DEST_NDLL} + +# NekoConfig referencing install dirs + +set(NEKO_INCLUDE_DIRS "${DEST_INCLUDE}") +set(NEKO_TARGETS_FILE "${INSTALL_CMAKE_DIR}/NekoTargets.cmake") + +configure_package_config_file( + cmake/NekoConfig.cmake.in + "${OUTPUT_DIR}/NekoConfig.cmake" + INSTALL_DESTINATION "${INSTALL_CMAKE_DIR}" + PATH_VARS NEKO_INCLUDE_DIRS NEKO_TARGETS_FILE ) -install ( - FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.std - DESTINATION ${DEST_NDLL} + + +write_basic_package_version_file( + NekoConfigVersion.cmake + VERSION ${NEKO_VERSION} + COMPATIBILITY SameMajorVersion ) -install ( - DIRECTORY vm/ - DESTINATION include - FILES_MATCHING PATTERN "neko*.h" + +install(FILES + ${OUTPUT_DIR}/NekoConfig.cmake + ${CMAKE_BINARY_DIR}/NekoConfigVersion.cmake + DESTINATION ${INSTALL_CMAKE_DIR} + COMPONENT dev ) -install ( - FILES ${CMAKE_BINARY_DIR}/neko.h - DESTINATION include + +install( + EXPORT NekoTargets + DESTINATION "${INSTALL_CMAKE_DIR}" + COMPONENT dev ) if (RUN_LDCONFIG) install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/ldconfig.cmake") endif() +# A script to create a flat installation for archive package +set (NEKO_FLATTEN_SCRIPT ${CMAKE_BINARY_DIR}/cmake/flatten.cmake) configure_file( "${CMAKE_SOURCE_DIR}/cmake/flatten.cmake.in" - "${CMAKE_BINARY_DIR}/cmake/flatten.cmake" + ${NEKO_FLATTEN_SCRIPT} IMMEDIATE @ONLY) -install(SCRIPT "${CMAKE_BINARY_DIR}/cmake/flatten.cmake") +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) # uninstall target configure_file( @@ -1263,11 +742,11 @@ message( FATAL_ERROR "CMAKE_OSX_ARCHITECTURES should be i386 or x86_64." ) endif() else() - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(arch_64 "64") - else() + else() set(arch_64 "") - endif() + endif() endif() if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") @@ -1276,16 +755,18 @@ set(OS_NAME "osx") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(OS_NAME "linux") +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(OS_NAME "freebsd") else() message( WARNING "unknown ${CMAKE_SYSTEM_NAME}" ) set(OS_NAME "") endif() -set(bin_archive_name_we "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${OS_NAME}${arch_64}") +set(bin_archive_name_we "neko-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${OS_NAME}${arch_64}") set(bin_archive_name "${bin_archive_name_we}.${bin_archive_format}") set(CPACK_PACKAGE_FILE_NAME ${bin_archive_name_we}) # set(CPACK_SOURCE_PACKAGE_FILE_NAME -# "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-src") +# "neko-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-src") include(CPack) @@ -1304,8 +785,30 @@ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) +add_test(NAME nekoc + COMMAND nekoc + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} +) + +if (WITH_NEKOML) + add_test(NAME nekoml + COMMAND nekoml + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ) + + set_tests_properties(nekoml + PROPERTIES + ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ) +endif() + +add_test(NAME nekotools + COMMAND nekotools + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} +) + if (UNIX AND NOT APPLE) - set_tests_properties(-version test.n + set_tests_properties(-version test.n nekoc nekotools PROPERTIES ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) @@ -1322,7 +825,7 @@ -Dsource_dir=${CMAKE_SOURCE_DIR} -Dbin_dir=${CMAKE_BINARY_DIR} -Dsource_archive=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${source_archive_fat_name} - -DNEKO_VERSION=${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH} + -DNEKO_VERSION=${NEKO_VERSION} -P ${CMAKE_SOURCE_DIR}/cmake/upload_to_ppa.cmake DEPENDS source_archive_fat ) @@ -1339,8 +842,10 @@ -Dbin_dir=${CMAKE_BINARY_DIR} -Dbin_archive=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${bin_archive_name} -Dbin_archive_name_we=${bin_archive_name_we} - -DNEKO_VERSION=${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH} + -DNEKO_VERSION=${NEKO_VERSION} -P ${CMAKE_SOURCE_DIR}/cmake/package_choco.cmake DEPENDS package ) endif() + +add_subdirectory(libs) diff -Nru neko-2.1.0/debian/changelog neko-2.2.0/debian/changelog --- neko-2.1.0/debian/changelog 2016-06-12 16:42:50.000000000 +0000 +++ neko-2.2.0/debian/changelog 2018-03-28 09:40:05.000000000 +0000 @@ -1,8 +1,38 @@ -neko (2.1.0-3~ubuntu14.04.1~ppa1) trusty; urgency=medium +neko (2.2.0-2~ubuntu14.04.1~ppa1) trusty; urgency=medium - * No-change backport to trusty + * Use libmysqlclient-dev. + * Update mbedtls to 2.6.0. - -- Andy Li Mon, 13 Jun 2016 00:42:50 +0800 + -- Andy Li Wed, 28 Mar 2018 17:36:15 +0800 + +neko (2.2.0-2) unstable; urgency=medium + + * Turned libapache2-mod-neko into Architecture: any. + (Closes: #886427) + * Bump Standards-Version to 4.1.3 (no changes). + + -- Andy Li Mon, 08 Jan 2018 09:45:01 +0800 + +neko (2.2.0-1) unstable; urgency=low + + * New upstream version. + * Removed patches applied to upstream. + * Convert to multiarch. + * Add dh_missing --fail-missing check. + * Updated d/watch to match new upstream download links. + * Bump Standards-Version to 4.1.2 (no changes). + * Disable parallel build since it is only supported by upstream + when using Ninja. + * Add autopkgtest support. + + -- Andy Li Wed, 20 Dec 2017 10:43:17 +0800 + +neko (2.1.0-4) unstable; urgency=medium + + * Updated dependencies of mariadb and mysql (Closes: #843841). + * Enabled hardening (hardening=+all). + + -- Andy Li Thu, 10 Nov 2016 22:56:04 +0800 neko (2.1.0-3) unstable; urgency=medium @@ -30,6 +60,7 @@ + The "nekotools booted" binaries can now be stripped correctly. + Use MariaDB for compiling mysql.ndll. + Updated d/copyright. + * Converted libneko to Multi-Arch: same. * Fixed shlibdeps for the neko package. * Removed patches applied to upstream. Updated hurd.diff. * Updated d/watch pattern. diff -Nru neko-2.1.0/debian/control neko-2.2.0/debian/control --- neko-2.1.0/debian/control 2016-06-12 15:11:52.000000000 +0000 +++ neko-2.2.0/debian/control 2018-03-28 09:35:52.000000000 +0000 @@ -2,7 +2,7 @@ Section: interpreters Priority: optional Maintainer: Andy Li -Standards-Version: 3.9.8 +Standards-Version: 4.1.3 Build-Depends: debhelper (>= 9), cmake, @@ -11,7 +11,7 @@ libgc-dev, dh-apache2, apache2-dev, - libmariadb-client-lgpl-dev-compat | libmysqlclient-dev, + libmysqlclient-dev, libsqlite3-dev, libpcre3-dev, libapr1-dev, @@ -23,6 +23,7 @@ Package: libneko2 Architecture: any +Multi-Arch: same Section: libs Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: neko (<< 1.8.0-2), neko-dev (<< 1.8.1) @@ -35,7 +36,8 @@ Neko was written by Nicolas Cannasse. Package: neko-dev -Architecture: all +Architecture: any +Multi-Arch: same Section: libdevel Depends: libneko2 (>= ${source:Upstream-Version}), libneko2 (<< ${source:Upstream-Version}+1~), ${misc:Depends} Conflicts: neko (<< 1.8.0-2) @@ -69,7 +71,7 @@ Neko was written by Nicolas Cannasse. Package: libapache2-mod-neko -Architecture: all +Architecture: any Section: httpd Depends: neko (>= ${source:Version}), ${misc:Depends} Description: Apache module for running server-side Neko programs diff -Nru neko-2.1.0/debian/libneko2.install neko-2.2.0/debian/libneko2.install --- neko-2.1.0/debian/libneko2.install 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/libneko2.install 2018-03-28 09:29:31.000000000 +0000 @@ -1 +1 @@ -usr/lib/*.so.* usr/lib +usr/lib/*/*.so.* Binary files /tmp/tmpQS9xzr/mcP9tx2AKD/neko-2.1.0/debian/mbedtls-2.2.1-apache.tgz and /tmp/tmpQS9xzr/ZQCdjo9ab1/neko-2.2.0/debian/mbedtls-2.2.1-apache.tgz differ Binary files /tmp/tmpQS9xzr/mcP9tx2AKD/neko-2.1.0/debian/mbedtls-2.6.0-apache.tgz and /tmp/tmpQS9xzr/ZQCdjo9ab1/neko-2.2.0/debian/mbedtls-2.6.0-apache.tgz differ diff -Nru neko-2.1.0/debian/neko-dev.install neko-2.2.0/debian/neko-dev.install --- neko-2.1.0/debian/neko-dev.install 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/neko-dev.install 2018-03-28 09:29:31.000000000 +0000 @@ -1,2 +1,3 @@ -usr/lib/*.so usr/lib -usr/include/* usr/include +usr/lib/*/*.so +usr/lib/*/cmake/* +usr/include/* diff -Nru neko-2.1.0/debian/neko.install neko-2.2.0/debian/neko.install --- neko-2.1.0/debian/neko.install 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/neko.install 2018-03-28 09:29:31.000000000 +0000 @@ -1,2 +1,2 @@ -usr/lib/neko/* usr/lib/neko -usr/bin/* usr/bin +usr/lib/*/neko/* +usr/bin/* diff -Nru neko-2.1.0/debian/neko.load neko-2.2.0/debian/neko.load --- neko-2.1.0/debian/neko.load 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/neko.load 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -LoadModule neko_module /usr/lib/neko/mod_neko2.ndll diff -Nru neko-2.1.0/debian/patches/boot-c-1.diff neko-2.2.0/debian/patches/boot-c-1.diff --- neko-2.1.0/debian/patches/boot-c-1.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/boot-c-1.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,538 +0,0 @@ -From a8c71ad97faaccff6c6e9e09eba2d5efd022f8dc Mon Sep 17 00:00:00 2001 -From: Andy Li -Date: Wed, 11 May 2016 18:50:34 +0800 -Subject: [PATCH] added `nekotools boot -c file.n` that outputs a c source file - ---- - CMakeLists.txt | 133 +++++++++++++-------- - src/tools/nekoboot.neko | 309 +++++++++++++++++++++++++++++++++++++----------- - 2 files changed, 322 insertions(+), 120 deletions(-) - -Index: neko-debian/CMakeLists.txt -=================================================================== ---- neko-debian.orig/CMakeLists.txt -+++ neko-debian/CMakeLists.txt -@@ -1025,20 +1025,6 @@ endif(APPLE) - # compilers - # nekoc, nekoml, nekotools, and test.n - --if (WIN32) -- set(compilers_outputs -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.exe -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.exe -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.exe -- ) --else() -- set(compilers_outputs -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools -- ) --endif() -- - if (CMAKE_HOST_WIN32) - set(set_neko_env set NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - set(neko_exec $) -@@ -1050,61 +1036,108 @@ else() - set(neko_exec LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} NEKOPATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} $) - endif() - --file(GLOB neko_files -- src/**/*.neko -+file(GLOB compilers_src -+ src/neko/*.nml -+ src/nekoml/*.nml -+ boot/*.n - ) - --file(GLOB nml_files -- src/**/*.nml --) -- --add_custom_command(OUTPUT ${compilers_outputs} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test.n -+add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n - COMMAND ${set_neko_env} - - COMMAND ${neko_exec} ../boot/nekoml.n -nostd neko/Main.nml nekoml/Main.nml -- COMMAND ${neko_exec} ../boot/nekoc.n -link ../boot/nekoc.n neko/Main -- COMMAND ${neko_exec} ../boot/nekoc.n -link ../boot/nekoml.n nekoml/Main -- -- COMMAND ${CMAKE_COMMAND} -E copy ../boot/nekoc.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -- COMMAND ${CMAKE_COMMAND} -E copy ../boot/nekoml.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -+ COMMAND ${neko_exec} ../boot/nekoc.n -link ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n neko/Main -+ COMMAND ${neko_exec} ../boot/nekoc.n -link ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n nekoml/Main - -- # compile some neko sources -+ VERBATIM -+ DEPENDS nekovm std.ndll ${compilers_src} -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src -+) - -- COMMAND ${neko_exec} ../boot/nekoc.n tools/test.neko -+add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test.n -+ COMMAND ${set_neko_env} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n tools/test.neko - COMMAND ${CMAKE_COMMAND} -E copy tools/test.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E remove tools/test.n -+ VERBATIM -+ DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_SOURCE_DIR}/src/tools/test.neko -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src -+) -+add_custom_target(test.n ALL DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test.n) -+ -+add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n -+ COMMAND ${set_neko_env} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n tools/nekoboot.neko -+ COMMAND ${CMAKE_COMMAND} -E copy tools/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -+ # COMMAND ${CMAKE_COMMAND} -E remove tools/nekoboot.n -+ VERBATIM -+ DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n ${CMAKE_SOURCE_DIR}/src/tools/nekoboot.neko -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src -+) -+ -+file(GLOB nekotools_src -+ src/tools/*.nml -+) - -- COMMAND ${neko_exec} ../boot/nekoc.n tools/nekoboot.neko -- COMMAND ${neko_exec} ../boot/nekoml.n -nostd -p tools Tools.nml -- COMMAND ${neko_exec} ../boot/nekoc.n -link tools/nekotools.n Tools -- COMMAND ${CMAKE_COMMAND} -E copy tools/nekotools.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -- -- COMMAND ${neko_exec} tools/nekoboot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n -- COMMAND ${neko_exec} tools/nekoboot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -- COMMAND ${neko_exec} tools/nekoboot ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n -- COMMAND ${CMAKE_COMMAND} -E remove -+add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n -+ COMMAND ${set_neko_env} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -nostd -p tools Tools.nml -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n -link ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n Tools -+ VERBATIM -+ DEPENDS nekovm std.ndll -+ ${nekotools_src} - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n -+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src -+) - -+add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/nekoc.c -+ COMMAND ${set_neko_env} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n -+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.c ${CMAKE_BINARY_DIR} -+ COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.c - VERBATIM -- DEPENDS nekovm std.ndll ${nml_files} ${neko_files} -- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src -+ DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoc.n -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -+) -+add_executable(nekoc ${CMAKE_BINARY_DIR}/nekoc.c) -+target_link_libraries(nekoc libneko) -+ -+add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/nekoml.c -+ COMMAND ${set_neko_env} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.c ${CMAKE_BINARY_DIR} -+ COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.c -+ VERBATIM -+ DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -+) -+add_executable(nekoml ${CMAKE_BINARY_DIR}/nekoml.c) -+target_link_libraries(nekoml libneko) -+ -+add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/nekotools.c -+ COMMAND ${set_neko_env} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n -+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.c ${CMAKE_BINARY_DIR} -+ COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.c -+ VERBATIM -+ DEPENDS nekovm std.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoboot.n ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekotools.n -+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) -+add_executable(nekotools ${CMAKE_BINARY_DIR}/nekotools.c) -+target_link_libraries(nekotools libneko) - - file(GLOB CORE_NMLS RELATIVE ${CMAKE_SOURCE_DIR}/src src/core/*.nml) - set(nekoml_std ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.std) - add_custom_command(OUTPUT ${nekoml_std} - COMMAND ${set_neko_env} -- COMMAND ${neko_exec} ../boot/nekoml.n -nostd neko/Main.nml nekoml/Main.nml ${CORE_NMLS} -pack ${nekoml_std} -+ COMMAND ${neko_exec} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n -nostd neko/Main.nml nekoml/Main.nml ${CORE_NMLS} -pack ${nekoml_std} - VERBATIM -- DEPENDS zlib.ndll ${compilers_outputs} -+ DEPENDS zlib.ndll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nekoml.n - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src - ) -- --add_custom_target(compilers ALL -- DEPENDS ${compilers_outputs} ${nekoml_std} --) -+add_custom_target(nekoml.std ALL DEPENDS ${nekoml_std}) - - ####################### - -@@ -1193,11 +1226,11 @@ else() - endif() - - install ( -- TARGETS nekovm -- DESTINATION ${DEST_BIN} --) --install ( -- PROGRAMS ${compilers_outputs} -+ TARGETS -+ nekovm -+ nekoc -+ nekoml -+ nekotools - DESTINATION ${DEST_BIN} - ) - install ( -Index: neko-debian/src/tools/nekoboot.neko -=================================================================== ---- neko-debian.orig/src/tools/nekoboot.neko -+++ neko-debian/src/tools/nekoboot.neko -@@ -22,21 +22,158 @@ - - // primitives - --elf_update_section_header = $loader.loadprim("std@elf_update_section_header_for_bytecode",3); --file_contents = $loader.loadprim("std@file_contents",1); --file_open = $loader.loadprim("std@file_open",2); --file_write = $loader.loadprim("std@file_write",4); --file_write_char = $loader.loadprim("std@file_write_char",2); --file_close = $loader.loadprim("std@file_close",1); --command = $loader.loadprim("std@sys_command",1); --system = $loader.loadprim("std@sys_string",0)(); --cwd = $loader.loadprim("std@get_cwd",0)(); --get_env = $loader.loadprim("std@get_env",1); --string_split = $loader.loadprim("std@string_split",2); -+var c_src = "#include -+#include -+#include -+#include \"neko_vm.h\" -+#include \"neko_elf.h\" -+#ifdef NEKO_WINDOWS -+# include -+#else -+# include -+#endif -+#ifdef NEKO_MAC -+# include -+# include -+#endif -+#ifdef NEKO_BSD -+# include -+# include -+#endif -+#ifdef NEKO_POSIX -+# include -+#endif -+ -+#define default_loader neko_default_loader -+static FILE *self; -+unsigned char program[] = %s; -+unsigned int program_len = %d; -+unsigned int program_pos = 0; -+ -+static void report( neko_vm *vm, value exc, int isexc ) { -+ int i; -+ buffer b = alloc_buffer(NULL); -+ value st = neko_exc_stack(vm); -+ for(i=0;i available) mlen = available; -+ memcpy(val_string(str)+val_int(pos), prog, mlen); -+ program_pos += mlen; -+ return alloc_int(mlen); -+} -+ -+/* -+ C functions corresponding to the following Neko code : -+ -+ module_read = $loader.loadprim(\"std@module_read\",2); -+ module_exec = $loader.loadprim(\"std@module_exec\",1); -+ module_val = module_read(read_bytecode,$loader); -+ module_exec(module_val); -+ -+*/ -+ -+int neko_execute_self( neko_vm *vm, value mload ) { -+ value args[] = { alloc_string(\"std@module_read\"), alloc_int(2) }; -+ value args2[] = { alloc_string(\"std@module_exec\"), alloc_int(1) }; -+ value args3[] = { alloc_function(read_bytecode,3,\"boot_read_bytecode\"), mload }; -+ value exc = NULL; -+ value module_read, module_exec, module_val; -+ module_read = val_callEx(mload,val_field(mload,val_id(\"loadprim\")),args,2,&exc); -+ if( exc != NULL ) { -+ report(vm,exc,1); -+ return 1; -+ } -+ module_exec = val_callEx(mload,val_field(mload,val_id(\"loadprim\")),args2,2,&exc); -+ if( exc != NULL ) { -+ report(vm,exc,1); -+ return 1; -+ } -+ module_val = val_callEx(val_null,module_read,args3,2,&exc); -+ fclose(self); -+ if( exc != NULL ) { -+ report(vm,exc,1); -+ return 1; -+ } -+ alloc_field(val_field(mload,val_id(\"cache\")),val_id(\"_self\"),module_val); -+ val_callEx(val_null,module_exec,&module_val,1,&exc); -+ if( exc != NULL ) { -+ report(vm,exc,1); -+ return 1; -+ } -+ return 0; -+} -+ -+#ifdef NEKO_POSIX -+static void handle_signal( int signal ) { -+ if( signal == SIGPIPE ) -+ val_throw(alloc_string(\"Broken pipe\")); -+ else -+ val_throw(alloc_string(\"Segmentation fault\")); -+} -+#endif -+ -+int main( int argc, char *argv[] ) { -+ neko_vm *vm; -+ value mload; -+ int r; -+ neko_global_init(); -+ vm = neko_vm_alloc(NULL); -+ neko_vm_select(vm); -+ -+ mload = default_loader(argv+1,argc-1); -+ r = neko_execute_self(vm,mload); -+ if( mload != NULL && val_field(mload,val_id(\"dump_prof\")) != val_null ) -+ val_ocall0(mload,val_id(\"dump_prof\")); -+ vm = NULL; -+ mload = NULL; -+ neko_vm_select(NULL); -+ neko_global_free(); -+ return r; -+}"; -+ -+var elf_update_section_header = $loader.loadprim("std@elf_update_section_header_for_bytecode",3); -+var file_contents = $loader.loadprim("std@file_contents",1); -+var file_open = $loader.loadprim("std@file_open",2); -+var file_write = $loader.loadprim("std@file_write",4); -+var file_write_char = $loader.loadprim("std@file_write_char",2); -+var file_close = $loader.loadprim("std@file_close",1); -+var command = $loader.loadprim("std@sys_command",1); -+var system = $loader.loadprim("std@sys_string",0)(); -+var cwd = $loader.loadprim("std@get_cwd",0)(); -+var get_env = $loader.loadprim("std@get_env",1); -+var string_split = $loader.loadprim("std@string_split",2); -+var buffer_new = $loader.loadprim("std@buffer_new",0); -+var buffer_add = $loader.loadprim("std@buffer_add",2); -+var buffer_string = $loader.loadprim("std@buffer_string",1); -+var sprintf = $loader.loadprim("std@sprintf",2); - - // find a substring from then end - --find = function(str,sub,pos) { -+var find = function(str,sub,pos) { - var l1 = $ssize(str); - var l2 = $ssize(sub); - var i = l1 - pos; -@@ -50,7 +187,7 @@ find = function(str,sub,pos) { - - // find a file in a path - --find_exe_in_path = function(path,file) { -+var find_exe_in_path = function(path,file) { - while( path != null ) { - try { - var s = file_contents(path[0]+file); -@@ -64,7 +201,7 @@ find_exe_in_path = function(path,file) { - $throw("The bootable executable file was not found : "+file); - } - --find_exe_in_paths = function(paths,file) { -+var find_exe_in_paths = function(paths,file) { - var i = 0; - var len = $asize(paths); - while( i < len ) { -@@ -80,62 +217,94 @@ find_exe_in_paths = function(paths,file) - // bytecode = first argument - - var args = $loader.args; --var exe_ext = switch system { "Windows" => ".exe" default => "" }; --var boot_exe = "neko" + exe_ext; --if( args[0] == "-b" ) { -- boot_exe = args[1]; -- args = $asub(args,2,$asize(args)-2); --} --if( $asize(args) != 1 ) -- $throw("Need bytecode argument"); --var file = args[0]; --var bytecode = file_contents(file); -- --// load boot binary --var path_sep = switch system { -- "Windows" => ";" -- default => ":" --} --var path = string_split(get_env("PATH"), path_sep); --var boot = find_exe_in_paths($array($array(cwd,null),$loader.path,path),boot_exe); --var boot_size = $ssize(boot); -- --var dot_pos = find(file,".",1); --if( dot_pos != null ) -- file = $ssub(file,0,dot_pos); -- --// create executable file : --// this is the content of boot.bin where is appended --// the neko bytecode followed by 'NEKO' and the original exe size -- --var out_name = file+exe_ext; --var out = file_open(out_name,"wb"); --var bytecode_size = $ssize(bytecode); --var pad_size = (4-(boot_size&0x3)) & 0x3; -- --file_write(out,boot,0,boot_size); --boot_size += pad_size; --if( pad_size >= 3 ) file_write_char(out,0x00); --if( pad_size >= 2 ) file_write_char(out,0x00); --if( pad_size >= 1 ) file_write_char(out,0x00); --file_write(out,bytecode,0,bytecode_size) --file_write(out,"NEKO",0,4); --file_write_char(out,boot_size & 0xFF); --file_write_char(out,(boot_size >> 8) & 0xFF); --file_write_char(out,(boot_size >> 16) & 0xFF); --file_write_char(out,boot_size >>> 24); --file_close(out); -- --// set execution rights -- --switch system { -- "Windows" => null -- default => command("chmod 755 "+out_name) --} -+if( args[0] == "-c" ) { -+ -+ var file = args[1]; -+ var bytecode = file_contents(file); -+ var bytecode_len = $ssize(bytecode); -+ var program_buf = buffer_new(); -+ buffer_add(program_buf, "{"); -+ var i = 0; -+ while(true) { -+ buffer_add(program_buf, $sget(bytecode, i)); -+ i += 1; -+ if (i < bytecode_len) { -+ buffer_add(program_buf, ","); -+ } else { -+ break; -+ } -+ } -+ buffer_add(program_buf, "}"); -+ -+ // write a C source that run the module using neko -+ var c_name = if ($ssub(file, $ssize(file)-2, 2) == ".n") -+ $ssub(file, 0, $ssize(file)-2) + ".c"; -+ else -+ file+".c"; -+ var c_file = file_open(c_name,"wb"); -+ c_src = sprintf(c_src, $array(buffer_string(program_buf), bytecode_len, "%s")); -+ file_write(c_file, c_src, 0, $ssize(c_src)); -+ file_close(c_file); -+ -+} else { -+ -+ var exe_ext = switch system { "Windows" => ".exe" default => "" }; -+ var boot_exe = "neko" + exe_ext; -+ if( args[0] == "-b" ) { -+ boot_exe = args[1]; -+ args = $asub(args,2,$asize(args)-2); -+ } -+ if( $asize(args) != 1 ) -+ $throw("Need bytecode argument"); -+ var file = args[0]; -+ var bytecode = file_contents(file); -+ -+ // load boot binary -+ var path_sep = switch system { -+ "Windows" => ";" -+ default => ":" -+ } -+ var path = string_split(get_env("PATH"), path_sep); -+ var boot = find_exe_in_paths($array($array(cwd,null),$loader.path,path),boot_exe); -+ var boot_size = $ssize(boot); -+ -+ var dot_pos = find(file,".",1); -+ if( dot_pos != null ) -+ file = $ssub(file,0,dot_pos); -+ -+ // create executable file : -+ // this is the content of boot.bin where is appended -+ // the neko bytecode followed by 'NEKO' and the original exe size -+ -+ var out_name = file+exe_ext; -+ var out = file_open(out_name,"wb"); -+ var bytecode_size = $ssize(bytecode); -+ var pad_size = (4-(boot_size&0x3)) & 0x3; -+ -+ file_write(out,boot,0,boot_size); -+ boot_size += pad_size; -+ if( pad_size >= 3 ) file_write_char(out,0x00); -+ if( pad_size >= 2 ) file_write_char(out,0x00); -+ if( pad_size >= 1 ) file_write_char(out,0x00); -+ file_write(out,bytecode,0,bytecode_size) -+ file_write(out,"NEKO",0,4); -+ file_write_char(out,boot_size & 0xFF); -+ file_write_char(out,(boot_size >> 8) & 0xFF); -+ file_write_char(out,(boot_size >> 16) & 0xFF); -+ file_write_char(out,boot_size >>> 24); -+ file_close(out); -+ -+ // set execution rights -+ -+ switch system { -+ "Windows" => null -+ default => command("chmod 755 "+out_name) -+ } - --// Update ELF section header (on platforms where that is appropriate) to protect --// binary's bytecode from being removed by the strip program -+ // Update ELF section header (on platforms where that is appropriate) to protect -+ // binary's bytecode from being removed by the strip program - --var res = elf_update_section_header(out_name,boot_size,bytecode_size+8); --if( res == 0 ) -+ var res = elf_update_section_header(out_name,boot_size,bytecode_size+8); -+ if( res == 0 ) - $print("Trouble updating elf section header; stripping binary may lead to problems!") -+} -\ No newline at end of file diff -Nru neko-2.1.0/debian/patches/boot-c-2.diff neko-2.2.0/debian/patches/boot-c-2.diff --- neko-2.1.0/debian/patches/boot-c-2.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/boot-c-2.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -From fe87462d9c7a6ee27e28f5be5e4fc0ac87b34574 Mon Sep 17 00:00:00 2001 -From: Andy Li -Date: Thu, 12 May 2016 15:56:02 +0800 -Subject: [PATCH] nekotools boot -c: removed unused self variable and the - fclose that caused sigfault - ---- - src/tools/nekoboot.neko | 2 -- - 1 file changed, 2 deletions(-) - -Index: neko-debian/src/tools/nekoboot.neko -=================================================================== ---- neko-debian.orig/src/tools/nekoboot.neko -+++ neko-debian/src/tools/nekoboot.neko -@@ -45,7 +45,6 @@ var c_src = "#include - #endif - - #define default_loader neko_default_loader --static FILE *self; - unsigned char program[] = %s; - unsigned int program_len = %d; - unsigned int program_pos = 0; -@@ -113,7 +112,6 @@ int neko_execute_self( neko_vm *vm, valu - return 1; - } - module_val = val_callEx(val_null,module_read,args3,2,&exc); -- fclose(self); - if( exc != NULL ) { - report(vm,exc,1); - return 1; diff -Nru neko-2.1.0/debian/patches/hurd.diff neko-2.2.0/debian/patches/hurd.diff --- neko-2.1.0/debian/patches/hurd.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/hurd.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,145 +0,0 @@ -Description: Fix compile errors on hurd-i386. Committed in upstream: https://github.com/HaxeFoundation/neko/commit/d7e1293a712e5996b1fdd617fa370e8c420e841f -From d7e1293a712e5996b1fdd617fa370e8c420e841f Mon Sep 17 00:00:00 2001 -From: Andy Li -Date: Wed, 18 May 2016 03:48:15 +0800 -Subject: [PATCH] Compile fix for GNU Hurd. See - https://github.com/HaxeFoundation/neko-debian/blob/2.0.0-4/debian/patches/hurd.diff - ---- - libs/common/osdef.h | 8 ++++++-- - libs/std/sys.c | 17 ++++++++++++++++- - vm/main.c | 4 +++- - vm/neko.h.in | 8 ++++++-- - 4 files changed, 31 insertions(+), 6 deletions(-) - -diff --git a/libs/common/osdef.h b/libs/common/osdef.h -index 1daebb9..78266bf 100644 ---- a/libs/common/osdef.h -+++ b/libs/common/osdef.h -@@ -26,7 +26,7 @@ - # define OS_WINDOWS - #endif - --#if defined(__APPLE__) || defined(__MACH__) || defined(macintosh) -+#if defined(__APPLE__) || defined(macintosh) - # define OS_MAC - #endif - -@@ -38,7 +38,11 @@ - # define OS_BSD - #endif - --#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD) -+#if defined(__GNU__) -+# define OS_HURD -+#endif -+ -+#if defined(OS_LINUX) || defined(OS_MAC) || defined(OS_BSD) || defined(OS_GNUKBSD) || defined (OS_HURD) - # define OS_POSIX - #endif - -diff --git a/libs/std/sys.c b/libs/std/sys.c -index 8003d41..9fa1b12 100644 ---- a/libs/std/sys.c -+++ b/libs/std/sys.c -@@ -198,6 +198,8 @@ static value sys_string() { - return alloc_string("Linux"); - #elif defined(NEKO_BSD) - return alloc_string("BSD"); -+#elif defined(NEKO_HURD) -+ return alloc_string("GNU/Hurd"); - #elif defined(NEKO_MAC) - return alloc_string("Mac"); - #else -@@ -537,6 +539,14 @@ static value file_full_path( value path ) { - if( GetFullPathName(val_string(path),MAX_PATH+1,buf,NULL) == 0 ) - neko_error(); - return alloc_string(buf); -+#elif defined(__GLIBC__) -+ val_check(path,string); -+ char *buf = realpath(val_string(path), NULL); -+ if( buf == NULL ) -+ neko_error(); -+ value ret = alloc_string(buf); -+ free(buf); -+ return ret; - #else - char buf[PATH_MAX]; - val_check(path,string); -@@ -562,7 +572,7 @@ static value sys_exe_path() { - if( _NSGetExecutablePath(path, &path_len) ) - neko_error(); - return alloc_string(path); --#else -+#elif defined(NEKO_LINUX) - const char *p = getenv("_"); - if( p != NULL ) - return alloc_string(p); -@@ -574,6 +584,11 @@ static value sys_exe_path() { - path[length] = '\0'; - return alloc_string(path); - } -+#else -+ const char *p = getenv("_"); -+ if( p != NULL ) -+ return alloc_string(p); -+ neko_error(); - #endif - } - -diff --git a/vm/main.c b/vm/main.c -index c996a9f..2c21696 100644 ---- a/vm/main.c -+++ b/vm/main.c -@@ -91,7 +91,7 @@ static char *executable_path() { - sysctl(mib, 4, path, &cb, NULL, 0); - if (!cb) return NULL; - return path; --#else -+#elif defined(NEKO_LINUX) - static char path[200]; - int length = readlink("/proc/self/exe", path, sizeof(path)); - if( length < 0 || length >= 200 ) { -@@ -102,6 +102,8 @@ static char *executable_path() { - } - path[length] = '\0'; - return path; -+#else -+ return getenv("_"); - #endif - } - -diff --git a/vm/neko.h.in b/vm/neko.h.in -index bb9ec1b..2009678 100644 ---- a/vm/neko.h.in -+++ b/vm/neko.h.in -@@ -27,7 +27,7 @@ - # define NEKO_WINDOWS - #endif - --#if defined(__APPLE__) || defined(__MACH__) || defined(macintosh) -+#if defined(__APPLE__) || defined(macintosh) - # define NEKO_MAC - #endif - -@@ -43,6 +43,10 @@ - # define NEKO_BSD - #endif - -+#if defined(__GNU__) -+# define NEKO_HURD -+#endif -+ - // COMPILER/PROCESSOR FLAGS - #if defined(__GNUC__) - # define NEKO_GCC -@@ -70,7 +74,7 @@ - # define NEKO_64BITS - #endif - --#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD) -+#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD) || defined(NEKO_HURD) - # define NEKO_POSIX - #endif - - diff -Nru neko-2.1.0/debian/patches/mincoming-stack-boundary.diff neko-2.2.0/debian/patches/mincoming-stack-boundary.diff --- neko-2.1.0/debian/patches/mincoming-stack-boundary.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/mincoming-stack-boundary.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -From 4b78044643c459a63bc87f6eadd50991df0301c7 Mon Sep 17 00:00:00 2001 -From: Andy Li -Date: Mon, 6 Jun 2016 22:22:57 +0000 -Subject: [PATCH] only use -mincoming-stack-boundary when it is available - From upstream: https://github.com/HaxeFoundation/neko/commit/4b78044643c459a63bc87f6eadd50991df0301c7 - ---- - CMakeLists.txt | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -Index: neko-debian/CMakeLists.txt -=================================================================== ---- neko-debian.orig/CMakeLists.txt -+++ neko-debian/CMakeLists.txt -@@ -1,5 +1,6 @@ - cmake_minimum_required(VERSION 2.8.7) - -+include(CheckCCompilerFlag) - project(neko C) - - set(CMAKE_OSX_ARCHITECTURES x86_64) -@@ -191,7 +192,13 @@ if(UNIX) - - # https://github.com/HaxeFoundation/neko/pull/17 - if(CMAKE_SIZEOF_VOID_P EQUAL 4) -- add_compile_options(-mincoming-stack-boundary=2) -+ check_c_compiler_flag(-mincoming-stack-boundary=2 HAS_MINCOMING_STACK_BOUNDARY) -+ check_c_compiler_flag(-mstack-alignment=2 HAS_MSTACK_ALIGNMENT) -+ if(HAS_MINCOMING_STACK_BOUNDARY) -+ add_compile_options(-mincoming-stack-boundary=2) -+ elseif(HAS_MSTACK_ALIGNMENT) -+ add_compile_options(-mstack-alignment=2) -+ endif() - endif() - - find_package(PkgConfig REQUIRED) diff -Nru neko-2.1.0/debian/patches/no-openssl.diff neko-2.2.0/debian/patches/no-openssl.diff --- neko-2.1.0/debian/patches/no-openssl.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/no-openssl.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -Description: OpenSSL is in fact not required -Author: Andy Li -Index: neko-debian/CMakeLists.txt -=================================================================== ---- neko-debian.orig/CMakeLists.txt -+++ neko-debian/CMakeLists.txt -@@ -538,7 +538,7 @@ if (STATIC_MARIADBCONNECTOR) - else() - find_package(MariaDBConnector REQUIRED) - if (NOT APPLE) -- find_package(OpenSSL REQUIRED) -+ find_package(OpenSSL) - endif() - endif() - -@@ -547,7 +547,7 @@ target_include_directories(mysql.ndll - ${MARIADB_CONNECTOR_INCLUDE_DIR} - ) - --target_link_libraries(mysql.ndll libneko ${OPENSSL_LIBRARIES} ${MARIADB_CONNECTOR_LIBRARIES}) -+target_link_libraries(mysql.ndll libneko ${MARIADB_CONNECTOR_LIBRARIES}) - - set_target_properties(mysql.ndll - PROPERTIES diff -Nru neko-2.1.0/debian/patches/series neko-2.2.0/debian/patches/series --- neko-2.1.0/debian/patches/series 2016-06-12 15:27:27.000000000 +0000 +++ neko-2.2.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -hurd.diff -no-openssl.diff -mincoming-stack-boundary.diff -boot-c-1.diff -boot-c-2.diff -tests-1.diff -tests-2.diff diff -Nru neko-2.1.0/debian/patches/tests-1.diff neko-2.2.0/debian/patches/tests-1.diff --- neko-2.1.0/debian/patches/tests-1.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/tests-1.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -From a2e010578ec40ca79b6b33b8b1e281549692296d Mon Sep 17 00:00:00 2001 -From: Andy Li -Date: Thu, 12 May 2016 16:14:48 +0800 -Subject: [PATCH] added test to run nekoc, nekoml, and nekotools - ---- - CMakeLists.txt | 22 ++++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - -Index: neko-debian/CMakeLists.txt -=================================================================== ---- neko-debian.orig/CMakeLists.txt -+++ neko-debian/CMakeLists.txt -@@ -381,11 +381,6 @@ if(UNIX) - target_link_libraries(libneko dl m ${CMAKE_THREAD_LIBS_INIT}) - endif() - --set_target_properties(nekovm -- PROPERTIES -- OUTPUT_NAME neko --) -- - set_target_properties(nekovm libneko - PROPERTIES - OUTPUT_NAME neko -@@ -1344,8 +1339,23 @@ add_test(NAME test.n - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) - -+add_test(NAME nekoc -+ COMMAND nekoc -+ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -+) -+ -+add_test(NAME nekoml -+ COMMAND nekoc -+ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -+) -+ -+add_test(NAME nekotools -+ COMMAND nekoc -+ WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -+) -+ - if (UNIX AND NOT APPLE) -- set_tests_properties(-version test.n -+ set_tests_properties(-version test.n nekoc nekoml nekotools - PROPERTIES - ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) diff -Nru neko-2.1.0/debian/patches/tests-2.diff neko-2.2.0/debian/patches/tests-2.diff --- neko-2.1.0/debian/patches/tests-2.diff 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/patches/tests-2.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -From 4da3eb136d660d27be12490fc11105fea3f319ab Mon Sep 17 00:00:00 2001 -From: Andy Li -Date: Thu, 12 May 2016 16:41:32 +0800 -Subject: [PATCH] run the right binaries... - ---- - CMakeLists.txt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index fee205a..ce7036f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1347,12 +1347,12 @@ add_test(NAME nekoc - ) - - add_test(NAME nekoml -- COMMAND nekoc -+ COMMAND nekoml - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) - - add_test(NAME nekotools -- COMMAND nekoc -+ COMMAND nekotools - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) - diff -Nru neko-2.1.0/debian/rules neko-2.2.0/debian/rules --- neko-2.1.0/debian/rules 2016-06-12 16:28:16.000000000 +0000 +++ neko-2.2.0/debian/rules 2018-03-28 09:43:06.000000000 +0000 @@ -13,15 +13,28 @@ export DEB_CFLAGS_MAINT_APPEND = -fno-strict-aliasing endif +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + override_dh_auto_configure: - dh_auto_configure -- -DSTATIC_DEPS=MbedTLS -DCMAKE_SKIP_RPATH=ON -DRUN_LDCONFIG=OFF + dh_auto_configure -- \ + -DSTATIC_DEPS=MbedTLS \ + -DCMAKE_INSTALL_INCLUDEDIR=include/$(DEB_HOST_MULTIARCH) \ + -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ + -DCMAKE_SKIP_RPATH=ON \ + -DRUN_LDCONFIG=OFF mkdir -p build/libs/src - cp debian/mbedtls-2.2.1-apache.tgz build/libs/src/mbedtls-2.2.1-apache.tgz + cp debian/mbedtls-2.6.0-apache.tgz build/libs/download/mbedtls-2.6.0-apache.tgz + echo "LoadModule neko_module /usr/lib/$(DEB_HOST_MULTIARCH)/neko/mod_neko2.ndll" > debian/neko.load # dh_shlibdeps does not see the ndll files as libraries, so we call dpkg-shlibdeps manually override_dh_shlibdeps: dh_shlibdeps - dpkg-shlibdeps -Tdebian/neko.substvars debian/neko/usr/bin/* debian/neko/usr/lib/neko/*.ndll + dpkg-shlibdeps -Tdebian/neko.substvars debian/neko/usr/bin/* debian/neko/usr/lib/*/neko/*.ndll + +override_dh_missing: + dh_missing --fail-missing get-orig-source: uscan --verbose --rename --force-download diff -Nru neko-2.1.0/debian/source/include-binaries neko-2.2.0/debian/source/include-binaries --- neko-2.1.0/debian/source/include-binaries 2016-06-12 15:26:46.000000000 +0000 +++ neko-2.2.0/debian/source/include-binaries 2018-03-28 09:40:51.000000000 +0000 @@ -1 +1 @@ -debian/mbedtls-2.2.1-apache.tgz \ No newline at end of file +debian/mbedtls-2.6.0-apache.tgz \ No newline at end of file diff -Nru neko-2.1.0/debian/tests/control neko-2.2.0/debian/tests/control --- neko-2.1.0/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/debian/tests/control 2018-03-28 09:29:31.000000000 +0000 @@ -0,0 +1,2 @@ +Tests: neko-test +Depends: @ diff -Nru neko-2.1.0/debian/tests/neko-test neko-2.2.0/debian/tests/neko-test --- neko-2.1.0/debian/tests/neko-test 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/debian/tests/neko-test 2018-03-28 09:29:31.000000000 +0000 @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +testdir=$(mktemp -d) +trap "rm -rf ${testdir}" 0 INT QUIT ABRT PIPE TERM +cd ${testdir} + +cat <<'EOF' > test.neko +$print("The virtual machine is working !\n"); +test = $loader.loadprim("std@test",0); +test(); +$print("Test successful\n"); +EOF + +nekoc test.neko + +echo "compile: OK" + +neko test.n | grep -q "Test successful" + +echo "run: OK" diff -Nru neko-2.1.0/debian/watch neko-2.2.0/debian/watch --- neko-2.1.0/debian/watch 2016-06-11 19:00:12.000000000 +0000 +++ neko-2.2.0/debian/watch 2018-03-28 09:29:31.000000000 +0000 @@ -1,2 +1,3 @@ version=3 -http://nekovm.org/download .*/neko-(\d\.\d\.\d)-src\.tar\.gz \ No newline at end of file +opts="uversionmangle=s/-/./g"\ + https://nekovm.org/download/ https://github.com/HaxeFoundation/neko/archive/v(\d\-\d\-\d)\.tar\.gz \ No newline at end of file diff -Nru neko-2.1.0/deploy.sh neko-2.2.0/deploy.sh --- neko-2.1.0/deploy.sh 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/deploy.sh 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,22 @@ +#!/bin/bash + +set -ex + +if [ -z $haxeci_decrypt ]; then + echo "haxeci_decrypt is unset, skip deploy" + exit +fi + +openssl aes-256-cbc -k "$haxeci_decrypt" -in haxeci_ssh.enc -out haxeci_ssh -d +chmod 600 haxeci_ssh +eval `ssh-agent -s` +ssh-add haxeci_ssh +openssl aes-256-cbc -k "$haxeci_decrypt" -in haxeci_sec.gpg.enc -out haxeci_sec.gpg -d +gpg --allow-secret-key-import --import haxeci_sec.gpg +sudo apt-get install devscripts git-buildpackage ubuntu-dev-tools dh-make dh-apache2 -y +git config --global user.name "${DEBFULLNAME}" +git config --global user.email "${DEBEMAIL}" + +pushd build + make upload_to_ppa +popd diff -Nru neko-2.1.0/extra/chocolateyInstall.ps1 neko-2.2.0/extra/chocolateyInstall.ps1 --- neko-2.1.0/extra/chocolateyInstall.ps1 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/extra/chocolateyInstall.ps1 2017-12-19 06:38:08.000000000 +0000 @@ -10,4 +10,4 @@ } # Set NEKOPATH such that the ndll files can be loaded. -Install-ChocolateyEnvironmentVariable NEKOPATH $scriptPath \ No newline at end of file +Install-ChocolateyEnvironmentVariable -VariableName NEKOPATH -VariableValue $scriptPath \ No newline at end of file diff -Nru neko-2.1.0/extra/chocolateyUninstall.ps1 neko-2.2.0/extra/chocolateyUninstall.ps1 --- neko-2.1.0/extra/chocolateyUninstall.ps1 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/extra/chocolateyUninstall.ps1 2017-12-19 06:38:08.000000000 +0000 @@ -6,4 +6,6 @@ foreach ($file in $dllFiles) { $dllFile = Join-Path $chocoBin $file del "$dllFile" -} \ No newline at end of file +} + +Uninstall-ChocolateyEnvironmentVariable -VariableName NEKOPATH \ No newline at end of file diff -Nru neko-2.1.0/extra/neko.nuspec neko-2.2.0/extra/neko.nuspec --- neko-2.1.0/extra/neko.nuspec 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/extra/neko.nuspec 2017-12-19 06:38:08.000000000 +0000 @@ -1,4 +1,4 @@ - + neko @@ -8,12 +8,19 @@ Haxe Foundation https://github.com/HaxeFoundation/neko/blob/master/LICENSE http://nekovm.org/ + http://nekovm.org/doc + https://groups.google.com/forum/#!forum/haxelang + https://github.com/HaxeFoundation/neko/issues + https://github.com/HaxeFoundation/neko + https://github.com/HaxeFoundation/neko/tree/master/extra https://cdn.rawgit.com/andyli/cc07575f598351e0ad74/raw/6a9cae9a136670c0052356b773f8e13bf37c13dd/logo.png false + Neko is a lightweight and yet well optimized virtual machine. Neko is a lightweight and yet well optimized virtual machine. The VM can be easily embedded into any application and your libraries can be accessed using the C foreign function interface. - neko haxe vm + https://github.com/HaxeFoundation/neko/blob/master/CHANGES + neko haxe vm admin - + - \ No newline at end of file + diff -Nru neko-2.1.0/libs/CMakeLists.txt neko-2.2.0/libs/CMakeLists.txt --- neko-2.1.0/libs/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,196 @@ +add_subdirectory(common) +add_subdirectory(std) +add_subdirectory(zlib) +if (WITH_MYSQL) + add_subdirectory(mysql) +endif() +if (WITH_REGEXP) + add_subdirectory(regexp) +endif() +if (WITH_SQLITE) + add_subdirectory(sqlite) +endif() +if (WITH_SSL) + add_subdirectory(ssl) +endif() +if (WITH_UI) + add_subdirectory(ui) +endif() + +if (WITH_APACHE) + # Locate Apache + if (STATIC_APACHE) + if (STATIC_OPENSSL) + set(OPENSSL_CONF --with-openssl=${CMAKE_BINARY_DIR}/libs/src/install-prefix) + set(OPENSSL_DEP OpenSSL) + elseif() + set(OPENSSL_CONF "") + set(OPENSSL_DEP "") + endif() + if (STATIC_APR) + set(APR_CONF --with-apr=${CMAKE_BINARY_DIR}/libs/src/install-prefix) + set(APR_DEP APR) + elseif() + set(APR_CONF "") + set(APR_DEP "") + endif() + if (STATIC_APRUTIL) + set(APRUTIL_CONF --with-apr-util=${CMAKE_BINARY_DIR}/libs/src/install-prefix) + set(APRUTIL_DEP APRutil) + elseif() + set(APRUTIL_CONF "") + set(APRUTIL_DEP "") + endif() + if (STATIC_PCRE) + set(PCRE_CONF --with-pcre=${CMAKE_BINARY_DIR}/libs/src/install-prefix) + set(PCRE_DEP PCRE) + elseif() + set(PCRE_CONF "") + set(PCRE_DEP "") + endif() + if (STATIC_ZLIB) + set(ZLIB_CONF --with-z=${CMAKE_BINARY_DIR}/libs/src/install-prefix) + set(ZLIB_DEP Zlib) + elseif() + set(ZLIB_CONF "") + set(ZLIB_DEP "") + endif() + + if (APPLE) + set(APACHE_CFLAGS "-w -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + else() + set(APACHE_CFLAGS "-w") + endif() + + if(WIN32) + set(APR_CONFIGS + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix + -Wno-dev + -DAPR_INSTALL_PRIVATE_H=ON + -DINSTALL_PDB=OFF + ) + else() + set(APR_CONFIGS + CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && + ./configure --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix + --enable-shared=no + --enable-static=yes + --silent + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && + make "CFLAGS=${APACHE_CFLAGS}" + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APR && + make install + ) + endif() + ExternalProject_Add(APR + ${EP_CONFIGS} + URL http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz + URL_MD5 98492e965963f852ab29f9e61b2ad700 + ${APR_CONFIGS} + ) + set_target_properties(APR PROPERTIES ${EP_PROPS}) + + + if(WIN32) + set(APRutil_CONFIGS + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix + -Wno-dev + -DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix + -DINSTALL_PDB=OFF + ) + else() + set(APRutil_CONFIGS + CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && + ./configure + --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix + --silent + ${APR_CONF} + ${OPENSSL_CONF} + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && + make "CFLAGS=${APACHE_CFLAGS}" + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/APRutil && + make install + ) + endif() + ExternalProject_Add(APRutil + ${EP_CONFIGS} + DEPENDS ${APR_DEP} ${OPENSSL_DEP} + URL http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz + URL_MD5 866825c04da827c6e5f53daff5569f42 + ${APRutil_CONFIGS} + ) + set_target_properties(APRutil PROPERTIES ${EP_PROPS}) + + + if(WIN32) + set(Apache_CONFIGS + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix + -Wno-dev + -DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix + "-DEXTRA_COMPILE_FLAGS=/D PCRE_STATIC" + -DEXTRA_LIBS=Ws2_32 + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Apache-build && + ${CMAKE_COMMAND} --build . --target libhttpd --config ${CMAKE_CFG_INTDIR} + INSTALL_COMMAND echo skip install + ) + set(APACHE_INCLUDE_DIRS + ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include + ${CMAKE_BINARY_DIR}/libs/src/Apache/include + ${CMAKE_BINARY_DIR}/libs/src/Apache/os/win32 + ${CMAKE_BINARY_DIR}/libs/src/Apache-build + ) + set(APACHE_LIBRARIES + ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libapr-1.lib + ${CMAKE_BINARY_DIR}/libs/src/Apache-build/${CMAKE_CFG_INTDIR}/libhttpd.lib + ) + else() + set(Apache_CONFIGS + CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Apache && + ./configure + --prefix=${CMAKE_BINARY_DIR}/libs/src/Apache-build + --silent + ${APR_CONF} + ${APRUTIL_CONF} + ${OPENSSL_CONF} + ${PCRE_CONF} + ${ZLIB_CONF} + BUILD_COMMAND echo skip build + INSTALL_COMMAND echo skip install + ) + set(APACHE_INCLUDE_DIRS + ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include/apr-1 + ${CMAKE_BINARY_DIR}/libs/src/Apache/include + ${CMAKE_BINARY_DIR}/libs/src/Apache/os/unix + ) + set(APACHE_LIBRARIES + + ) + endif() + ExternalProject_Add(Apache + ${EP_CONFIGS} + DEPENDS ${APR_DEP} ${APRUTIL_DEP} ${OPENSSL_DEP} ${PCRE_DEP} + URL http://archive.apache.org/dist/httpd/httpd-2.4.29.tar.gz + URL_MD5 6380b0856658f07479fdcba9e20294a6 + ${Apache_CONFIGS} + ) + set_target_properties(Apache PROPERTIES ${EP_PROPS}) + # Download sources for fat source archive + add_dependencies(download_static_deps Apache-download) + add_dependencies(download_static_deps APR-download) + add_dependencies(download_static_deps APRutil-download) + else() + find_package(APACHE REQUIRED) + find_package(APR REQUIRED) + set(APACHE_LIBRARIES ${APR_LIBRARIES} ${APRUTIL_LIBRARIES}) + if(HTTPD_LIBRARIES) + list(APPEND APACHE_LIBRARIES ${HTTPD_LIBRARIES}) + endif() + set(APACHE_INCLUDE_DIRS ${APACHE_INCLUDE_DIR} ${APR_INCLUDE_DIR} ${APRUTIL_INCLUDE_DIR}) + endif() + + add_subdirectory(mod_neko) + add_subdirectory(mod_tora) +endif() diff -Nru neko-2.1.0/libs/common/CMakeLists.txt neko-2.2.0/libs/common/CMakeLists.txt --- neko-2.1.0/libs/common/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/common/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,7 @@ +configure_file ( + "${CMAKE_CURRENT_SOURCE_DIR}/osdef.h.in" + "${CMAKE_BINARY_DIR}/osdef.h" +) + +add_library(socket STATIC socket.c) +add_library(sha1 STATIC sha1.c) diff -Nru neko-2.1.0/libs/common/osdef.h neko-2.2.0/libs/common/osdef.h --- neko-2.1.0/libs/common/osdef.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/common/osdef.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright (C)2005-2016 Haxe Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -#ifndef OS_H -#define OS_H - -#if defined(_WIN32) -# define OS_WINDOWS -#endif - -#if defined(__APPLE__) || defined(__MACH__) || defined(macintosh) -# define OS_MAC -#endif - -#if defined(linux) || defined(__linux__) -# define OS_LINUX -#endif - -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -# define OS_BSD -#endif - -#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD) -# define OS_POSIX -#endif - -#if defined(OS_WINDOWS) -# define LITTLE_ENDIAN 1 -# define BIG_ENDIAN 2 -# define BYTE_ORDER LITTLE_ENDIAN -#elif defined(OS_MAC) || defined(OS_BSD) -# include -#else -# include -#endif - -#ifndef BYTE_ORDER -# warning BYTE_ORDER unknown, assuming BIG_ENDIAN -# define BYTE_ORDER BIG_ENDIAN -#endif - -#if BYTE_ORDER == BIG_ENDIAN -# define IS_BIG_ENDIAN -#else -# define IS_LITTLE_ENDIAN -#endif - -#ifndef true -# define true 1 -# define false 0 - typedef int bool; -#endif - -#endif -/* ************************************************************************ */ diff -Nru neko-2.1.0/libs/common/osdef.h.in neko-2.2.0/libs/common/osdef.h.in --- neko-2.1.0/libs/common/osdef.h.in 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/common/osdef.h.in 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * Copyright (C)2005-2017 Haxe Foundation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef OS_H +#define OS_H + +#if defined(_WIN32) +# define OS_WINDOWS +#endif + +#if defined(__APPLE__) || defined(macintosh) +# define OS_MAC +#endif + +#if defined(linux) || defined(__linux__) +# define OS_LINUX +#endif + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +# define OS_BSD +#endif + +#if defined(__GNU__) +# define OS_HURD +#endif + +#if defined(__CYGWIN__) +# define OS_CYGWIN +#endif + +#if defined(OS_LINUX) || defined(OS_MAC) || defined(OS_BSD) || defined(OS_GNUKBSD) || defined (OS_HURD) || defined (OS_CYGWIN) +# define OS_POSIX +#endif + +#if defined(OS_MAC) || defined(OS_BSD) +# include +#elif !defined(OS_WINDOWS) +# include +#endif + +#cmakedefine NEKO_BIG_ENDIAN + +#ifndef NEKO_BIG_ENDIAN +# define NEKO_LITTLE_ENDIAN +#endif + +#ifndef true +# define true 1 +# define false 0 + typedef int bool; +#endif + +#endif +/* ************************************************************************ */ diff -Nru neko-2.1.0/libs/common/sha1.c neko-2.2.0/libs/common/sha1.c --- neko-2.1.0/libs/common/sha1.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/common/sha1.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,7 +27,7 @@ // original code by Steve Reid #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) -#ifdef IS_BIG_ENDIAN +#ifdef NEKO_BIG_ENDIAN # define blk0(i) block[i] #else # define blk0(i) (block[i] = (rol(block[i],24)&0xFF00FF00) \ diff -Nru neko-2.1.0/libs/common/sha1.h neko-2.2.0/libs/common/sha1.h --- neko-2.1.0/libs/common/sha1.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/common/sha1.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/common/socket.c neko-2.2.0/libs/common/socket.c --- neko-2.1.0/libs/common/socket.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/common/socket.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -120,7 +120,7 @@ PHOST ip = inet_addr(host); if( ip == INADDR_NONE ) { struct hostent *h; -# if defined(OS_WINDOWS) || defined(OS_MAC) +# if defined(OS_WINDOWS) || defined(OS_MAC) || defined(OS_CYGWIN) h = gethostbyname(host); # else struct hostent hbase; diff -Nru neko-2.1.0/libs/common/socket.h neko-2.2.0/libs/common/socket.h --- neko-2.1.0/libs/common/socket.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/common/socket.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/gc/av_safety.patch neko-2.2.0/libs/gc/av_safety.patch --- neko-2.1.0/libs/gc/av_safety.patch 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/gc/av_safety.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -Index: msvc_dbg.c -=================================================================== ---- msvc_dbg.c (revision 1849) -+++ msvc_dbg.c (working copy) -@@ -77,12 +77,8 @@ - // Save and restore current directory around SymLoadModule, see KB article Q189780 - GetCurrentDirectoryA(sizeof(curDir), curDir); - GetModuleFileNameA(NULL, exePath, sizeof(exePath)); --#if defined(_MSC_VER) && _MSC_VER == 1200 - /* use strcat for VC6 */ - strcat(exePath, "\\.."); --#else -- strcat_s(exePath, sizeof(exePath), "\\.."); --#endif /* _MSC_VER >= 1200 */ - SetCurrentDirectoryA(exePath); - #ifdef _DEBUG - GetCurrentDirectoryA(sizeof(exePath), exePath); -Index: win32_threads.c -=================================================================== ---- win32_threads.c (revision 1849) -+++ win32_threads.c (working copy) -@@ -711,8 +711,12 @@ - # endif - return; - } -- if (SuspendThread(t -> handle) == (DWORD)-1) -- ABORT("SuspendThread failed"); -+ if (SuspendThread(t -> handle) == (DWORD)-1) { -+ // ABORT("SuspendThread failed"); -+ t->stack_base = 0; -+ GC_delete_gc_thread(t); -+ return; -+ } - # endif - t -> suspended = TRUE; - } -@@ -834,8 +838,10 @@ - } else { - CONTEXT context; - context.ContextFlags = CONTEXT_INTEGER|CONTEXT_CONTROL; -- if (!GetThreadContext(thread -> handle, &context)) -- ABORT("GetThreadContext failed"); -+ if (!GetThreadContext(thread -> handle, &context)) { -+ //ABORT("GetThreadContext failed"); -+ return; -+ } - - /* Push all registers that might point into the heap. Frame */ - /* pointer registers are included in case client code was */ -@@ -1451,6 +1457,7 @@ - # ifdef THREAD_LOCAL_ALLOC - ABORT("Cannot initialize thread local cache from DllMain"); - # endif -+ if( sb.mem_base ) - GC_register_my_thread_inner(&sb, thread_id); - } /* o.w. we already did it during GC_thr_init(), called by GC_init() */ - break; diff -Nru neko-2.1.0/libs/gc/CMakeLists.txt neko-2.2.0/libs/gc/CMakeLists.txt --- neko-2.1.0/libs/gc/CMakeLists.txt 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/gc/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,231 +0,0 @@ -# -# Copyright (c) 1994 by Xerox Corporation. All rights reserved. -# Copyright (c) 1996 by Silicon Graphics. All rights reserved. -# Copyright (c) 1998 by Fergus Henderson. All rights reserved. -# Copyright (c) 2000-2010 by Hewlett-Packard Company. All rights reserved. -## -# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -# OR IMPLIED. ANY USE IS AT YOUR OWN RISK. -## -# Permission is hereby granted to use or copy this program -# for any purpose, provided the above notices are retained on all copies. -# Permission to modify the code and to distribute modified code is granted, -# provided the above notices are retained, and a notice that the code was -# modified is included with the above copyright notice. -## - -# -# get cmake and run: -# cmake -G "Visual Studio 8 2005" -# in the same dir as this file -# this will generate gc.sln -# - -SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required - -PROJECT(gc) - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE - -DALL_INTERIOR_POINTERS - -DGC_BUILD -") - -IF(APPLE) - SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE) -ENDIF(APPLE) - -#LIBATOMIC #TODO -#ADD_LIBRARY(atomic_ops STATIC ) -#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING) - - -#LIBGC - -INCLUDE_DIRECTORIES(include) -INCLUDE_DIRECTORIES(libatomic_ops-1.2/src) - -SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c - mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c - new_hblk.c dbg_mlc.c malloc.c stubborn.c dyn_load.c - typd_mlc.c ptr_chck.c gc_cpp.cc mallocx.c checksums.c - thread_local_alloc.c) -SET(LIBS) -OPTION(enable_threads "TODO" NO) -IF(enable_threads) - FIND_PACKAGE(Threads REQUIRED) - MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" ) - INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR}) - SET(LIBS ${LIBS} ${Threads_LIBRARIES}) -ENDIF(enable_threads) - -OPTION(enable_parallel_mark "Parallelize marking and free list construction" NO) - -#IF(Threads_FOUND) -# ADD_DEFINITIONS("") -#ELSE -# MESSAGE("Parallel mark requires enable_threads ON" ) -#ENDIF(Threads_FOUND) - -IF(enable_parallel_mark) -ENDIF(enable_parallel_mark) - -OPTION(enable_cplusplus "install C++ support" NO) - -SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field.Use lowercase - -STRING(TOLOWER ${_HOST} HOST) -MESSAGE("HOST = ${HOST}") - -#Thread Detection. Relying on cmake for lib an includes. -#TODO check cmake detection -IF(CMAKE_USE_PTHREADS_INIT) - SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) - IF( "HOST" MATCHES x86-.*-linux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86_64-.*-linux.*|alpha-.*-linux.*|sparc.*-.*-linux.*) - ADD_DEFINITIONS("-DGC_LINUX_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF() - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - MESSAGE("Explicit GC_INIT() calls may be required.") - ENDIF() - IF ( "HOST" MATCHES .*-.*-linux.*) - ADD_DEFINITIONS("-DGC_LINUX_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - ENDIF() - IF ( "HOST" MATCHES .*-.*-aix.*) - ADD_DEFINITIONS("-DGC_AIX_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - ENDIF() - IF ( "HOST" MATCHES .*-.*-hpux11.*) - MESSAGE("Only HP/UX 11 POSIX threads are supported.") - ADD_DEFINITIONS("-DGC_HPUX_THREADS") - ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF() - MESSAGE("Explicit GC_INIT() calls may be required.") - ADD_DEFINITIONS("-D_REENTRANT") #TODO - ENDIF() - IF ( "HOST" MATCHES .*-.*-hpux10.*) - MESSAGE("Only HP/UX 11 POSIX threads are supported.") - ENDIF() - IF ( "HOST" MATCHES .*-.*-openbsd.*) - ADD_DEFINITIONS("-DGC_OPENBSD_THREADS") - #FIXME openbsd_threads=true - ENDIF() - IF ( "HOST" MATCHES .*-.*-freebsd.*) - MESSAGE("FreeBSD does not yet fully support threads with Boehm GC.") - ADD_DEFINITIONS("-DGC_FREEBSD_THREADS") - ENDIF() - IF ( "HOST" MATCHES .*-.*-kfreebsd.*-gnu) - ADD_DEFINITIONS("-DGC_FREEBSD_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF() - ADD_DEFINITIONS(THREAD_LOCAL_ALLOC) - ADD_DEFINITIONS(USE_COMPILER_TLS) - ENDIF() - IF ( "HOST" MATCHES .*-.*-gnu.*) - ADD_DEFINITIONS("-DGC_GNU_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - ENDIF() - IF ( "HOST" MATCHES .*-.*-netbsd.*) - MESSAGE("Only on NetBSD 2.0 or later.") - ADD_DEFINITIONS("-DGC_NETBSD_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - ADD_DEFINITIONS("-D_PTHREADS") - ENDIF() - IF ( "HOST" MATCHES .*-.*-solaris.*) - ADD_DEFINITIONS("-DGC_SOLARIS_THREADS") - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") -#TODO -# if test "$GCC" != yes; then -# CFLAGS="$CFLAGS -O" -# need_atomic_ops_asm=true -# fi - - ENDIF() - IF ( "HOST" MATCHES .*-.*-irix.*) - ADD_DEFINITIONS("-DGC_IRIX_THREADS") - ENDIF() - IF ( "HOST" MATCHES .*-.*-cygwin.*) - ADD_DEFINITIONS("-DGC_THREADS") - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF() - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - -#TODO -# win32_threads=true - ENDIF() - IF ( "HOST" MATCHES .*-.*-darwin.*) - ADD_DEFINITIONS("-DGC_DARWIN_THREADS") - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - MESSAGE("Explicit GC_INIT() calls may be required.") - SET(SRC ${SRC} darwin_stop_world.c) - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF() - #TODO - #darwin_threads=true - ENDIF() - IF ( "HOST" MATCHES .*-.*-osf*) - ADD_DEFINITIONS("-DGC_OSF1_THREADS") - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - MESSAGE("Explicit GC_INIT() calls may be required.") - # May want to enable it in other cases, too. - # Measurements haven't yet been done. - ENDIF() - ENDIF() - IF ( "HOST" MATCHES .*-.*-linux.*) - ADD_DEFINITIONS("-DGC_LINUX_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - ENDIF() -ENDIF(CMAKE_USE_PTHREADS_INIT) - -IF(CMAKE_USE_WIN32_THREADS_INIT) - ADD_DEFINITIONS("-DGC_THREADS") - #win32_threads=true TODO - IF (${enable_parallel_mark}) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - ENDIF() - # ADD_DEFINITIONS("-DEMPTY_GETENV_RESULTS") #TODO test - SET(SRC ${SRC} win32_threads.c) -ENDIF(CMAKE_USE_WIN32_THREADS_INIT) - -OPTION(enable_gcj_support "Support for gcj" NO) -IF(enable_gcj_support) - #TODO AM_CONDITIONAL(ENABLE_GCJ_SUPPORT, [test x"$enable_gcj_support" != xno]) - ADD_DEFINITIONS("-DGC_GCJ_SUPPORT") -ENDIF(enable_gcj_support) - - -ADD_LIBRARY( gc-lib STATIC ${SRC}) -SET_TARGET_PROPERTIES(gc-lib PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) -#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS}) - -ADD_LIBRARY( gcmt-lib STATIC ${SRC}) -SET_TARGET_PROPERTIES(gcmt-lib PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) - -ADD_LIBRARY( gcmt-dll SHARED ${SRC}) -SET_TARGET_PROPERTIES(gcmt-dll PROPERTIES - COMPILE_DEFINITIONS GC_DLL) - -IF(WIN32) - ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c cord/de.c cord/de_win.c) - SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE) - SET_TARGET_PROPERTIES(cord PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) - TARGET_LINK_LIBRARIES(cord gc-lib) - TARGET_LINK_LIBRARIES(cord gdi32) -ENDIF(WIN32) diff -Nru neko-2.1.0/libs/mod_neko/cgi.c neko-2.2.0/libs/mod_neko/cgi.c --- neko-2.1.0/libs/mod_neko/cgi.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mod_neko/cgi.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mod_neko/CMakeLists.txt neko-2.2.0/libs/mod_neko/CMakeLists.txt --- neko-2.1.0/libs/mod_neko/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/mod_neko/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,42 @@ + +###################### +# mod_neko2.ndll + +add_library(mod_neko2.ndll MODULE + ../../vm/stats.c # FIXME + mod_neko.c + cgi.c +) + +target_include_directories(mod_neko2.ndll + PRIVATE + ${APACHE_INCLUDE_DIRS} +) + +target_link_libraries(mod_neko2.ndll libneko ${APACHE_LIBRARIES}) + +# In static Apache case build dependencies first +if (STATIC_APACHE) + add_dependencies(mod_neko2.ndll Apache APR APRutil) +endif() + +set_target_properties(mod_neko2.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME mod_neko2 + SUFFIX .ndll +) + +if(APPLE) + set_target_properties(mod_neko2.ndll + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" + ) +endif(APPLE) + +install ( + TARGETS mod_neko2.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/mod_neko/mod_neko.c neko-2.2.0/libs/mod_neko/mod_neko.c --- neko-2.1.0/libs/mod_neko/mod_neko.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mod_neko/mod_neko.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mod_neko/mod_neko.h neko-2.2.0/libs/mod_neko/mod_neko.h --- neko-2.1.0/libs/mod_neko/mod_neko.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mod_neko/mod_neko.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mod_tora/CMakeLists.txt neko-2.2.0/libs/mod_tora/CMakeLists.txt --- neko-2.1.0/libs/mod_tora/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/mod_tora/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,50 @@ + +###################### +# mod_tora2.ndll + +add_library(mod_tora2.ndll MODULE + protocol.c + mod_tora.c +) + +add_dependencies(mod_tora2.ndll + mod_neko2.ndll + socket + ) + +target_include_directories(mod_tora2.ndll + PRIVATE + ${APACHE_INCLUDE_DIRS} +) + +target_link_libraries(mod_tora2.ndll + socket + ${APACHE_LIBRARIES} + ) + +if (WIN32) + target_link_libraries(mod_tora2.ndll ws2_32) +endif() + +set_target_properties(mod_tora2.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME mod_tora2 + SUFFIX .ndll +) + +####################### + +if(APPLE) + set_target_properties(mod_tora2.ndll + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" + ) +endif(APPLE) + +install ( + TARGETS mod_tora2.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/mod_tora/mod_tora.c neko-2.2.0/libs/mod_tora/mod_tora.c --- neko-2.1.0/libs/mod_tora/mod_tora.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mod_tora/mod_tora.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mod_tora/protocol.c neko-2.2.0/libs/mod_tora/protocol.c --- neko-2.1.0/libs/mod_tora/protocol.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mod_tora/protocol.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mod_tora/protocol.h neko-2.2.0/libs/mod_tora/protocol.h --- neko-2.1.0/libs/mod_tora/protocol.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mod_tora/protocol.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mysql/CMakeLists.txt neko-2.2.0/libs/mysql/CMakeLists.txt --- neko-2.1.0/libs/mysql/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/mysql/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,178 @@ + +###################### +# OpenSSL + +if (STATIC_OPENSSL) + if (APPLE) + if (${CMAKE_OSX_ARCHITECTURES} STREQUAL "i386") + set(OPENSSL_CONF ./Configure darwin-i386-cc "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + elseif (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64") + set(OPENSSL_CONF ./Configure darwin64-x86_64-cc "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + endif() + else() + set(OPENSSL_CONF ./config) + endif() + if (WIN32) + # perl is needed to run the openssl Configure script... + find_package(Perl REQUIRED) + if (arch_64) + set(openssl_target VC-WIN64A) + else() + set(openssl_target VC-WIN32) + endif() + message("arch_64 is ${arch_64}") + message("openssl_target is ${openssl_target}") + set(OPENSSL_CONFS + CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/openssl && + ${PERL_EXECUTABLE} Configure ${openssl_target} no-asm no-tests --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/openssl && + nmake /S + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/openssl && + nmake /S install_sw + ) + else() + set(OPENSSL_CONFS + CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/openssl && + ${OPENSSL_CONF} no-tests --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/openssl && + make + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/openssl && + make install_sw + ) + endif() + ExternalProject_Add(OpenSSL + ${EP_CONFIGS} + URL https://www.openssl.org/source/openssl-1.1.0g.tar.gz + URL_MD5 ba5f1b8b835b88cadbce9b35ed9531a6 + ${OPENSSL_CONFS} + PATCH_COMMAND ${CMAKE_COMMAND} -Dopenssl_source=${CMAKE_BINARY_DIR}/libs/src/openssl -P ${CMAKE_SOURCE_DIR}/cmake/patch_openssl.cmake + SOURCE_DIR ${CMAKE_BINARY_DIR}/libs/src/openssl + ) + set_target_properties(OpenSSL PROPERTIES ${EP_PROPS}) + if (WIN32) + set(OPENSSL_LIBRARIES + Crypt32 + ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libcrypto.lib + ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libssl.lib + ) + endif() + # Download project for fat source archive + add_dependencies(download_static_deps OpenSSL-download) +else() + find_package(OpenSSL) +endif() + +###################### +# mysql.ndll + +add_library(mysql.ndll MODULE mysql.c) + +if (STATIC_MARIADBCONNECTOR) + if (STATIC_OPENSSL AND NOT WIN32) + set(OPENSSL_CONF -DOPENSSL_ROOT_DIR=${CMAKE_BINARY_DIR}/libs/src/install-prefix) + set(OPENSSL_DEP OpenSSL) + elseif() + set(OPENSSL_CONF "") + set(OPENSSL_DEP "") + endif() + if (WIN32) + set(MARIADB_CONNECTOR_LIBRARIES + ${OPENSSL_LIBRARIES} + ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build/libmariadb/${CMAKE_CFG_INTDIR}/mariadbclient.lib + ) + else() + set(MARIADB_CONNECTOR_LIBRARIES + ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build/libmariadb/libmariadbclient.a + ) + endif() + ExternalProject_Add(MariaDBConnector + ${EP_CONFIGS} + DEPENDS ${OPENSSL_DEP} + URL https://downloads.mariadb.org/f/connector-c-3.0.2/mariadb-connector-c-3.0.2-src.tar.gz + URL_MD5 2eb5ba004ac105eebb538ead352c0c78 + CMAKE_ARGS + -Wno-dev + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} + -DWITH_SSL=ON + ${OPENSSL_CONF} + PATCH_COMMAND ${CMAKE_COMMAND} -Dmariadb_source=${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector -P ${CMAKE_SOURCE_DIR}/cmake/patch_mariadb.cmake + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build && + ${CMAKE_COMMAND} --build . --target mariadbclient --config ${CMAKE_CFG_INTDIR} + INSTALL_COMMAND echo skip install + BYPRODUCTS ${MARIADB_CONNECTOR_LIBRARIES} + ) + set_target_properties(MariaDBConnector PROPERTIES ${EP_PROPS}) + set(MARIADB_CONNECTOR_INCLUDE_DIR + ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector/include + ${CMAKE_BINARY_DIR}/libs/src/MariaDBConnector-build/include + ) + add_dependencies(mysql.ndll MariaDBConnector) + # Download project for fat source archive + add_dependencies(download_static_deps MariaDBConnector-download) +else() + find_package(MariaDBConnector REQUIRED) +endif() + +target_include_directories(mysql.ndll + PRIVATE + ${MARIADB_CONNECTOR_INCLUDE_DIR} +) + +target_link_libraries(mysql.ndll libneko ${MARIADB_CONNECTOR_LIBRARIES}) + +if (WIN32) + target_link_libraries(mysql.ndll ws2_32 crypt32 shlwapi) +endif() + +set_target_properties(mysql.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME mysql + SUFFIX .ndll +) + +if(APPLE) + set_target_properties(mysql.ndll + PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup ${LINK_FLAGS}" + ) +endif(APPLE) + +###################### +# mysql5.ndll + +add_library(mysql5.ndll MODULE + my_proto/my_proto.c + my_proto/my_api.c + mysql.c +) + +target_include_directories(mysql5.ndll + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/my_proto +) + +target_link_libraries(mysql5.ndll + socket + sha1 + libneko + ) + +if (WIN32) + target_link_libraries(mysql5.ndll ws2_32) +endif() + +set_target_properties(mysql5.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME mysql5 + SUFFIX .ndll +) + +install ( + TARGETS mysql.ndll mysql5.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/mysql/my_proto/my_api.c neko-2.2.0/libs/mysql/my_proto/my_api.c --- neko-2.1.0/libs/mysql/my_proto/my_api.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mysql/my_proto/my_api.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ /* * MYSQL 5.0 Protocol Implementation - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -254,7 +254,7 @@ int pcount = 0; myp_begin_packet(p,0); myp_write_byte(p,COM_INIT_DB); - myp_write_string(p,dbname); + myp_write_string_eof(p,dbname); if( !myp_send_packet(m,p,&pcount) ) { error(m,"Failed to send packet",NULL); return -1; diff -Nru neko-2.1.0/libs/mysql/my_proto/my_proto.c neko-2.2.0/libs/mysql/my_proto/my_proto.c --- neko-2.1.0/libs/mysql/my_proto/my_proto.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mysql/my_proto/my_proto.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ /* * MYSQL 5.0 Protocol Implementation - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -220,6 +220,10 @@ myp_write(p,str,strlen(str) + 1); } +void myp_write_string_eof( MYSQL_PACKET *p, const char *str ) { + myp_write(p,str,strlen(str)); +} + void myp_write_bin( MYSQL_PACKET *p, int size ) { if( size <= 250 ) { unsigned char l = (unsigned char)size; diff -Nru neko-2.1.0/libs/mysql/my_proto/my_proto.h neko-2.2.0/libs/mysql/my_proto/my_proto.h --- neko-2.1.0/libs/mysql/my_proto/my_proto.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mysql/my_proto/my_proto.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ /* * MYSQL 5.0 Protocol Implementation - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -164,6 +164,7 @@ void myp_write_int( MYSQL_PACKET *p, int b ); void myp_write_string( MYSQL_PACKET *p, const char *str ); +void myp_write_string_eof( MYSQL_PACKET *p, const char *str ); void myp_write_bin( MYSQL_PACKET *p, int size ); // passwords diff -Nru neko-2.1.0/libs/mysql/my_proto/mysql.h neko-2.2.0/libs/mysql/my_proto/mysql.h --- neko-2.1.0/libs/mysql/my_proto/mysql.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mysql/my_proto/mysql.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ /* * MYSQL 5.0 Protocol Implementation - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/mysql/mysql.c neko-2.2.0/libs/mysql/mysql.c --- neko-2.1.0/libs/mysql/mysql.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/mysql/mysql.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/ocaml/binast.ml neko-2.2.0/libs/ocaml/binast.ml --- neko-2.1.0/libs/ocaml/binast.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/binast.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Binary AST for OCaml - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mlast.ml neko-2.2.0/libs/ocaml/ml/mlast.ml --- neko-2.1.0/libs/ocaml/ml/mlast.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mlast.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mllexer.mll neko-2.2.0/libs/ocaml/ml/mllexer.mll --- neko-2.1.0/libs/ocaml/ml/mllexer.mll 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mllexer.mll 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mlmain.ml neko-2.2.0/libs/ocaml/ml/mlmain.ml --- neko-2.1.0/libs/ocaml/ml/mlmain.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mlmain.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mlmatch.ml neko-2.2.0/libs/ocaml/ml/mlmatch.ml --- neko-2.1.0/libs/ocaml/ml/mlmatch.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mlmatch.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mlneko.ml neko-2.2.0/libs/ocaml/ml/mlneko.ml --- neko-2.1.0/libs/ocaml/ml/mlneko.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mlneko.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mlparser.ml neko-2.2.0/libs/ocaml/ml/mlparser.ml --- neko-2.1.0/libs/ocaml/ml/mlparser.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mlparser.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mltype.ml neko-2.2.0/libs/ocaml/ml/mltype.ml --- neko-2.1.0/libs/ocaml/ml/mltype.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mltype.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/ml/mltyper.ml neko-2.2.0/libs/ocaml/ml/mltyper.ml --- neko-2.1.0/libs/ocaml/ml/mltyper.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/ml/mltyper.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * NekoML Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/nast.ml neko-2.2.0/libs/ocaml/nast.ml --- neko-2.1.0/libs/ocaml/nast.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/nast.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko AST for OCaml - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/neko/bytecode.ml neko-2.2.0/libs/ocaml/neko/bytecode.ml --- neko-2.1.0/libs/ocaml/neko/bytecode.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/bytecode.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/neko/compile.ml neko-2.2.0/libs/ocaml/neko/compile.ml --- neko-2.1.0/libs/ocaml/neko/compile.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/compile.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/neko/lexer.mll neko-2.2.0/libs/ocaml/neko/lexer.mll --- neko-2.1.0/libs/ocaml/neko/lexer.mll 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/lexer.mll 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/neko/main.ml neko-2.2.0/libs/ocaml/neko/main.ml --- neko-2.1.0/libs/ocaml/neko/main.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/main.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ let main() = try - let usage = "Neko v0.4 - (c)2005-2016 Haxe Foundation\n Usage : neko.exe [options] \n Options :" in + let usage = "Neko v0.4 - (c)2005-2017 Haxe Foundation\n Usage : neko.exe [options] \n Options :" in let output = ref "n" in let args_spec = [ ("-msvc",Arg.Unit (fun () -> print_style := StyleMSVC),": use MSVC style errors"); diff -Nru neko-2.1.0/libs/ocaml/neko/parser.ml neko-2.2.0/libs/ocaml/neko/parser.ml --- neko-2.1.0/libs/ocaml/neko/parser.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/parser.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/neko/plugin.ml neko-2.2.0/libs/ocaml/neko/plugin.ml --- neko-2.1.0/libs/ocaml/neko/plugin.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/plugin.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/neko/printer.ml neko-2.2.0/libs/ocaml/neko/printer.ml --- neko-2.1.0/libs/ocaml/neko/printer.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/neko/printer.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko Compiler - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff -Nru neko-2.1.0/libs/ocaml/nxml.ml neko-2.2.0/libs/ocaml/nxml.ml --- neko-2.1.0/libs/ocaml/nxml.ml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ocaml/nxml.ml 2017-12-19 06:38:08.000000000 +0000 @@ -1,6 +1,6 @@ (* * Neko NXML for OCaml - * Copyright (c)2005-2016 Haxe Foundation + * Copyright (c)2005-2017 Haxe Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,13 +22,13 @@ | Node of string * (string * string) list * xml list | CData of string -let node name att childs = Node(name,att,childs) +let node name att children = Node(name,att,children) let rec to_xml_rec p2 ast = let e , p = ast in let name = ref "" in let aval = ref None in - let childs = ref [] in + let children = ref [] in (match e with | EConst c -> (match c with @@ -52,70 +52,70 @@ ) | EBlock el -> name := "b"; - childs := List.map (to_xml_rec p) el; + children := List.map (to_xml_rec p) el; | EParenthesis e -> name := "p"; - childs := [to_xml_rec p e]; + children := [to_xml_rec p e]; | EField (e,f) -> name := "g"; aval := Some f; - childs := [to_xml_rec p e]; + children := [to_xml_rec p e]; | ECall (e,el) -> name := "c"; - childs := to_xml_rec p e :: List.map (to_xml_rec p) el; + children := to_xml_rec p e :: List.map (to_xml_rec p) el; | EArray (a,b) -> name := "a"; - childs := [to_xml_rec p a; to_xml_rec p b]; + children := [to_xml_rec p a; to_xml_rec p b]; | EVars vl -> name := "var"; - childs := List.map (fun(v,e) -> + children := List.map (fun(v,e) -> node "v" [("v",v)] (match e with None -> [] | Some e -> [to_xml_rec p e]) ) vl; | EWhile (econd,e,NormalWhile) -> name := "while"; - childs := [to_xml_rec p econd; to_xml_rec p e]; + children := [to_xml_rec p econd; to_xml_rec p e]; | EWhile (econd,e,DoWhile) -> name := "do"; - childs := [to_xml_rec p e; to_xml_rec p econd]; + children := [to_xml_rec p e; to_xml_rec p econd]; | EIf (cond,e,eelse) -> name := "if"; - childs := to_xml_rec p cond :: to_xml_rec p e :: (match eelse with None -> [] | Some e -> [to_xml_rec p e]) + children := to_xml_rec p cond :: to_xml_rec p e :: (match eelse with None -> [] | Some e -> [to_xml_rec p e]) | ETry (e1,v,e2) -> name := "try"; aval := Some v; - childs := [to_xml_rec p e1; to_xml_rec p e2]; + children := [to_xml_rec p e1; to_xml_rec p e2]; | EFunction (args,e) -> name := "function"; aval := Some (String.concat ":" args); - childs := [to_xml_rec p e]; + children := [to_xml_rec p e]; | EBinop (op,e1,e2) -> name := "o"; aval := Some op; - childs := [to_xml_rec p e1; to_xml_rec p e2]; + children := [to_xml_rec p e1; to_xml_rec p e2]; | EReturn e -> name := "return"; - childs := (match e with None -> [] | Some e -> [to_xml_rec p e]); + children := (match e with None -> [] | Some e -> [to_xml_rec p e]); | EBreak e -> name := "break"; - childs := (match e with None -> [] | Some e -> [to_xml_rec p e]); + children := (match e with None -> [] | Some e -> [to_xml_rec p e]); | EContinue -> name := "continue"; | ENext (e1,e2) -> name := "next"; - childs := [to_xml_rec p e1; to_xml_rec p e2]; + children := [to_xml_rec p e1; to_xml_rec p e2]; | EObject fl -> name := "object"; - childs := List.map (fun(v,e) -> node "v" [("v",v)] [to_xml_rec p e]) fl; + children := List.map (fun(v,e) -> node "v" [("v",v)] [to_xml_rec p e]) fl; | ELabel v -> name := "label"; aval := Some v; | ESwitch (e,cases,def) -> name := "switch"; let cases = List.map (fun(e1,e2) -> node "case" [] [to_xml_rec p e1; to_xml_rec p e2]) cases in - childs := to_xml_rec p e :: (match def with None -> cases | Some e -> node "default" [] [to_xml_rec p e] :: cases ); + children := to_xml_rec p e :: (match def with None -> cases | Some e -> node "default" [] [to_xml_rec p e] :: cases ); | ENeko s -> name := "neko"; - childs := [CData s]; + children := [CData s]; ); let pos = (if p.psource <> p2.psource then [("p",p.psource ^ ":" ^ string_of_int p.pline)] @@ -125,7 +125,7 @@ [] ) in let aval = (match !aval with None -> [] | Some v -> [("v",v)]) in - node !name (List.append pos aval) !childs + node !name (List.append pos aval) !children let to_xml ast = to_xml_rec null_pos ast @@ -134,9 +134,9 @@ match x with | CData s -> IO.printf ch "%s" tabs s - | Node (name,att,childs) -> + | Node (name,att,children) -> IO.printf ch "%s<%s%s" tabs name (String.concat "" (List.map (fun(a,v) -> " " ^ a ^ "=\"" ^ escape v ^ "\"") att)); - match childs with + match children with | [] -> IO.nwrite ch "/>" | l -> IO.nwrite ch ">\n"; @@ -150,9 +150,9 @@ match x with | CData s -> IO.printf ch "" s - | Node (name,att,childs) -> + | Node (name,att,children) -> IO.printf ch "<%s%s" name (String.concat "" (List.map (fun(a,v) -> " " ^ a ^ "=\"" ^ escape v ^ "\"") att)); - match childs with + match children with | [] -> IO.nwrite ch "/>" | l -> IO.nwrite ch ">"; diff -Nru neko-2.1.0/libs/regexp/CMakeLists.txt neko-2.2.0/libs/regexp/CMakeLists.txt --- neko-2.1.0/libs/regexp/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/regexp/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,93 @@ + +###################### +# regexp.ndll + +add_library(regexp.ndll MODULE regexp.c) +if (STATIC_PCRE) + if (WIN32) + set(PCRE_URL "https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz") + if (NOT ${CMAKE_VERSION} VERSION_LESS 3.7) + list(APPEND PCRE_URL + "http://downloads.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz" + ) + endif() + ExternalProject_Add(PCRE + ${EP_CONFIGS} + URL ${PCRE_URL} + URL_MD5 2e7896647ee25799cb454fe287ffcd08 + CMAKE_ARGS + -G ${CMAKE_GENERATOR} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix + -Wno-dev + -DPCRE_BUILD_PCRECPP=OFF + -DPCRE_BUILD_PCREGREP=OFF + -DPCRE_BUILD_TESTS=OFF + -DPCRE_SUPPORT_JIT=ON + -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON + ) + set(PCRE_LIBRARIES + optimized ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/pcre.lib + debug ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/pcred.lib + ) + else() + if (APPLE) + set(PCRE_CFLAGS "-w -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + else() + set(PCRE_CFLAGS "-w") + endif() + set(PCRE_LIBRARIES + ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libpcre.a + ) + set(PCRE_URL "https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz") + if (NOT ${CMAKE_VERSION} VERSION_LESS 3.7) + list(APPEND PCRE_URL + "http://downloads.sourceforge.net/project/pcre/pcre/8.40/pcre-8.40.tar.gz" + ) + endif() + ExternalProject_Add(PCRE + ${EP_CONFIGS} + URL ${PCRE_URL} + URL_MD5 890c808122bd90f398e6bc40ec862102 + CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/PCRE && + ./configure + --prefix=${CMAKE_BINARY_DIR}/libs/src/install-prefix + --with-pic + --enable-unicode-properties + --enable-silent-rules + --enable-jit + --disable-cpp + --enable-shared=no + --enable-static=yes + --silent + BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/PCRE && + make "CFLAGS=${PCRE_CFLAGS}" + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/PCRE && + make install + BYPRODUCTS ${PCRE_LIBRARIES} + ) + endif() + set_target_properties(PCRE PROPERTIES ${EP_PROPS}) + set(PCRE_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include) + add_dependencies(regexp.ndll PCRE) + # Download project for fat source archive + add_dependencies(download_static_deps PCRE-download) +else() + find_package(PCRE REQUIRED) +endif() + +target_include_directories(regexp.ndll PRIVATE ${PCRE_INCLUDE_DIRS}) +target_link_libraries(regexp.ndll libneko ${PCRE_LIBRARIES}) + +set_target_properties(regexp.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME regexp + SUFFIX .ndll +) + +install ( + TARGETS regexp.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/regexp/regexp.c neko-2.2.0/libs/regexp/regexp.c --- neko-2.1.0/libs/regexp/regexp.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/regexp/regexp.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -57,7 +57,7 @@ if( res >= 0 ) return 1; if( res != PCRE_ERROR_NOMATCH ) - val_throw(alloc_string("An error occured while running pcre_exec")); + val_throw(alloc_string("An error occurred while running pcre_exec")); return 0; } diff -Nru neko-2.1.0/libs/sqlite/CMakeLists.txt neko-2.2.0/libs/sqlite/CMakeLists.txt --- neko-2.1.0/libs/sqlite/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/sqlite/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,48 @@ + +###################### +# sqlite.ndll + +if (STATIC_SQLITE3) + ExternalProject_Add(Sqlite3 + ${EP_CONFIGS} + URL https://www.sqlite.org/2017/sqlite-autoconf-3210000.tar.gz + URL_MD5 7913de4c3126ba3c24689cb7a199ea31 + CONFIGURE_COMMAND echo skip config + BUILD_COMMAND echo skip build + INSTALL_COMMAND echo skip install + ) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/libs/src/Sqlite3/sqlite3.c + DEPENDS Sqlite3 + ) + + add_library(sqlite.ndll MODULE + sqlite.c + ${CMAKE_BINARY_DIR}/libs/src/Sqlite3/sqlite3.c + ) + target_include_directories(sqlite.ndll PRIVATE ${CMAKE_BINARY_DIR}/libs/src/Sqlite3) + target_link_libraries(sqlite.ndll libneko) + target_compile_definitions(sqlite.ndll PRIVATE SQLITE_MAX_VARIABLE_NUMBER=250000 SQLITE_ENABLE_RTREE=1) + # Download project for fat source archive + add_dependencies(download_static_deps Sqlite3-download) +else() + add_library(sqlite.ndll MODULE sqlite.c) + pkg_check_modules(SQLITE3 REQUIRED sqlite3) + target_include_directories(sqlite.ndll PRIVATE ${SQLITE3_INCLUDEDIR} ${SQLITE3_INCLUDE_DIRS}) + target_link_libraries(sqlite.ndll libneko ${SQLITE3_LIBRARIES}) +endif() + + +set_target_properties(sqlite.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME sqlite + SUFFIX .ndll +) + +install ( + TARGETS sqlite.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/sqlite/sqlite.c neko-2.2.0/libs/sqlite/sqlite.c --- neko-2.1.0/libs/sqlite/sqlite.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/sqlite/sqlite.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -231,7 +231,7 @@ if( r->bools[i] ) f = alloc_bool(sqlite3_column_int(r->r,i)); else - f = alloc_int(sqlite3_column_int(r->r,i)); + f = alloc_best_int(sqlite3_column_int(r->r,i)); break; case SQLITE_FLOAT: f = alloc_float(sqlite3_column_double(r->r,i)); @@ -300,7 +300,7 @@ result_next(v); if( r->done ) neko_error(); - return alloc_int(sqlite3_column_int(r->r,val_int(n))); + return alloc_best_int(sqlite3_column_int(r->r,val_int(n))); } /** diff -Nru neko-2.1.0/libs/ssl/CMakeLists.txt neko-2.2.0/libs/ssl/CMakeLists.txt --- neko-2.1.0/libs/ssl/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/ssl/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,80 @@ + +###################### +# ssl.ndll + +add_library(ssl.ndll MODULE ssl.c) + +if (STATIC_MBEDTLS) + set(MBEDTLS_CMAKE_ARGS + -Wno-dev + -DENABLE_PROGRAMS=OFF + -DENABLE_TESTING=OFF + -DUSE_STATIC_MBEDTLS_LIBRARY=ON + ) + if (UNIX) + list(APPEND MBEDTLS_CMAKE_ARGS + -DLINK_WITH_PTHREAD=ON + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} + ${ARG_PIC} + ) + endif() + if (WIN32) + set(MBEDTLS_LIBRARIES + ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/${CMAKE_CFG_INTDIR}/mbedx509.lib + ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/${CMAKE_CFG_INTDIR}/mbedtls.lib + ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/${CMAKE_CFG_INTDIR}/mbedcrypto.lib + ) + target_link_libraries(ssl.ndll ws2_32 Advapi32 Crypt32) + else() + set(MBEDTLS_LIBRARIES + ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/libmbedx509.a + ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/libmbedtls.a + ${CMAKE_BINARY_DIR}/libs/src/MbedTLS-build/library/libmbedcrypto.a + ) + endif() + ExternalProject_Add(MbedTLS + ${EP_CONFIGS} + URL https://tls.mbed.org/download/mbedtls-2.6.0-apache.tgz + URL_MD5 01ede06f7d00dd8a6626494d95a63f6b + CMAKE_ARGS ${MBEDTLS_CMAKE_ARGS} + PATCH_COMMAND ${CMAKE_COMMAND} -Dsource=${CMAKE_SOURCE_DIR} -DMbedTLS_source=${CMAKE_BINARY_DIR}/libs/src/MbedTLS -P ${CMAKE_SOURCE_DIR}/cmake/patch_mbedtls.cmake + INSTALL_COMMAND echo skip install + BYPRODUCTS ${MBEDTLS_LIBRARIES} + ) + set_target_properties(MbedTLS PROPERTIES ${EP_PROPS}) + set(MBEDTLS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libs/src/MbedTLS/include) + + add_dependencies(ssl.ndll MbedTLS) + # Download project for fat source archive + add_dependencies(download_static_deps MbedTLS-download) +else() + find_package(MbedTLS REQUIRED) +endif() + +target_include_directories(ssl.ndll + PRIVATE + ${MBEDTLS_INCLUDE_DIR} +) + +if(APPLE) + find_library(SECURITY_LIBRARY Security REQUIRED) + find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED) + target_link_libraries(ssl.ndll ${COREFOUNDATION_LIBRARY} ${SECURITY_LIBRARY}) +endif() + +target_link_libraries(ssl.ndll libneko ${MBEDTLS_LIBRARIES}) + +set_target_properties(ssl.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME ssl + SUFFIX .ndll +) + +install ( + TARGETS ssl.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/ssl/ssl.c neko-2.2.0/libs/ssl/ssl.c --- neko-2.1.0/libs/ssl/ssl.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ssl/ssl.c 2017-12-19 06:38:08.000000000 +0000 @@ -22,6 +22,7 @@ #define SOCKET_ERROR (-1) #define NRETRYS 20 +#include "mbedtls/platform.h" #include "mbedtls/error.h" #include "mbedtls/entropy.h" #include "mbedtls/ctr_drbg.h" @@ -241,6 +242,8 @@ HANDLE_EINTR(recv_again); return block_error(); } + if( dlen == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY ) + return alloc_int(0); if( dlen < 0 ) neko_error(); return alloc_int( dlen ); @@ -261,6 +264,8 @@ HANDLE_EINTR(read_again); return block_error(); } + if( len == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY ) + break; if( len == 0 ) break; buffer_append_sub(b,(const char *)buf,len); @@ -348,7 +353,7 @@ val_check(file,string); x = (mbedtls_x509_crt *)alloc(sizeof(mbedtls_x509_crt)); mbedtls_x509_crt_init( x ); - if( (r = mbedtls_x509_crt_parse_file(x, val_string(file))) != 0 ){ + if( (r = mbedtls_x509_crt_parse_file(x, val_string(file))) < 0 ){ return ssl_error(r); } v = alloc_abstract(k_cert, x); @@ -363,7 +368,7 @@ val_check(path,string); x = (mbedtls_x509_crt *)alloc(sizeof(mbedtls_x509_crt)); mbedtls_x509_crt_init( x ); - if( (r = mbedtls_x509_crt_parse_path(x, val_string(path))) != 0 ){ + if( (r = mbedtls_x509_crt_parse_path(x, val_string(path))) < 0 ){ return ssl_error(r); } v = alloc_abstract(k_cert, x); diff -Nru neko-2.1.0/libs/std/buffer.c neko-2.2.0/libs/std/buffer.c --- neko-2.1.0/libs/std/buffer.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/buffer.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/CMakeLists.txt neko-2.2.0/libs/std/CMakeLists.txt --- neko-2.1.0/libs/std/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/std/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,47 @@ + +add_library(std.ndll MODULE + buffer.c + date.c + file.c + init.c + int32.c + math.c + string.c + random.c + serialize.c + socket.c + sys.c + xml.c + module.c + md5.c + unicode.c + utf8.c + memory.c + misc.c + thread.c + process.c + elf_update.c +) + +target_link_libraries(std.ndll + sha1 + libneko + ) + +if(WIN32) + target_link_libraries(std.ndll ws2_32) +endif() + +set_target_properties(std.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME std + SUFFIX .ndll +) + +install ( + TARGETS std.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/std/date.c neko-2.2.0/libs/std/date.c --- neko-2.1.0/libs/std/date.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/date.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/elf_update.c neko-2.2.0/libs/std/elf_update.c --- neko-2.1.0/libs/std/elf_update.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/elf_update.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2015-2016 Haxe Foundation + * Copyright (C)2015-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/file.c neko-2.2.0/libs/std/file.c --- neko-2.1.0/libs/std/file.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/file.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/init.c neko-2.2.0/libs/std/init.c --- neko-2.1.0/libs/std/init.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/init.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/int32.c neko-2.2.0/libs/std/int32.c --- neko-2.1.0/libs/std/int32.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/int32.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/math.c neko-2.2.0/libs/std/math.c --- neko-2.1.0/libs/std/math.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/math.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/md5.c neko-2.2.0/libs/std/md5.c --- neko-2.1.0/libs/std/md5.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/md5.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/memory.c neko-2.2.0/libs/std/memory.c --- neko-2.1.0/libs/std/memory.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/memory.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/misc.c neko-2.2.0/libs/std/misc.c --- neko-2.1.0/libs/std/misc.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/misc.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/module.c neko-2.2.0/libs/std/module.c --- neko-2.1.0/libs/std/module.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/module.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/process.c neko-2.2.0/libs/std/process.c --- neko-2.1.0/libs/std/process.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/process.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/random.c neko-2.2.0/libs/std/random.c --- neko-2.1.0/libs/std/random.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/random.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/serialize.c neko-2.2.0/libs/std/serialize.c --- neko-2.1.0/libs/std/serialize.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/serialize.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/socket.c neko-2.2.0/libs/std/socket.c --- neko-2.1.0/libs/std/socket.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/socket.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -371,7 +371,7 @@ ip = inet_addr(val_string(host)); if( ip == INADDR_NONE ) { struct hostent *h; -# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) +# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(NEKO_CYGWIN) h = gethostbyname(val_string(host)); # else struct hostent hbase; @@ -406,7 +406,7 @@ unsigned int ip; val_check(host,int32); ip = val_int32(host); -# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) +# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(NEKO_CYGWIN) h = gethostbyaddr((char *)&ip,4,AF_INET); # else struct hostent htmp; diff -Nru neko-2.1.0/libs/std/string.c neko-2.2.0/libs/std/string.c --- neko-2.1.0/libs/std/string.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/string.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/sys.c neko-2.2.0/libs/std/sys.c --- neko-2.1.0/libs/std/sys.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/sys.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -41,7 +41,11 @@ # include # include # include +#ifdef NEKO_XLOCALE_H # include +#else +# include +#endif #endif #ifdef NEKO_MAC @@ -190,7 +194,7 @@ **/ static value sys_string() { -#if defined(NEKO_WINDOWS) +#if defined(NEKO_WINDOWS) || defined(NEKO_CYGWIN) return alloc_string("Windows"); #elif defined(NEKO_GNUKBSD) return alloc_string("GNU/kFreeBSD"); @@ -198,6 +202,8 @@ return alloc_string("Linux"); #elif defined(NEKO_BSD) return alloc_string("BSD"); +#elif defined(NEKO_HURD) + return alloc_string("GNU/Hurd"); #elif defined(NEKO_MAC) return alloc_string("Mac"); #else @@ -537,6 +543,14 @@ if( GetFullPathName(val_string(path),MAX_PATH+1,buf,NULL) == 0 ) neko_error(); return alloc_string(buf); +#elif defined(__GLIBC__) + val_check(path,string); + char *buf = realpath(val_string(path), NULL); + if( buf == NULL ) + neko_error(); + value ret = alloc_string(buf); + free(buf); + return ret; #else char buf[PATH_MAX]; val_check(path,string); @@ -562,18 +576,24 @@ if( _NSGetExecutablePath(path, &path_len) ) neko_error(); return alloc_string(path); +#elif defined(NEKO_LINUX) + static char path[PATH_MAX]; + int length = readlink("/proc/self/exe", path, sizeof(path)); + if( length < 0 || length >= PATH_MAX ) { + char *p = getenv(" "); // for upx + if( p == NULL ) + p = getenv("_"); + if( p == NULL ) + neko_error(); + return alloc_string(p); + } + path[length] = '\0'; + return alloc_string(path); #else const char *p = getenv("_"); if( p != NULL ) return alloc_string(p); - { - char path[PATH_MAX]; - int length = readlink("/proc/self/exe", path, sizeof(path)); - if( length < 0 ) - neko_error(); - path[length] = '\0'; - return alloc_string(path); - } + neko_error(); #endif } diff -Nru neko-2.1.0/libs/std/thread.c neko-2.2.0/libs/std/thread.c --- neko-2.1.0/libs/std/thread.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/thread.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -238,7 +238,7 @@ // display exception if( exc != NULL ) { buffer b = alloc_buffer(NULL); - fprintf(stderr,"An exception occured in a neko Thread :\n"); + fprintf(stderr,"An exception occurred in a neko Thread :\n"); val_buffer(b,exc); fprintf(stderr,"%s\n",val_string(buffer_to_string(b))); } diff -Nru neko-2.1.0/libs/std/unicode.c neko-2.2.0/libs/std/unicode.c --- neko-2.1.0/libs/std/unicode.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/unicode.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/std/utf8.c neko-2.2.0/libs/std/utf8.c --- neko-2.1.0/libs/std/utf8.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/utf8.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -404,7 +404,7 @@ unsigned char c1 = *s1++; unsigned char c2 = *s2++; if( c1 != c2 ) - return alloc_int((c1 > c2)?-1:1); + return alloc_int((c1 > c2)?1:-1); if( c1 < 0x7F ) continue; else if( c1 < 0xC0 ) @@ -414,25 +414,25 @@ if( l < 0 ) neko_error(); if( *s1++ != *s2++ ) - return alloc_int((s1[-1] > s2[-1])?-1:1); + return alloc_int((s1[-1] > s2[-1])?1:-1); } else if( c1 < 0xF0 ) { l-=2; if( l < 0 ) neko_error(); if( *s1++ != *s2++ ) - return alloc_int((s1[-1] > s2[-1])?-1:1); + return alloc_int((s1[-1] > s2[-1])?1:-1); if( *s1++ != *s2++ ) - return alloc_int((s1[-1] > s2[-1])?-1:1); + return alloc_int((s1[-1] > s2[-1])?1:-1); } else { l -= 3; if( l < 0 ) neko_error(); if( *s1++ != *s2++ ) - return alloc_int((s1[-1] > s2[-1])?-1:1); + return alloc_int((s1[-1] > s2[-1])?1:-1); if( *s1++ != *s2++ ) - return alloc_int((s1[-1] > s2[-1])?-1:1); + return alloc_int((s1[-1] > s2[-1])?1:-1); if( *s1++ != *s2++ ) - return alloc_int((s1[-1] > s2[-1])?-1:1); + return alloc_int((s1[-1] > s2[-1])?1:-1); } } if( l1 != l2 ) diff -Nru neko-2.1.0/libs/std/xml.c neko-2.2.0/libs/std/xml.c --- neko-2.1.0/libs/std/xml.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/std/xml.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -44,7 +44,7 @@ EQUALS, ATTVAL_BEGIN, ATTRIB_VAL, - CHILDS, + CHILDREN, CLOSE, WAIT_END, WAIT_END_RET, @@ -208,7 +208,7 @@ val_ocall2(callb,id_xml,nodename,attribs); break; case '>': - state = CHILDS; + state = CHILDREN; nsubs++; val_ocall2(callb,id_xml,nodename,attribs); break; @@ -261,7 +261,7 @@ next = BODY; } break; - case CHILDS: + case CHILDREN: *lp = p; do_parse_xml(xml,lp,line,callb,val_string(nodename)); p = *lp; diff -Nru neko-2.1.0/libs/ui/CMakeLists.txt neko-2.2.0/libs/ui/CMakeLists.txt --- neko-2.1.0/libs/ui/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/ui/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,34 @@ +include(FindPkgConfig) + +###################### +# ui.ndll + +add_library(ui.ndll MODULE ui.c) + +target_link_libraries(ui.ndll libneko) + +if(APPLE) + find_library(CARBON_LIBRARY Carbon REQUIRED) + target_link_libraries(ui.ndll ${CARBON_LIBRARY}) +elseif(UNIX) + pkg_check_modules(GTK2 REQUIRED gtk+-2.0) + target_include_directories(ui.ndll PRIVATE + ${GTK2_INCLUDEDIR} + ${GTK2_INCLUDE_DIRS} + ) + target_link_libraries(ui.ndll ${GTK2_LIBRARIES}) +endif() + +set_target_properties(ui.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME ui + SUFFIX .ndll +) + +install ( + TARGETS ui.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/ui/ui.c neko-2.2.0/libs/ui/ui.c --- neko-2.1.0/libs/ui/ui.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/ui/ui.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/libs/zlib/CMakeLists.txt neko-2.2.0/libs/zlib/CMakeLists.txt --- neko-2.1.0/libs/zlib/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ neko-2.2.0/libs/zlib/CMakeLists.txt 2017-12-19 06:38:08.000000000 +0000 @@ -0,0 +1,74 @@ +include(FindPkgConfig) + +###################### +# zlib.ndll + +add_library(zlib.ndll MODULE zlib.c) + + +if (STATIC_ZLIB) + set(ZLIB_CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/libs/src/install-prefix + -Wno-dev + ) + if (UNIX) + list(APPEND ZLIB_CMAKE_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} + ${ARG_PIC} + ) + endif() + if (WIN32) + set(ZLIB_LIBRARIES + optimized ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/zlibstatic.lib + debug ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/zlibstaticd.lib + ) + else() + set(ZLIB_LIBRARIES ${CMAKE_BINARY_DIR}/libs/src/install-prefix/lib/libz.a) + endif() + + # Get the current config. Borrowed from + # https://github.com/Kitware/CMake/blob/bc7d64f896d6e180970cb404cc7699732db34adc/Modules/ExternalProject.cmake + if (CMAKE_CFG_INTDIR AND + NOT CMAKE_CFG_INTDIR STREQUAL "." AND + NOT CMAKE_CFG_INTDIR MATCHES "\\$") + set(config ${CMAKE_CFG_INTDIR}) + else() + set(config $) + endif() + + ExternalProject_Add(Zlib + ${EP_CONFIGS} + URL http://zlib.net/zlib-1.2.11.tar.gz + URL_MD5 1c9f62f0778697a09d36121ead88e08e + CMAKE_ARGS ${ZLIB_CMAKE_ARGS} + INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/libs/src/Zlib-build && + ${CMAKE_COMMAND} --build . --target install --config ${config} + BYPRODUCTS ${ZLIB_LIBRARIES} + ) + set_target_properties(Zlib PROPERTIES ${EP_PROPS}) + set(ZLIB_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/libs/src/install-prefix/include) + add_dependencies(zlib.ndll Zlib) + target_include_directories(zlib.ndll PRIVATE ${ZLIB_INCLUDE_DIRS}) + # Download project for fat source archive + add_dependencies(download_static_deps Zlib-download) +else() + pkg_check_modules(ZLIB REQUIRED zlib) + target_include_directories(zlib.ndll PRIVATE ${ZLIB_INCLUDEDIR} ${ZLIB_INCLUDE_DIRS}) +endif() + +target_link_libraries(zlib.ndll libneko ${ZLIB_LIBRARIES}) + +set_target_properties(zlib.ndll + PROPERTIES + PREFIX "" + OUTPUT_NAME zlib + SUFFIX .ndll +) + +install ( + TARGETS zlib.ndll + DESTINATION ${DEST_NDLL} +) + +install(SCRIPT ${NEKO_FLATTEN_SCRIPT}) diff -Nru neko-2.1.0/libs/zlib/zlib.c neko-2.2.0/libs/zlib/zlib.c --- neko-2.1.0/libs/zlib/zlib.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/libs/zlib/zlib.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/LICENSE neko-2.2.0/LICENSE --- neko-2.1.0/LICENSE 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/LICENSE 2017-12-19 06:38:08.000000000 +0000 @@ -1,7 +1,7 @@ Neko Virtual Machine (neko) and Neko Tools (nekotools) ====================================================== -Copyright (C)2005-2016 Haxe Foundation +Copyright (C)2005-2017 Haxe Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -46,7 +46,7 @@ std, sqlite, mysql5, ui ----------------------- -Copyright (C)2005-2016 Haxe Foundation +Copyright (C)2005-2017 Haxe Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/README.md neko-2.2.0/README.md --- neko-2.1.0/README.md 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/README.md 2017-12-19 06:38:08.000000000 +0000 @@ -34,11 +34,11 @@ Neko can be built using CMake (version 3.x is recommended) and one of the C compilers listed as follows: - * Windows: Visual Studio 2010 / 2013 (Visual Studio 2015 is not yet supported) + * Windows: Visual Studio 2010 / 2013 / 2015 / 2017 * Mac: XCode (with its "Command line tools") * Linux: gcc (can be obtained by installing the "build-essential" Debian/Ubuntu package) -Neko needs to link with various third-party libraries, which are summerized as follows: +Neko needs to link with various third-party libraries, which are summarized as follows: | library / tool | OS | Debian/Ubuntu package | |-----------------------------------------|-------------|-----------------------------------------------------------| @@ -52,7 +52,7 @@ | mbed TLS | all | libmbedtls-dev | | GTK+2 | Linux | libgtk2.0-dev | -On Windows, CMake will automatically download and build the libraries in the build folder during the build process. However, you need to install [Perl](http://www.activestate.com/activeperl) manually because OpenSSL needs it for configuration. On Mac/Linux, you should install the libraries manaully to your system before building Neko, or use the `STATIC_DEPS` CMake option, which will be explained in [CMake options](#cmake-options). +On Windows, CMake will automatically download and build the libraries in the build folder during the build process. However, you need to install [Perl](http://www.activestate.com/activeperl) manually because OpenSSL needs it for configuration. On Mac/Linux, you should install the libraries manually to your system before building Neko, or use the `STATIC_DEPS` CMake option, which will be explained in [CMake options](#cmake-options). ### Building on Mac/Linux @@ -82,7 +82,9 @@ mkdir build cd build -# run cmake +# run cmake specifying the visual studio version you need +# Visual Studio 12 2013, Visual Studio 14 2015, Visual Studio 15 2017 +# you can additionally specify platform via -A switch (x86, x64) cmake -G "Visual Studio 12 2013" .. # let's build, the outputs can be located in the "bin" directory @@ -101,21 +103,26 @@ cmake "-Doption=value" .. ``` -#### `WITH_NDLLS` +#### NDLLs -Available on all platforms. Default value: `std.ndll;zlib.ndll;mysql.ndll;mysql5.ndll;regexp.ndll;sqlite.ndll;ui.ndll;mod_neko2.ndll;mod_tora2.ndll;ssl.ndll` +Settings that allow to exclude libraries and their dependencies from the build; available on all platforms. By default all are `ON`: -It defines the ndll files to be built. You may remove ndlls from this list, such that you can avoid installing/building some dependencies. +- `WITH_REGEXP` - Build Perl-compatible regex support +- `WITH_UI` - Build GTK-2 UI support +- `WITH_SSL` - Build SSL support +- `WITH_MYSQL` - Build MySQL support +- `WITH_SQLITE` - Build Sqlite support +- `WITH_APACHE` - Build Apache modules #### `STATIC_DEPS` -Available on Mac/Linux. Default value: `none` +Default value: `all` for Windows, `none` otherwise It defines the dependencies that should be linked statically. Can be `all`, `none`, or a list of library names (e.g. `BoehmGC;Zlib;OpenSSL;MariaDBConnector;PCRE;Sqlite3;APR;APRutil;Apache;MbedTLS`). CMake will automatically download and build the specified dependencies into the build folder. If a library is not present in this list, it should be installed manually, and it will be linked dynamically. -All third-party libraries, except GTK+2 (Linux), can be linked statically. We do not support statically linking GTK+2 due to the diffculty of building it and its own dependencies. +All third-party libraries, except GTK+2 (Linux), can be linked statically. We do not support statically linking GTK+2 due to the difficulty of building it and its own dependencies. #### `RELOCATABLE` @@ -123,6 +130,18 @@ Set RPATH to `$ORIGIN` (Linux) / `@executable_path` (Mac). It allows the resulting Neko VM executable to locate libraries (e.g. "libneko" and ndll files) in its local directory, such that the libraries need not be installed to "/usr/lib" or "/usr/local/lib". +#### `NEKO_JIT_DISABLE` + +Default `OFF`. + +Disable Neko JIT. By default, Neko JIT will be enabled for platforms it supports. Setting this to `ON` disable JIT for all platforms. + +#### `NEKO_JIT_DEBUG` + +Default `OFF`. + +Debug Neko JIT. + #### `RUN_LDCONFIG` Available on Linux. Default value: `ON` diff -Nru neko-2.1.0/src/core/Args.nml neko-2.2.0/src/core/Args.nml --- neko-2.1.0/src/core/Args.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Args.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Array.nml neko-2.2.0/src/core/Array.nml --- neko-2.1.0/src/core/Array.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Array.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Buffer.nml neko-2.2.0/src/core/Buffer.nml --- neko-2.1.0/src/core/Buffer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Buffer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Core.nml neko-2.2.0/src/core/Core.nml --- neko-2.1.0/src/core/Core.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Core.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Hashtbl.nml neko-2.2.0/src/core/Hashtbl.nml --- neko-2.1.0/src/core/Hashtbl.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Hashtbl.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/IO.nml neko-2.2.0/src/core/IO.nml --- neko-2.1.0/src/core/IO.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/IO.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/LexEngine.nml neko-2.2.0/src/core/LexEngine.nml --- neko-2.1.0/src/core/LexEngine.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/LexEngine.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Lexer.nml neko-2.2.0/src/core/Lexer.nml --- neko-2.1.0/src/core/Lexer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Lexer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/List.nml neko-2.2.0/src/core/List.nml --- neko-2.1.0/src/core/List.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/List.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Map.nml neko-2.2.0/src/core/Map.nml --- neko-2.1.0/src/core/Map.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Map.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Math.nml neko-2.2.0/src/core/Math.nml --- neko-2.1.0/src/core/Math.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Math.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Net.nml neko-2.2.0/src/core/Net.nml --- neko-2.1.0/src/core/Net.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Net.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Reflect.nml neko-2.2.0/src/core/Reflect.nml --- neko-2.1.0/src/core/Reflect.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Reflect.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Regexp.nml neko-2.2.0/src/core/Regexp.nml --- neko-2.1.0/src/core/Regexp.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Regexp.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Set.nml neko-2.2.0/src/core/Set.nml --- neko-2.1.0/src/core/Set.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Set.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Stack.nml neko-2.2.0/src/core/Stack.nml --- neko-2.1.0/src/core/Stack.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Stack.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/String.nml neko-2.2.0/src/core/String.nml --- neko-2.1.0/src/core/String.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/String.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Sys.nml neko-2.2.0/src/core/Sys.nml --- neko-2.1.0/src/core/Sys.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Sys.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/core/Xml.nml neko-2.2.0/src/core/Xml.nml --- neko-2.1.0/src/core/Xml.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Xml.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -126,14 +126,14 @@ function node_text(x) { match x { - | Node (_,_,childs) -> + | Node (_,_,children) -> var b = Buffer.create(); List.iter (function(x) { match x { | CData t | PCData t -> Buffer.add b t | _ -> invalid_arg() } - }) childs; + }) children; Buffer.string b | _ -> invalid_arg() } @@ -152,9 +152,9 @@ | Document l -> List.iter write(ch) l | CData c -> IO.write ch ""; | PCData c -> IO.write ch c; - | Node (name,att,childs) -> + | Node (name,att,children) -> IO.printf ch "<%s%s" (name,String.concat "" (List.map (function((a,v)) { " "+a+"=\""+String.escape v+"\"" }) att)); - match childs { + match children { | [] -> IO.write ch "/>" | l -> IO.write ch ">"; List.iter write(ch) l; IO.printf ch "" name } diff -Nru neko-2.1.0/src/core/Zip.nml neko-2.2.0/src/core/Zip.nml --- neko-2.1.0/src/core/Zip.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/core/Zip.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/mtypes/std.neko neko-2.2.0/src/mtypes/std.neko --- neko-2.1.0/src/mtypes/std.neko 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/mtypes/std.neko 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Ast.nml neko-2.2.0/src/neko/Ast.nml --- neko-2.1.0/src/neko/Ast.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Ast.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Binast.nml neko-2.2.0/src/neko/Binast.nml --- neko-2.1.0/src/neko/Binast.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Binast.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Bytecode.nml neko-2.2.0/src/neko/Bytecode.nml --- neko-2.1.0/src/neko/Bytecode.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Bytecode.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Compile.nml neko-2.2.0/src/neko/Compile.nml --- neko-2.1.0/src/neko/Compile.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Compile.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Console.nml neko-2.2.0/src/neko/Console.nml --- neko-2.1.0/src/neko/Console.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Console.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Doc.nml neko-2.2.0/src/neko/Doc.nml --- neko-2.1.0/src/neko/Doc.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Doc.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Lexer.nml neko-2.2.0/src/neko/Lexer.nml --- neko-2.1.0/src/neko/Lexer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Lexer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Linker.nml neko-2.2.0/src/neko/Linker.nml --- neko-2.1.0/src/neko/Linker.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Linker.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Main.nml neko-2.2.0/src/neko/Main.nml --- neko-2.1.0/src/neko/Main.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Main.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -135,7 +135,7 @@ try { var v = Sys.version; - var head = "Neko Compiler v" + v.maj + "." + v.min + "." + v.build + " - (c)2005-2016 Haxe Foundation\n Usage : neko [options] files..."; + var head = "Neko Compiler v" + v.maj + "." + v.min + "." + v.build + " - (c)2005-2017 Haxe Foundation\n Usage : neko [options] files..."; var link = &None; var links = &[]; var version = &0; diff -Nru neko-2.1.0/src/neko/Parser.nml neko-2.2.0/src/neko/Parser.nml --- neko-2.1.0/src/neko/Parser.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Parser.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Printer.nml neko-2.2.0/src/neko/Printer.nml --- neko-2.1.0/src/neko/Printer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Printer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/neko/Xml.nml neko-2.2.0/src/neko/Xml.nml --- neko-2.1.0/src/neko/Xml.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/neko/Xml.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -185,7 +185,7 @@ var e , p = ast; var name = &""; var val = &None; - var childs = &[]; + var children = &[]; match e { | EConst c -> match c { @@ -209,67 +209,67 @@ } | EBlock el -> name := "b"; - childs := List.map (to_xml_rec p) el; + children := List.map (to_xml_rec p) el; | EParenthesis e -> name := "p"; - childs := [to_xml_rec p e]; + children := [to_xml_rec p e]; | EField (e,f) -> name := "g"; val := Some f; - childs := [to_xml_rec p e]; + children := [to_xml_rec p e]; | ECall (e,el) -> name := "c"; - childs := to_xml_rec p e :: List.map (to_xml_rec p) el; + children := to_xml_rec p e :: List.map (to_xml_rec p) el; | EArray (a,b) -> name := "a"; - childs := [to_xml_rec p a; to_xml_rec p b]; + children := [to_xml_rec p a; to_xml_rec p b]; | EVars vl -> name := "var"; - childs := List.map (function((v,e)) { + children := List.map (function((v,e)) { Node "v" [("v",v)] (match e { None -> [] | Some e -> [to_xml_rec p e] }) }) vl; | EWhile (econd,e,NormalWhile) -> name := "while"; - childs := [to_xml_rec p econd; to_xml_rec p e]; + children := [to_xml_rec p econd; to_xml_rec p e]; | EWhile (econd,e,DoWhile) -> name := "do"; - childs := [to_xml_rec p e; to_xml_rec p econd]; + children := [to_xml_rec p e; to_xml_rec p econd]; | EIf (cond,e,eelse) -> name := "if"; - childs := to_xml_rec p cond :: to_xml_rec p e :: (match eelse { None -> [] | Some e -> [to_xml_rec p e] }) + children := to_xml_rec p cond :: to_xml_rec p e :: (match eelse { None -> [] | Some e -> [to_xml_rec p e] }) | ETry (e1,v,e2) -> name := "try"; val := Some v; - childs := [to_xml_rec p e1; to_xml_rec p e2]; + children := [to_xml_rec p e1; to_xml_rec p e2]; | EFunction (args,e) -> name := "function"; val := Some (String.concat ":" args); - childs := [to_xml_rec p e]; + children := [to_xml_rec p e]; | EBinop (op,e1,e2) -> name := "o"; val := Some op; - childs := [to_xml_rec p e1; to_xml_rec p e2]; + children := [to_xml_rec p e1; to_xml_rec p e2]; | EReturn e -> name := "return"; - childs := match e { None -> [] | Some e -> [to_xml_rec p e]}; + children := match e { None -> [] | Some e -> [to_xml_rec p e]}; | EBreak e -> name := "break"; - childs := match e { None -> [] | Some e -> [to_xml_rec p e]}; + children := match e { None -> [] | Some e -> [to_xml_rec p e]}; | EContinue -> name := "continue"; | ENext (e1,e2) -> name := "next"; - childs := [to_xml_rec p e1; to_xml_rec p e2]; + children := [to_xml_rec p e1; to_xml_rec p e2]; | EObject fl -> name := "object"; - childs := List.map (function((v,e)) { Node "v" [("v",v)] [to_xml_rec p e] }) fl; + children := List.map (function((v,e)) { Node "v" [("v",v)] [to_xml_rec p e] }) fl; | ELabel v -> name := "label"; val := Some v; | ESwitch (e,cases,def) -> name := "switch"; var cases = List.map (function((e1,e2)) { Node "case" [] [to_xml_rec p e1; to_xml_rec p e2] }) cases; - childs := to_xml_rec p e :: (match def { None -> cases | Some e -> Node "default" [] [to_xml_rec p e] :: cases }); + children := to_xml_rec p e :: (match def { None -> cases | Some e -> Node "default" [] [to_xml_rec p e] :: cases }); } var pos = (if p.psource != p2.psource then [("p",p.psource + ":" + p.pline)] @@ -278,7 +278,7 @@ else []); var val = match *val { None -> [] | Some v -> [("v",v)] }; - Node (*name) (List.append pos val) (*childs) + Node (*name) (List.append pos val) (*children) } function to_xml(ast) { diff -Nru neko-2.1.0/src/nekoml/Ast.nml neko-2.2.0/src/nekoml/Ast.nml --- neko-2.1.0/src/nekoml/Ast.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Ast.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/nekoml/Lexer.nml neko-2.2.0/src/nekoml/Lexer.nml --- neko-2.1.0/src/nekoml/Lexer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Lexer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/nekoml/Main.nml neko-2.2.0/src/nekoml/Main.nml --- neko-2.1.0/src/nekoml/Main.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Main.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -77,7 +77,7 @@ try { var v = Sys.version; - var head = "NekoML Compiler v" + v.maj + "." + v.min + "." + v.build + " - (c)2005-2016 Haxe Foundation\n Usage : nekoml [options] files..."; + var head = "NekoML Compiler v" + v.maj + "." + v.min + "." + v.build + " - (c)2005-2017 Haxe Foundation\n Usage : nekoml [options] files..."; var path = &[""]; var files = &[]; var neko = &false; diff -Nru neko-2.1.0/src/nekoml/Match.nml neko-2.2.0/src/nekoml/Match.nml --- neko-2.1.0/src/nekoml/Match.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Match.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/nekoml/Neko.nml neko-2.2.0/src/nekoml/Neko.nml --- neko-2.1.0/src/nekoml/Neko.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Neko.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/nekoml/Parser.nml neko-2.2.0/src/nekoml/Parser.nml --- neko-2.1.0/src/nekoml/Parser.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Parser.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/nekoml/Type.nml neko-2.2.0/src/nekoml/Type.nml --- neko-2.1.0/src/nekoml/Type.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Type.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/nekoml/Typer.nml neko-2.2.0/src/nekoml/Typer.nml --- neko-2.1.0/src/nekoml/Typer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/nekoml/Typer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/tools/makedoc.neko neko-2.2.0/src/tools/makedoc.neko --- neko-2.1.0/src/tools/makedoc.neko 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/tools/makedoc.neko 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/src/tools/nekoboot.neko neko-2.2.0/src/tools/nekoboot.neko --- neko-2.1.0/src/tools/nekoboot.neko 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/tools/nekoboot.neko 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,21 +22,156 @@ // primitives -elf_update_section_header = $loader.loadprim("std@elf_update_section_header_for_bytecode",3); -file_contents = $loader.loadprim("std@file_contents",1); -file_open = $loader.loadprim("std@file_open",2); -file_write = $loader.loadprim("std@file_write",4); -file_write_char = $loader.loadprim("std@file_write_char",2); -file_close = $loader.loadprim("std@file_close",1); -command = $loader.loadprim("std@sys_command",1); -system = $loader.loadprim("std@sys_string",0)(); -cwd = $loader.loadprim("std@get_cwd",0)(); -get_env = $loader.loadprim("std@get_env",1); -string_split = $loader.loadprim("std@string_split",2); +var c_src = "#include +#include +#include +#include \"neko_vm.h\" +#include \"neko_elf.h\" +#ifdef NEKO_WINDOWS +# include +#else +# include +#endif +#ifdef NEKO_MAC +# include +# include +#endif +#ifdef NEKO_BSD +# include +# include +#endif +#ifdef NEKO_POSIX +# include +#endif + +#define default_loader neko_default_loader +unsigned char program[] = %s; +unsigned int program_len = %d; +unsigned int program_pos = 0; + +static void report( neko_vm *vm, value exc, int isexc ) { + int i; + buffer b = alloc_buffer(NULL); + value st = neko_exc_stack(vm); + for(i=0;i available) mlen = available; + memcpy(val_string(str)+val_int(pos), prog, mlen); + program_pos += mlen; + return alloc_int(mlen); +} + +/* + C functions corresponding to the following Neko code : + + module_read = $loader.loadprim(\"std@module_read\",2); + module_exec = $loader.loadprim(\"std@module_exec\",1); + module_val = module_read(read_bytecode,$loader); + module_exec(module_val); + +*/ + +int neko_execute_self( neko_vm *vm, value mload ) { + value args[] = { alloc_string(\"std@module_read\"), alloc_int(2) }; + value args2[] = { alloc_string(\"std@module_exec\"), alloc_int(1) }; + value args3[] = { alloc_function(read_bytecode,3,\"boot_read_bytecode\"), mload }; + value exc = NULL; + value module_read, module_exec, module_val; + module_read = val_callEx(mload,val_field(mload,val_id(\"loadprim\")),args,2,&exc); + if( exc != NULL ) { + report(vm,exc,1); + return 1; + } + module_exec = val_callEx(mload,val_field(mload,val_id(\"loadprim\")),args2,2,&exc); + if( exc != NULL ) { + report(vm,exc,1); + return 1; + } + module_val = val_callEx(val_null,module_read,args3,2,&exc); + if( exc != NULL ) { + report(vm,exc,1); + return 1; + } + alloc_field(val_field(mload,val_id(\"cache\")),val_id(\"_self\"),module_val); + val_callEx(val_null,module_exec,&module_val,1,&exc); + if( exc != NULL ) { + report(vm,exc,1); + return 1; + } + return 0; +} + +#ifdef NEKO_POSIX +static void handle_signal( int signal ) { + if( signal == SIGPIPE ) + val_throw(alloc_string(\"Broken pipe\")); + else + val_throw(alloc_string(\"Segmentation fault\")); +} +#endif + +int main( int argc, char *argv[] ) { + neko_vm *vm; + value mload; + int r; + neko_global_init(); + vm = neko_vm_alloc(NULL); + neko_vm_select(vm); + + mload = default_loader(argv+1,argc-1); + r = neko_execute_self(vm,mload); + if( mload != NULL && val_field(mload,val_id(\"dump_prof\")) != val_null ) + val_ocall0(mload,val_id(\"dump_prof\")); + vm = NULL; + mload = NULL; + neko_vm_select(NULL); + neko_global_free(); + return r; +}"; + +var elf_update_section_header = $loader.loadprim("std@elf_update_section_header_for_bytecode",3); +var file_contents = $loader.loadprim("std@file_contents",1); +var file_open = $loader.loadprim("std@file_open",2); +var file_write = $loader.loadprim("std@file_write",4); +var file_write_char = $loader.loadprim("std@file_write_char",2); +var file_close = $loader.loadprim("std@file_close",1); +var command = $loader.loadprim("std@sys_command",1); +var system = $loader.loadprim("std@sys_string",0)(); +var cwd = $loader.loadprim("std@get_cwd",0)(); +var get_env = $loader.loadprim("std@get_env",1); +var string_split = $loader.loadprim("std@string_split",2); +var buffer_new = $loader.loadprim("std@buffer_new",0); +var buffer_add = $loader.loadprim("std@buffer_add",2); +var buffer_string = $loader.loadprim("std@buffer_string",1); +var sprintf = $loader.loadprim("std@sprintf",2); // find a substring from then end -find = function(str,sub,pos) { +var find = function(str,sub,pos) { var l1 = $ssize(str); var l2 = $ssize(sub); var i = l1 - pos; @@ -50,10 +185,17 @@ // find a file in a path -find_exe_in_path = function(path,file) { +var find_exe_in_path = function(path,file) { while( path != null ) { try { - var s = file_contents(path[0]+file); + var p = path[0]; + var l = $ssize(p); + if ( l > 0 ) { // add trailing slash + var last = $sget(p,l-1); + if ( last != "/" || last != "\\" ) + p = p + "/"; + } + var s = file_contents(p + file); if( $sget(s,0) == 35 ) // '#' $throw("Is a script"); return s; @@ -64,7 +206,7 @@ $throw("The bootable executable file was not found : "+file); } -find_exe_in_paths = function(paths,file) { +var find_exe_in_paths = function(paths,file) { var i = 0; var len = $asize(paths); while( i < len ) { @@ -80,62 +222,94 @@ // bytecode = first argument var args = $loader.args; -var exe_ext = switch system { "Windows" => ".exe" default => "" }; -var boot_exe = "neko" + exe_ext; -if( args[0] == "-b" ) { - boot_exe = args[1]; - args = $asub(args,2,$asize(args)-2); -} -if( $asize(args) != 1 ) - $throw("Need bytecode argument"); -var file = args[0]; -var bytecode = file_contents(file); - -// load boot binary -var path_sep = switch system { - "Windows" => ";" - default => ":" -} -var path = string_split(get_env("PATH"), path_sep); -var boot = find_exe_in_paths($array($array(cwd,null),$loader.path,path),boot_exe); -var boot_size = $ssize(boot); - -var dot_pos = find(file,".",1); -if( dot_pos != null ) - file = $ssub(file,0,dot_pos); - -// create executable file : -// this is the content of boot.bin where is appended -// the neko bytecode followed by 'NEKO' and the original exe size - -var out_name = file+exe_ext; -var out = file_open(out_name,"wb"); -var bytecode_size = $ssize(bytecode); -var pad_size = (4-(boot_size&0x3)) & 0x3; - -file_write(out,boot,0,boot_size); -boot_size += pad_size; -if( pad_size >= 3 ) file_write_char(out,0x00); -if( pad_size >= 2 ) file_write_char(out,0x00); -if( pad_size >= 1 ) file_write_char(out,0x00); -file_write(out,bytecode,0,bytecode_size) -file_write(out,"NEKO",0,4); -file_write_char(out,boot_size & 0xFF); -file_write_char(out,(boot_size >> 8) & 0xFF); -file_write_char(out,(boot_size >> 16) & 0xFF); -file_write_char(out,boot_size >>> 24); -file_close(out); - -// set execution rights - -switch system { - "Windows" => null - default => command("chmod 755 "+out_name) -} +if( args[0] == "-c" ) { + + var file = args[1]; + var bytecode = file_contents(file); + var bytecode_len = $ssize(bytecode); + var program_buf = buffer_new(); + buffer_add(program_buf, "{"); + var i = 0; + while(true) { + buffer_add(program_buf, $sget(bytecode, i)); + i += 1; + if (i < bytecode_len) { + buffer_add(program_buf, ","); + } else { + break; + } + } + buffer_add(program_buf, "}"); + + // write a C source that run the module using neko + var c_name = if ($ssub(file, $ssize(file)-2, 2) == ".n") + $ssub(file, 0, $ssize(file)-2) + ".c"; + else + file+".c"; + var c_file = file_open(c_name,"wb"); + c_src = sprintf(c_src, $array(buffer_string(program_buf), bytecode_len, "%s")); + file_write(c_file, c_src, 0, $ssize(c_src)); + file_close(c_file); + +} else { + + var exe_ext = switch system { "Windows" => ".exe" default => "" }; + var boot_exe = "neko" + exe_ext; + if( args[0] == "-b" ) { + boot_exe = args[1]; + args = $asub(args,2,$asize(args)-2); + } + if( $asize(args) != 1 ) + $throw("Need bytecode argument"); + var file = args[0]; + var bytecode = file_contents(file); + + // load boot binary + var path_sep = switch system { + "Windows" => ";" + default => ":" + } + var path = string_split(get_env("PATH"), path_sep); + var boot = find_exe_in_paths($array($array(cwd,null),$loader.path,path),boot_exe); + var boot_size = $ssize(boot); + + var dot_pos = find(file,".",1); + if( dot_pos != null ) + file = $ssub(file,0,dot_pos); + + // create executable file : + // this is the content of boot.bin where is appended + // the neko bytecode followed by 'NEKO' and the original exe size + + var out_name = file+exe_ext; + var out = file_open(out_name,"wb"); + var bytecode_size = $ssize(bytecode); + var pad_size = (4-(boot_size&0x3)) & 0x3; + + file_write(out,boot,0,boot_size); + boot_size += pad_size; + if( pad_size >= 3 ) file_write_char(out,0x00); + if( pad_size >= 2 ) file_write_char(out,0x00); + if( pad_size >= 1 ) file_write_char(out,0x00); + file_write(out,bytecode,0,bytecode_size) + file_write(out,"NEKO",0,4); + file_write_char(out,boot_size & 0xFF); + file_write_char(out,(boot_size >> 8) & 0xFF); + file_write_char(out,(boot_size >> 16) & 0xFF); + file_write_char(out,boot_size >>> 24); + file_close(out); + + // set execution rights + + switch system { + "Windows" => null + default => command("chmod 755 "+out_name) + } -// Update ELF section header (on platforms where that is appropriate) to protect -// binary's bytecode from being removed by the strip program + // Update ELF section header (on platforms where that is appropriate) to protect + // binary's bytecode from being removed by the strip program -var res = elf_update_section_header(out_name,boot_size,bytecode_size+8); -if( res == 0 ) + var res = elf_update_section_header(out_name,boot_size,bytecode_size+8); + if( res == 0 ) $print("Trouble updating elf section header; stripping binary may lead to problems!") +} diff -Nru neko-2.1.0/src/tools/Tools.nml neko-2.2.0/src/tools/Tools.nml --- neko-2.1.0/src/tools/Tools.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/tools/Tools.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -30,7 +30,7 @@ } try { - var head = "Neko Tools v1.0 - (c)2005-2016 Haxe Foundation\nUsage : nekotools [options]"; + var head = "Neko Tools v1.0 - (c)2005-2017 Haxe Foundation\nUsage : nekotools [options]"; var decl = [ ("server", Args.Void (function() { erase_argument(); diff -Nru neko-2.1.0/src/tools/WebServer.nml neko-2.2.0/src/tools/WebServer.nml --- neko-2.1.0/src/tools/WebServer.nml 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/src/tools/WebServer.nml 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -597,7 +597,7 @@ try { client_msg(c); } catch { - | Invalid_char -> printf "Invalid char reveived\n" (); + | Invalid_char -> printf "Invalid char received\n" (); | IO.Eof -> printf "Connection aborted\n" (); | Neko_error e when Reflect.value e == Reflect.VString "std@socket_send" -> printf "Sending file aborted\n" (); } @@ -607,7 +607,7 @@ } function init() { - var head = "Neko Web Server v1.0 - (c)2005-2016 Haxe Foundation"; + var head = "Neko Web Server v1.0 - (c)2005-2017 Haxe Foundation"; var port = &2000; var host = &"localhost"; var decl = [ diff -Nru neko-2.1.0/vm/alloc.c neko-2.2.0/vm/alloc.c --- neko-2.1.0/vm/alloc.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/alloc.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -117,7 +117,6 @@ } void neko_gc_init() { - GC_set_warn_proc((GC_warn_proc)(void*)null_warn_proc); # ifndef NEKO_WINDOWS // we can't set this on windows with old GC since // it's already initialized through its own DllMain @@ -131,6 +130,7 @@ #endif GC_java_finalization = 1; GC_init(); + GC_set_warn_proc((GC_warn_proc)(void*)null_warn_proc); GC_no_dls = 1; #ifdef LOW_MEM GC_dont_expand = 1; @@ -178,7 +178,7 @@ s = (vstring*)gc_alloc_private_big(size+sizeof(vstring)); if( s == NULL ) failure("out of memory"); - s->t = VAL_STRING | (size << TAG_BITS); + s->t = VAL_STRING | (size << NEKO_TAG_BITS); (&s->c)[size] = 0; return (value)s; } @@ -211,7 +211,7 @@ failure("max_array_size reached"); v = (value)gc_alloc_big(sizeof(varray)+(n - 1)*sizeof(value)); if( v == NULL ) failure("out of memory"); - v->t = VAL_ARRAY | (n << TAG_BITS); + v->t = VAL_ARRAY | (n << NEKO_TAG_BITS); return v; } diff -Nru neko-2.1.0/vm/builtins.c neko-2.2.0/vm/builtins.c --- neko-2.1.0/vm/builtins.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/builtins.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/callback.c neko-2.2.0/vm/callback.c --- neko-2.1.0/vm/callback.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/callback.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/elf.c neko-2.2.0/vm/elf.c --- neko-2.1.0/vm/elf.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/elf.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2016 Haxe Foundation + * Copyright (C)2016-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/hash.c neko-2.2.0/vm/hash.c --- neko-2.1.0/vm/hash.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/hash.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/interp.c neko-2.2.0/vm/interp.c --- neko-2.1.0/vm/interp.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/interp.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/jit_x86.c neko-2.2.0/vm/jit_x86.c --- neko-2.1.0/vm/jit_x86.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/jit_x86.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -36,10 +36,6 @@ #define tmp_alloc(size) malloc(size) #define tmp_free(ptr) free(ptr) -#if defined(NEKO_X86) && !defined(NEKO_MAC) -#define JIT_ENABLE -#endif - #ifdef NEKO_MAC #define STACK_ALIGN #endif @@ -49,11 +45,9 @@ #define STACK_ALIGN_DEBUG #endif -#define TAG_MASK ((1< 0 ) { - XUShr_rc(TMP,TAG_BITS); + XUShr_rc(TMP,NEKO_TAG_BITS); XCmp_rc(TMP,n); XJump(JLte,jbounds); } @@ -1740,7 +1734,7 @@ case AccEnv: get_var_r(TMP,VEnv); XMov_rp(TMP2,TMP,FIELD(0)); - XCmp_rc(TMP2,(p << TAG_BITS) | VAL_ARRAY); + XCmp_rc(TMP2,(p << NEKO_TAG_BITS) | VAL_ARRAY); XJump(JGt,jok); runtime_error(1,false); // Reading Outside Env PATCH_JUMP(jok); @@ -1763,7 +1757,7 @@ // check bounds & access array XShr_rc(ACC,1); XMov_rp(TMP2,TMP,FIELD(0)); - XUShr_rc(TMP2,TAG_BITS); + XUShr_rc(TMP2,NEKO_TAG_BITS); XCmp_rr(ACC,TMP2); XJump(JGte,jbounds); XAdd_rc(ACC,1); // acc = val_array_ptr(tmp)[acc] @@ -1880,7 +1874,7 @@ case SetEnv: get_var_r(TMP,VEnv); XMov_rp(TMP2,TMP,FIELD(0)); - XCmp_rc(TMP2,(p << TAG_BITS) | VAL_ARRAY); + XCmp_rc(TMP2,(p << NEKO_TAG_BITS) | VAL_ARRAY); XJump(JGt,jok); runtime_error(2,false); // Writing Outside Env PATCH_JUMP(jok); @@ -1932,7 +1926,7 @@ XMov_rp(TMP,TMP,FIELD(0)); // tmp = tmp->type XShr_rc(TMP2,1); - XUShr_rc(TMP,TAG_BITS); + XUShr_rc(TMP,NEKO_TAG_BITS); XCmp_rr(TMP2,TMP); XJump(JGte,jend1); @@ -1981,7 +1975,7 @@ XJump(JNeq,jnot_array); XMov_rp(TMP2,TMP,FIELD(0)); - XCmp_rc(TMP2,(p << TAG_BITS) | VAL_ARRAY); // fake header + XCmp_rc(TMP2,(p << NEKO_TAG_BITS) | VAL_ARRAY); // fake header XJump(JLte,jend1); XMov_pr(TMP,FIELD(p + 1),ACC); XJump_near(jend2); @@ -2528,7 +2522,7 @@ } -#if defined(STACK_ALIGN_DEBUG) || defined(JIT_DEBUG) +#if defined(STACK_ALIGN_DEBUG) || defined(NEKO_JIT_DEBUG) # define MAX_OP_SIZE 1000 # define MAX_BUF_SIZE 1000 #else @@ -2682,7 +2676,7 @@ } // --------- debug --------- -# ifdef JIT_DEBUG +# ifdef NEKO_JIT_DEBUG if( ctx->debug_wait ) ctx->debug_wait--; else { @@ -2744,7 +2738,7 @@ m->jit_gc = alloc_abstract(NULL,rbuf); val_gc(m->jit_gc,free_jit_abstract); # endif -# ifdef JIT_DEBUG +# ifdef NEKO_JIT_DEBUG printf("Jit size = %d ( x%.1f )\n",csize,csize * 1.0 / ((m->codesize + 1) * 4)); # endif jit_finalize_context(ctx); @@ -2764,7 +2758,7 @@ tmp_free(ctx->pos); } -#else // JIT_ENABLE +#else // NEKO_JIT_ENABLE char *jit_boot_seq = NULL; char *jit_handle_trap = (char*)&jit_boot_seq; diff -Nru neko-2.1.0/vm/load.c neko-2.2.0/vm/load.c --- neko-2.1.0/vm/load.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/load.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -284,7 +284,7 @@ } #else if( path == NULL ) { - allocated = strdup("/usr/local/lib/neko:/usr/lib/neko:/usr/local/bin:/usr/bin"); + allocated = strdup(NEKO_MODULE_PATH ":/usr/local/lib/neko:/usr/lib/neko:/usr/local/bin:/usr/bin"); path = allocated; } #endif diff -Nru neko-2.1.0/vm/main.c neko-2.2.0/vm/main.c --- neko-2.1.0/vm/main.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/main.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,6 +28,7 @@ # include #else # include +# include #endif #ifdef NEKO_MAC # include @@ -91,10 +92,10 @@ sysctl(mib, 4, path, &cb, NULL, 0); if (!cb) return NULL; return path; -#else - static char path[200]; +#elif defined(NEKO_LINUX) + static char path[PATH_MAX]; int length = readlink("/proc/self/exe", path, sizeof(path)); - if( length < 0 || length >= 200 ) { + if( length < 0 || length >= PATH_MAX ) { char *p = getenv(" "); // for upx if( p == NULL ) p = getenv("_"); @@ -102,6 +103,8 @@ } path[length] = '\0'; return path; +#else + return getenv("_"); #endif } @@ -113,9 +116,9 @@ return 0; #ifdef SEPARATE_SECTION_FOR_BYTECODE - /* Look for a ,nekobytecode section in the executable... */ - if ( val_true != elf_find_embedded_bytecode(exe,&beg,&end) ) { - /* Couldn't find a .nekobytecode section, + /* Look for a .nekobytecode section in the executable..., there is always a small section */ + if ( val_true != elf_find_embedded_bytecode(exe,&beg,&end) || end-beg <= 8) { + /* Couldn't find a big enough .nekobytecode section, fallback to looking at the end of the executable... */ beg = -1; end = 0; } @@ -256,6 +259,14 @@ # ifdef NEKO_STANDALONE neko_standalone_init(); # endif +# ifdef NEKO_POSIX + struct sigaction act; + act.sa_sigaction = NULL; + act.sa_handler = handle_signal; + act.sa_flags = 0; + sigemptyset(&act.sa_mask); + sigaction(SIGPIPE,&act,NULL); +# endif if( !neko_has_embedded_module(vm) ) { int jit = 1; int stats = 0; @@ -283,12 +294,6 @@ break; } # ifdef NEKO_POSIX - struct sigaction act; - act.sa_sigaction = NULL; - act.sa_handler = handle_signal; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGPIPE,&act,NULL); if( jit ) sigaction(SIGSEGV,&act,NULL); # endif @@ -297,7 +302,7 @@ # ifdef NEKO_STANDALONE report(vm,alloc_string("No embedded module in this executable"),0); # else - printf("NekoVM %d.%d.%d (c)2005-2016 Haxe Foundation\n Usage : neko \n",NEKO_VERSION_MAJOR,NEKO_VERSION_MINOR,NEKO_VERSION_PATCH); + printf("NekoVM %d.%d.%d (c)2005-2017 Haxe Foundation\n Usage : neko \n",NEKO_VERSION_MAJOR,NEKO_VERSION_MINOR,NEKO_VERSION_PATCH); # endif mload = NULL; r = 1; diff -Nru neko-2.1.0/vm/module.c neko-2.2.0/vm/module.c --- neko-2.1.0/vm/module.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/module.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -34,22 +34,9 @@ #ifdef NEKO_BSD # include #endif -#ifndef LITTLE_ENDIAN -# define LITTLE_ENDIAN 1 -#endif -#ifndef BIG_ENDIAN -# define BIG_ENDIAN 2 -#endif -#ifdef NEKO_WINDOWS -# define BYTE_ORDER LITTLE_ENDIAN -#endif -#ifndef BYTE_ORDER -# warning BYTE_ORDER unknown, assuming BIG_ENDIAN -# define BYTE_ORDER BIG_ENDIAN -#endif /* *_TO_LE(X) converts (X) to little endian. */ -#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef NEKO_LITTLE_ENDIAN # define LONG_TO_LE(X) (X) # define SHORT_TO_LE(X) (X) #else @@ -98,7 +85,7 @@ extern void neko_module_jit( neko_module *m ); EXTERN int neko_is_big_endian() { -#if BYTE_ORDER == LITTLE_ENDIAN +#ifdef NEKO_LITTLE_ENDIAN return 0; #else return 1; diff -Nru neko-2.1.0/vm/neko_elf.h neko-2.2.0/vm/neko_elf.h --- neko-2.1.0/vm/neko_elf.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/neko_elf.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2016 Haxe Foundation + * Copyright (C)2016-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/neko.h.in neko-2.2.0/vm/neko.h.in --- neko-2.1.0/vm/neko.h.in 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/neko.h.in 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,7 +27,7 @@ # define NEKO_WINDOWS #endif -#if defined(__APPLE__) || defined(__MACH__) || defined(macintosh) +#if defined(__APPLE__) || defined(macintosh) # define NEKO_MAC #endif @@ -43,6 +43,10 @@ # define NEKO_BSD #endif +#if defined(__GNU__) +# define NEKO_HURD +#endif + // COMPILER/PROCESSOR FLAGS #if defined(__GNUC__) # define NEKO_GCC @@ -58,6 +62,10 @@ # define NEKO_MINGW #endif +#if defined(__CYGWIN__) +# define NEKO_CYGWIN +#endif + #if defined(__i386__) || defined(_WIN32) # define NEKO_X86 #endif @@ -70,7 +78,7 @@ # define NEKO_64BITS #endif -#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD) +#if defined(NEKO_LINUX) || defined(NEKO_MAC) || defined(NEKO_BSD) || defined(NEKO_GNUKBSD) || defined(NEKO_HURD) || defined(NEKO_CYGWIN) # define NEKO_POSIX #endif @@ -88,11 +96,28 @@ # include #endif +#cmakedefine NEKO_XLOCALE_H + +#cmakedefine NEKO_BIG_ENDIAN + +#ifndef NEKO_BIG_ENDIAN +# define NEKO_LITTLE_ENDIAN +#endif + +#cmakedefine NEKO_JIT_DISABLE +#cmakedefine NEKO_JIT_DEBUG + +#if !defined(NEKO_JIT_DISABLE) && defined(NEKO_X86) && !defined(NEKO_MAC) && !defined(_WIN64) +#define NEKO_JIT_ENABLE +#endif + #define NEKO_VERSION_MAJOR @NEKO_VERSION_MAJOR@ #define NEKO_VERSION_MINOR @NEKO_VERSION_MINOR@ #define NEKO_VERSION_PATCH @NEKO_VERSION_PATCH@ #define NEKO_VERSION @NEKO_VERSION_MAJOR@@NEKO_VERSION_MINOR@@NEKO_VERSION_PATCH@ +#define NEKO_MODULE_PATH "@NEKO_MODULE_PATH@" + typedef intptr_t int_val; typedef enum { @@ -196,10 +221,10 @@ typedef struct _mt_local mt_local; typedef struct _mt_lock mt_lock; -#define TAG_BITS 4 +#define NEKO_TAG_BITS 4 #define val_tag(v) (*(val_type*)(v)) -#define val_short_tag(v) (val_tag(v)&((1<c) -#define val_strlen(v) ((signed)(((unsigned)val_tag(v)) >> TAG_BITS)) -#define val_set_length(v,l) val_tag(v) = val_short_tag(v) | ((l) << TAG_BITS) +#define val_strlen(v) ((signed)(((unsigned)val_tag(v)) >> NEKO_TAG_BITS)) +#define val_set_length(v,l) val_tag(v) = val_short_tag(v) | ((l) << NEKO_TAG_BITS) #define val_set_size val_set_length -#define val_array_size(v) ((signed)(((unsigned)val_tag(v)) >> TAG_BITS)) +#define val_array_size(v) ((signed)(((unsigned)val_tag(v)) >> NEKO_TAG_BITS)) #define val_array_ptr(v) (&((varray*)(v))->ptr) #define val_fun_nargs(v) ((vfunction*)(v))->nargs #define alloc_int(v) ((value)(int_val)((((int)(v)) << 1) | 1)) #define alloc_bool(b) ((b)?val_true:val_false) -#define max_array_size ((1 << (32 - TAG_BITS)) - 1) -#define max_string_size ((1 << (32 - TAG_BITS)) - 1) +#define max_array_size ((1 << (32 - NEKO_TAG_BITS)) - 1) +#define max_string_size ((1 << (32 - NEKO_TAG_BITS)) - 1) #define invalid_comparison 0xFE #undef EXTERN diff -Nru neko-2.1.0/vm/neko_mod.h neko-2.2.0/vm/neko_mod.h --- neko-2.1.0/vm/neko_mod.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/neko_mod.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/neko_vm.h neko-2.2.0/vm/neko_vm.h --- neko-2.1.0/vm/neko_vm.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/neko_vm.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/objtable.c neko-2.2.0/vm/objtable.c --- neko-2.1.0/vm/objtable.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/objtable.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/objtable.h neko-2.2.0/vm/objtable.h --- neko-2.1.0/vm/objtable.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/objtable.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/opcodes.h neko-2.2.0/vm/opcodes.h --- neko-2.1.0/vm/opcodes.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/opcodes.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/others.c neko-2.2.0/vm/others.c --- neko-2.1.0/vm/others.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/others.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/stats.c neko-2.2.0/vm/stats.c --- neko-2.1.0/vm/stats.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/stats.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/threads.c neko-2.2.0/vm/threads.c --- neko-2.1.0/vm/threads.c 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/threads.c 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff -Nru neko-2.1.0/vm/vm.h neko-2.2.0/vm/vm.h --- neko-2.1.0/vm/vm.h 2016-05-07 15:05:07.000000000 +0000 +++ neko-2.2.0/vm/vm.h 2017-12-19 06:38:08.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C)2005-2016 Haxe Foundation + * Copyright (C)2005-2017 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"),