diff --git a/website/guide/gettingstarted.html b/website/guide/gettingstarted.html index f7328660..b3604b67 100644 --- a/website/guide/gettingstarted.html +++ b/website/guide/gettingstarted.html @@ -72,16 +72,38 @@ $ ./duk fib.js

Integrating Duktape into your program

The command line tool is simply an example of a program which embeds -Duktape. Embedding Duktape into your program is very simple: just add -duktape.c, duktape.h, and duk_config.h -to your build, and call the Duktape API from elsewhere in your program.

+Duktape. Embedding Duktape into your program is very simple:

+ + + +

The Duktape distributable (duktape-N.N.N.tar.xz) src/ directory +contains preconfigured header and source files for the Duktape default configuration +which can usually be used as is. If needed, the configuration tool allows you to customize +Duktape options, such as optimizing Duktape for low memory targets and +enable/disable features. See Compiling and +Configuring Duktape for build +for more details and examples.

The distributable contains a very simple example program, hello.c, -which illustrates this process. Compile the test program e.g. as (see -Compiling for compiler option suggestions):

+which illustrates this process. Compile the test program with the preconfigured +Duktape header and source files e.g. as follows:

+
+$ cd /tmp/duktape-<version>/
+$ gcc -std=c99 -o hello -Isrc src/duktape.c examples/hello/hello.c -lm
+
+ +

To customize Duktape configuration use configure.py:

 $ cd /tmp/duktape-<version>/
-$ gcc -std=c99 -o hello -Isrc/ src/duktape.c examples/hello/hello.c -lm
+# Here we disable Ecmascript 6 Proxy object support
+$ python2 tools/configure.py --output-directory duktape-src -UDUK_USE_ES6_PROXY
+$ gcc -std=c99 -o hello -Iduktape-src duktape-src/duktape.c examples/hello/hello.c -lm
 

The test program creates a Duktape context and uses it to run some diff --git a/website/index/index.html b/website/index/index.html index d88840a3..4c4507b6 100644 --- a/website/index/index.html +++ b/website/index/index.html @@ -117,9 +117,23 @@ be used. The distributable contains an example Makefile for reference. In the simplest case:

-$ gcc -std=c99 -o test test.c duktape.c -lm
+$ gcc -std=c99 -otest test.c duktape.c -lm
 $ ./test
-1+2=3
+1+2=3
+
+ +

To customize Duktape configuration, +here to disable Ecmascript 6 Proxy object support:

+ +
+$ python2 duktape-2.0.0/tools/configure.py --output-directory src-duktape \
+      -UDUK_USE_ES6_PROXY
+$ ls src-duktape/
+duk_config.h  duk_source_meta.json  duktape.c  duktape.h
+$ gcc -std=c99 -otest -Isrc-duktape \
+      test.c src-duktape/duktape.c -lm
+$ ./test
+1+2=3
 

2 Initialize a context

diff --git a/website/style-index.css b/website/style-index.css index 781ad264..421931d8 100644 --- a/website/style-index.css +++ b/website/style-index.css @@ -71,3 +71,6 @@ font-size: 16pt; } +.index-shell-output { + color: #555599; +}