From 229f181b5ea6b4153fdaa52610a9e8700cc6d9dd Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 28 Jan 2013 16:39:58 +0100 Subject: [PATCH 1/5] Added OS detection to main Makefile, and src/Makefile for LinuxMint --- src/Makefile.Mint | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/Makefile.Mint diff --git a/src/Makefile.Mint b/src/Makefile.Mint new file mode 100644 index 0000000..cf493d1 --- /dev/null +++ b/src/Makefile.Mint @@ -0,0 +1,91 @@ +ARCH := $(shell getconf LONG_BIT) + +RELEASE := $(shell lsb_release -sr) + +GROUP = sudo + +CORE= main.o base64.o global.o console.o process.o net.o fs.o buffer.o v8.o http.o md5.o popen.o linenoise.o async.o time.o + +OBJ= mysql.o memcached.o gd.o ncurses.o sem.o logfile.o sqlite3.o xhrhelper.o curl.o ssh2.o sftp.o ftp.o ftplib.o editline.o cairo.o expat.o +#OBJ= memcached.o gd.o ncurses.o sem.o logfile.o sqlite3.o xhrhelper.o curl.o ssh2.o sftp.o ftp.o ftplib.o editline.o cairo.o expat.o + +V8DIR= ./v8-read-only + +# V8LIB_64 := $(V8DIR)/out/x64.release/obj.target/tools/gyp +# V8LIB_32 := $(V8DIR)/out/ia32.release/obj.target/tools/gyp +V8LIB_64 := $(V8DIR)/out/x64.release/obj.target/tools/gyp +V8LIB_32 := $(V8DIR)/out/ia32.release/obj.target/tools/gyp +V8LIB_DIR := $(V8LIB_$(ARCH)) + +V8VERSION_64 := x64.release +V8VERSION_32 := ia32.release +V8VERSION := $(V8VERSION_$(ARCH)) + +V8= $(V8LIB_DIR)/libv8_base.a $(V8LIB_DIR)/libv8_snapshot.a $(V8LIB_DIR)/libv8.so +# V8LIBS = -L$(V8LIB_DIR) -lv8_base -lv8_snapshot +V8LIBS = -L$(V8LIB_DIR) -lv8 + +INCDIRS= -I$(V8DIR)/include -I/usr/include/mysql + +LIBDIRS= -L$(V8LIB_DIR)/ + +CFLAGS = -fexceptions -fomit-frame-pointer -fdata-sections -ffunction-sections -fno-strict-aliasing -fvisibility=hidden -Wall -W -Wno-ignored-qualifiers -Wno-unused-function -Wno-unused-parameter -Wnon-virtual-dtor -m$(ARCH) -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fno-strict-aliasing -DNEW_MEMCACHED + +%.o: %.cpp SilkJS.h + g++ $(CFLAGS) -c $(INCDIRS) -o $*.o $*.cpp + +silkjs: deps $(V8DIR) $(V8) $(CORE) $(OBJ) SilkJS.h Makefile + g++ -o silkjs $(CORE) $(OBJ) $(V8LIBS) -lmysqlclient -lmm -lgd -lncurses -lssl -lpthread -lsqlite3 -lcurl -lssh2 -lmemcached -lcairo -lexpat -ldl -Wl,-rpath=/usr/local/silkjs/src/v8,-rpath=$(V8LIB_DIR) + +deps: + sudo apt-get -y install libmm-dev libmysqlclient-dev libmemcached-dev libgd2-xpm-dev libncurses5-dev libsqlite3-dev libcurl4-openssl-dev libssh2-1-dev libcairo2-dev + +debug: CFLAGS += -g +debug: silkjs + +bootstrap: CFLAGS += -DBOOTSTRAP_SILKJS + +bootstrap: $(V8) $(CORE) SilkJS.h Makefile + g++ $(CFLAGS) -o bootstrap-silkjs $(CORE) -L$(V8LIB_DIR)/ -lv8_base -lv8_snapshot -lpthread + +perms: + sudo chgrp $(GROUP) /usr/local /usr/local/bin + sudo chmod g+rwx /usr/local /usr/local/bin + +install: silkjs perms + @rm -rf /usr/local/silkjs/builtin /usr/local/silkjs/bin /usr/local/silkjs/httpd /usr/local/silkjs/lib /usr/local/silkjs/modules /usr/local/silkjs/walkthrough /usr/local/silkjs/src + @mkdir -p /usr/local/bin /usr/local/silkjs /usr/local/silkjs/src/v8 /usr/local/silkjs/projects /usr/local/silkjs/contrib + cp -rp ../builtin ../examples ../httpd ../lib ../modules ../walkthrough /usr/local/silkjs + cp ../src/*.cpp ../src/*.h /usr/local/silkjs/src + cp -rp $(V8DIR)/include $(V8) /usr/local/silkjs/src/v8 + mv /usr/local/silkjs/examples /usr/local/silkjs/bin + chmod 755 /usr/local/silkjs/bin/* /usr/local/silkjs/httpd/main.js + cp silkjs /usr/local/silkjs/bin + ln -sf /usr/local/silkjs/bin/silkjs /usr/local/bin + ln -sf /usr/local/silkjs/httpd/main.js /usr/local/bin/httpd-silk.js + +$(V8DIR): + echo "svn checkout" +# svn checkout http://v8.googlecode.com/svn/branches/bleeding_edge/ v8-read-only + svn checkout http://v8.googlecode.com/svn/trunk/ v8-read-only + +$(V8): + # cd $(V8DIR) && svn update && make dependencies && GYP_GENERATORS=make make GYPFLAGS="-Dcomponent=shared_library -Dv8_enable_extra_checks=0" -j 4 $(V8VERSION) + cd $(V8DIR) && svn update && make dependencies && GYP_GENERATORS=make make GYPFLAGS="-Dcomponent=shared_library" -j 4 $(V8VERSION) + +update: + cd $(V8DIR) && svn update && make dependencies && GYP_GENERATORS=make make $(V8VERSION) + git pull + +clean: + rm -rf silkjs *.o + +realclean: + rm -rf silkjs *.o v8-read-only + +release: silkjs + tar czvfp ~/SilkJS.tgz silkjs examples httpd lib + +$(OBJ): SilkJS.h Makefile + +$(CORE): SilkJS.h Makefile From 06d77450b60cb79f47ee38466b1aaaf710cbcc71 Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 28 Jan 2013 16:43:32 +0100 Subject: [PATCH 2/5] Added OS detection to main Makefile --- Makefile | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index eb6a533..1a32849 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,22 @@ UNAME := $(shell uname -s) - MAKEFILE=Makefile -RELEASE = 0 ifeq ($(UNAME),Darwin) - MAKEFILE=Makefile.osx + MAKEFILE=Makefile.osx else - RELEASE := $(shell lsb_release -sr) -endif -ifeq ($(RELEASE),11) - MAKEFILE = Makefile.sles + ifneq ($(shell shtool platform | grep -i "suse"),) + MAKEFILE=Makefile.sles + endif + ifneq ($(shell shtool platform | grep -i "centos"),) + MAKEFILE=Makefile.centos + endif + ifneq ($(shell shtool platform | grep -i "linuxmint"),) + MAKEFILE=Makefile.Mint + endif + ifneq ($(shell shtool platform | grep -i "ubuntu"),) + MAKEFILE=Makefile + endif endif - all: cd src && make -f$(MAKEFILE) cp src/silkjs . From 5f7762136e0111199e4e85954c354c3bb42d776f Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 28 Jan 2013 16:53:25 +0100 Subject: [PATCH 3/5] Modified the description --- README | 16 ++++++++++++---- README.md | 14 ++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README b/README index d08dafa..84e125a 100644 --- a/README +++ b/README @@ -1,16 +1,24 @@ QUICKSTART -Currently for Mac OSX Lion x64 and Ubuntu only... +Currently for : +* Mac OSX Lion x64 +* Ubuntu 12.04 and higher +* Other Ubuntu-based distributions (including Linux Mint 12 and higher...) +Download and compile : git clone https://github.com/mschwartz/SilkJS SilkJS cd SilkJS make - + (See https://github.com/mschwartz/SilkJS/wiki/Build-Instructions for dependent libraries) -Once built: +Installation : + make install + OR + sudo make install - ./silkjs httpd/main.js +Once installed, you can launch the demo: + silkjs httpd/main.js Then point your browser at http://localhost:9090/ diff --git a/README.md b/README.md index 141a0df..b201503 100644 --- a/README.md +++ b/README.md @@ -91,15 +91,21 @@ in JavaScript. Even the CommonJS require() method is written in JavaScript. (See https://github.com/mschwartz/SilkJS/wiki/Build-Instructions for dependent libraries) -Currently for Mac OSX Lion x64 and Ubuntu only... +Currently for : +* Mac OSX Lion x64 +* Ubuntu 12.04 and higher +* Other Ubuntu-based distributions (including Linux Mint 12 and higher...) +Downloading and compilation : git clone https://github.com/mschwartz/SilkJS SilkJS cd SilkJS make + +Installation : + make install (OR "sudo make install" for Ubuntu) -Once built: - - ./silkjs httpd/main.js +Once installed, you can launch the demo: + silkjs httpd/main.js Then point your browser at http://localhost:9090/ From 2380c3f656b51fc8f56b13643447b45d5dc40883 Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 28 Jan 2013 16:54:26 +0100 Subject: [PATCH 4/5] Fix README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b201503..c34d8bb 100644 --- a/README.md +++ b/README.md @@ -97,14 +97,17 @@ Currently for : * Other Ubuntu-based distributions (including Linux Mint 12 and higher...) Downloading and compilation : + git clone https://github.com/mschwartz/SilkJS SilkJS cd SilkJS make Installation : + make install (OR "sudo make install" for Ubuntu) Once installed, you can launch the demo: + silkjs httpd/main.js Then point your browser at http://localhost:9090/ From 643a76d399312f709888df22ee8926b8035bd0b6 Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 28 Jan 2013 17:02:46 +0100 Subject: [PATCH 5/5] Added support for POST formated in all character-based MIME types --- httpd/request.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/httpd/request.js b/httpd/request.js index 8c2e2f3..a19f585 100644 --- a/httpd/request.js +++ b/httpd/request.js @@ -136,12 +136,11 @@ req = (function() { }); } else { + req.data = data; req.data.post = post; } } } - req.data = data; - return true; }, getHeader: function(key) {