Skip to content

Commit

Permalink
duktape support (pxscene#784)
Browse files Browse the repository at this point in the history
* Duktape proof of concept (pxscene#715)

* Initial duktape support / swap to replace node / v8

* Basic README

* Linux build updates

* Remove node dependency

* Stability updates

* Step by step build instructions

* Cleaning up.

* Reverting additional changes that weren’t absolutely necessary.

* Fix compliation issue on Linux

* Minor formatting cleanup

* Require fix-up

* Changes to support both Node and duktape at compile time.

* Unnecessary changes

* Update build doc for duktape build flag

* Move dukluv to external directory

* Some fixes for building OSX with duktape...   node probably broken right now

* Build changes to build OS for duktape... node probably broken

* First cut refactoring to push node support under a rtScript abstraction

* Added support for support both node and duktape in same build with a runtime switch

* Eliminated need for "mapKeys" property used in duktape interop.

* Added support for js arrays (makes dom.js work now)

* duktape doesn't need v8

* Added a few more convenience APIs for retrieving env variables

* Adding #defines for script engines into build

* Code cleanup

* changes for verifying nodestuff in _duktape branch (pxscene#775)

* changes for verifying nodestuff in _duktape branch

* changes for verifying nodestuff in _duktape branch

* few more changes to make it work on all platforms

* few more changes to make it work on all platforms

* updates for the duktape branch

* Some rudimentry websocket support for duktape... (no wss yet)

* ignore false positive leak report (timing issue)

* build updates
  • Loading branch information
mfiess authored Jan 18, 2018
1 parent d870a36 commit 2cb2fc5
Show file tree
Hide file tree
Showing 739 changed files with 428,195 additions and 14,169 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,20 @@ examples/pxScene2d/external/breakpad-chrome_55/*
examples/pxScene2d/external/freetype-2.5.2/*
examples/pxScene2d/external/libjpeg-turbo-1.5.1/*
examples/pxScene2d/external/libpng-1.6.28/*

CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake

examples/pxScene2d/external/dukluv/Makefile
examples/pxScene2d/external/dukluv/dukluv
examples/pxScene2d/external/dukluv/build/dukluv
examples/pxScene2d/external/libpng-1.6.28/libtool
examples/pxScene2d/external/libpng-1.6.28/timepng

tests/pxScene2d/Makefile


8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ option(BUILD_PXSCENE "BUILD_PXSCENE" ON)
option(BUILD_PX_TESTS "BUILD_PX_TESTS" OFF)
option(BUILD_RTREMOTE_LIBS "BUILD_RTREMOTE_LIBS" OFF)

option(SUPPORT_DUKTAPE "SUPPORT_DUKTAPE" ON)
option(SUPPORT_NODE "SUPPORT_NODE" ON)

if (BUILD_DUKTAPE)
message("Building duktape with pxcore")
add_subdirectory(examples/pxScene2d/external/dukluv)
endif (BUILD_DUKTAPE)

if (BUILD_PXCORE)
message("Building pxcore")
add_subdirectory(src)
Expand Down
25 changes: 25 additions & 0 deletions ci/leak.supp
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,28 @@
fun:_ZN4node9AsyncWrap12MakeCallbackEN2v85LocalINS1_8FunctionEEEiPNS2_INS1_5ValueEEE
fun:_ZN4nodeL5AfterEP7uv_fs_s
}
{
textureDrawShaderLeaks
Memcheck:Leak
match-leak-kinds: definite
fun:calloc
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
obj:*
fun:_ZN21aTextureShaderProgram4drawEiiPffiPKvS2_5rtRefI9pxTextureEPKf
fun:_ZL16drawImageTextureffff5rtRefI9pxTextureES1_bPfN18pxConstantsStretch9constantsES4_
fun:_ZN9pxContext9drawImageEffff5rtRefI9pxTextureES2_bPfN18pxConstantsStretch9constantsES5_b
}
1 change: 1 addition & 0 deletions examples/pxScene2d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
> * [windows sdk 10.0.16299.0](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk),it is included in VS2017 with above workload and only necessary if you have issue to install with VS2017)
> * python 2.7.x , make sure python can work in cmd (setup environment variables depending on install location)
> * git for windows , make sure git can work in cmd (setup environment variables depending on install location)
> * patch utility for windows (this comes with git. setup environment variables depending on install location of patch.exe)
> * Download and install cmake for windows from https://cmake.org/download/
> * Download and install NSIS installer from http://nsis.sourceforge.net/Download
> * **Run all these commands from a Visual Studio Command Prompt**
Expand Down
13 changes: 13 additions & 0 deletions examples/pxScene2d/external/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ if [ "$(uname)" != "Darwin" ]; then

fi

if [ ! -e dukluv/build/duktape.a ]
then
cd dukluv
#patch -p0 < patches/compile_fix.patch
git apply patches/dukluv.git.patch
mkdir build
cd build
cmake ..
make
cd ..
fi


#-------- BODYMOVIN
#
# TODO: ensure that "npm" is installed ... possibly via "brew install npm" (on Mac)
Expand Down
8 changes: 8 additions & 0 deletions examples/pxScene2d/external/buildWindows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ cd ..\..\..\..\
cd libnode-v6.9.0
CALL vcbuild.bat x86 nosign
cd ..

cd dukluv
patch -p0 < patches/compile_fix.patch
mkdir build
cd build
cmake ..
cmake --build . --config Release -- /m
cd ..
44 changes: 44 additions & 0 deletions examples/pxScene2d/external/dukluv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 2.8.9)

project (dukluv)

include(duktape.cmake)
include(uv.cmake)

add_library(duv
src/duv.c
src/refs.c
src/utils.c
src/loop.c
src/req.c
src/handle.c
src/timer.c
src/stream.c
src/tcp.c
src/pipe.c
src/tty.c
src/fs.c
src/misc.c
src/utils.c
src/uv_schema.c
src/callbacks.c
src/miniz.c
)


add_library(dschema
src/schema.c
)

add_executable(dukluv src/main.c)

target_link_libraries(dukluv duv dschema duktape uv)

set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
SET (BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Directory where lib will install")
SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install")
SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")

#install(TARGETS duv dschema duktape uv DESTINATION ${LIB_INSTALL_DIR})
#install(TARGETS dukluv DESTINATION ${BIN_INSTALL_DIR})
#install(FILES src/refs.h src/duv.h lib/duktape/src-separate/duk_config.h lib/duktape/src-separate/duktape.h DESTINATION ${INCLUDE_INSTALL_DIR}/duv)
21 changes: 21 additions & 0 deletions examples/pxScene2d/external/dukluv/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Tim Caswell

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.
37 changes: 37 additions & 0 deletions examples/pxScene2d/external/dukluv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
dukluv
======

LibUV bindings for duktape JS engine

The goal of this project is to make a node.js-like environment that's ultra lean for tiny devices.

<http://dukluv.io/>

Prerequisites
-------------

Linux:

$ sudo apt-get build-essential
$ sudo apt-get install cmake

OS X (using Brew)

$ brew install cmake

Windows

- Install cmake manually
- Use cygwin or start an MSVC command prompt

Compiling
---------

$ git submodule init; git submodule update
$ mkdir build
$ cd build
$ cmake ..
$ make

The result is `./dukluv`, a standalone binary which you can add to
PATH or copy to e.g. `/usr/local/bin/`.
2 changes: 2 additions & 0 deletions examples/pxScene2d/external/dukluv/b.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

return 42;
Loading

0 comments on commit 2cb2fc5

Please sign in to comment.