Appweb當前的最新版本是4.1.0 。當時想移植appweb的時候是想移植這個版本的,但發(fā)現(xiàn)網(wǎng)上所有的移植經(jīng)驗都是基于3.x或者2.x的,自己對比過各個版本,發(fā)現(xiàn)4.0.0之后appweb確實改動非常大,代碼的目錄都不一樣了,于是先把3.3.4的版本移植好了,現(xiàn)在回過頭來移植4.1.0這個版本,據(jù)說4.X是appweb的一個新的里程碑版本,所以想體驗一下。
源碼下載: http://appwebserver.org/software/appweb-4.1.0-0-src.tgz
ejscript 源碼下載: http://ejscript.org/downloads/ejs/download.ejs
至于為什么要下載ejscript源碼,得先看下appweb官方提供的building說明: (因為4.0之后網(wǎng)上沒有移植的例子,所以這個文檔很重要,得好好看下)
http://appwebserver.org/products/appweb/doc/guide/appweb/source/building.html
還有這篇文章,詳細介紹了bit這個工具:
http://ejscript.org/products/ejs/doc/guide/ejs/users/bit.html
上面的文檔說明了appweb4的編譯方法:
Appweb supports several methods of building from source:
1.Building via the Bit (Build It) tool
2.Building via make (or nmake on Windows)
3.Building via an IDE such as Visual Studio or Xcode
Building with Bit is the most flexible and offers the most control. It requires installing the Ejscript Product which includes the bit tool.
看來,用bit配置編譯是最好的方法,而且文中提到
The bit tool is used to configure and to build Appweb. Bit is part of the Ejscript JavaScript environment.
就是說,編譯Appweb需要用到bit這個工具,而bit是Ejscript的一部分,是從Ejscript里編譯出來的,所以第一步得先編譯Ejscript得到bit。
編譯Ejscript以及安裝bit的步驟:
$ tar zxvf ejs-2.0.0-0-src.tgz
$ cd ejs-2.0.0-0
$ make
$ ./linux-x86-debug/bin/bit configure build
$ sudo bit install
說明:make后,在ejs-2.0.0-0目錄下會生成一個linux-x86-debug的文件夾,里面包含了編譯所得的執(zhí)行文件,庫文件,頭文件和幫助文件等。在該目錄下的bin目錄里就已經(jīng)生成了bit工具。最后sduo install后,在linux-x86-debug/pkg/bin/ejs-2.0.0-0/目錄下有個install的腳本,用sudo執(zhí)行它,然后就把bit裝到系統(tǒng)目錄下了。
下面來編譯appweb,步驟如下
$ tar zxvf appweb-4.1.0-0-src.tgz
$ cd appweb-4.1.0
$ ./configure --platform linux-x86 --profile release
$ bit
$ sudo bit install
執(zhí)行完上面的操作后,在 /appweb-4.1.0/linux-x86-release/pkg/bin/appweb-4.1.0-0 目錄下有個install文件,用 sduo install 安裝后,appweb就被裝到PC上面了。
啟動appweb:
$ sudo /etc/init.d/appweb start
執(zhí)行上面命令后正常會提示appweb OK,說明已經(jīng)啟動,然后可以再瀏覽器上輸入IP登陸到服務器上。
其實我最終的目的是想把appweb 4.1.0移植到S3C6410開發(fā)板上,所以還得通過交叉編譯。
appweb3所有的配置都是通過configure來配置的,非常方便和簡單。但appweb4就完全不一樣了,appweb4目錄下的configure其實就是bit,因為通過 ./configure --help 和 bit --help查看配置參數(shù),兩者是一樣的。
先把CC,LD等修改為當前的交叉編譯工具鏈,然后在配置的時候修改下平臺為--platform linux-arm ,嘗試編譯,出錯!最后嘗試了修改其他配置參數(shù)都沒成功。發(fā)現(xiàn)這個版本可配種站的參數(shù)很有限,不像appweb3 。
經(jīng)過多種方法嘗試都沒成功,只有先放下了,畢竟已經(jīng)在ARM板上移植好3.3.4這個版本了,接下來先好好學習下appweb,以及繼續(xù)加人ssl,php的移植先,以后有時間在繼續(xù)研究下appweb4或更高版本的了。
在這次移植appweb4的過程中發(fā)現(xiàn)這個版本可以支持matrixssl-3-3-1了,但是對于舊版的matrixssl-1-8-8卻又不支持。這個跟appweb3相反,appweb3只能支持matrixssl-1-8-8(或者說低版本的matrixssl吧)。