AppWeb
integrates with many other packages such as PHP, OpenSSL, MatrixSSL,
uClibc and uClinux and more. Sometimes, you may have a requirement to
rebuild one of these packages to add or remove features. This document
describes the build process that Mbedthis uses to build these packages.
NOTE: we cannot support the building of these other packages. That is
your responsibility and the responsibility of the various groups and
vendors who provide these packages.
All these build notes apply to the current AppWeb development release.
The steps for the stable release may need some adapting particularly if
using the 1.0.X releases.
Building and Integrating With:
MatrixSSL
PeerSec provide the MatrixSSL product which can be downloaded from
www.matrixssl.org. Consult their build instructions and make using the standard steps.
PHP
Building PHP varies depending on the target operating system The notes below describe steps for building PHP on Linux and
Windows.
Building PHP 5 on Linux
PHP has an extensive set of configuration options. Many of these
require additional 3rd party packages. When building PHP for the binary
distribution, we tried to balance choosing a set of options that
requires minimal 3rd party packages and yet offers good functionality.
This is the configuration options used when building PHP for the AppWeb
binary distribution:
./configure \
--cache-file=config.cache \
--disable-debug \
--disable-rpath \
--enable-bcmath \
--enable-calendar \
--enable-maintainer-zts \
--enable-embed=shared \
--enable-force-cgi-redirect \
--enable-ftp \
--enable-inline-optimization \
--enable-magic-quotes \
--enable-memory-limit \
--enable-pic \
--enable-safe-mode \
--enable-sockets \
--enable-track-vars \
--enable-trans-sid \
--enable-wddx \
--sysconfdir=/etc/appWeb \
--with-exec-dir=/etc/appWeb/exec \
--with-db \
--with-regex=system \
--with-pear \
--with-xml \
--with-xmlrpc \
--with-zlib
After configuring PHP, build it with:
make
Note that not specifying these options does
not mean that PHP will omit the functionality. To determine what
functions PHP has built, use the phpinfo(); procedure in a PHP web page
once appWeb is running. It will fully document the actual PHP
configuration.
After you have built PHP, you must reference the PHP installation
directory in your AppWeb configuration. You can set this via the
configure command. You need to define the base directory and any
libraries that will be needed when AppWeb links with the PHP library.
The php directory MUST be a relative path to the top level AppWeb source directory. Depending on your PHP options, the list of libraries may vary.
./configure --with-php5 --with-php5-dir=../../php-5.0.0 \
--with-php5-libs="php5 crypt resolv db z"
Building PHP 5 on Windows
The
Windows PHP build system uses on a JavaScript configure script and
nmake. The README.WIN32-BUILD-SYSTEM documents the required steps to
build PHP from source and the required environment. The steps below
assume you have read this file.
Before building, you will need to download two packages:
bindlib_w32 [http://www.php.net/extra/bindlib_w32.zip]
win32build [http://www.php.net/extra/win32build.zip]
You should extract these files into a directory called php_build at the
same level as the PHP5 source. You may need to rebuild the bind
library,
resolv.lib. You should build this as a multithreaded DLL. The resulting DLL should be copied to php_build/lib.
The next step is to run buildconf.bat. This will create configure.js,
which can then be run similarly to the LINUX configure command. Use
configure --help to display the possible options.
buildconf.bat
cscript /nologo configure.js \
--enable-embed=shared \
--without-gd \
--without-dom \
--without-libxml
To build, type:
nmake
mkdir libs
copy Release_TS libs
rename libs\php4ts.lib libs\libphp4.lib
After you have built PHP, you must reference the PHP installation
directory in your AppWeb configuration. You can set this via the
configure
command. You need to define the base directory and any libraries that
will be needed when AppWeb links with the PHP library. The php
directory MUST be a relative path to the top level AppWeb source directory. Depending on
your PHP options, the list of libraries may vary.
./configure --with-php5 --with-php5-dir=../../php/php-5.0.0 \
--with-php5-libs="php5"
OpenSSL
These instructions are suitable for building OpenSSL version 0.9.7d.
Building OpenSSL 0.9.7d on Linux for X886
Use the following commands to build OpenSSL natively on Linux:
./config
make
To build single threaded, use the "--no-threads" option. If you wish to also build OpenSSL as shared libraries, use:
make build-shared
After you have built OpenSSL you must reference the OpenSSL installation
directory in your AppWeb configuration. You can set this via the
configure command. You need to define the base directory and any
libraries that will be needed when AppWeb links with the OpenSSL libraries.
The OpenSSL directory
MUST be a relative path to the top level AppWeb source directory.
./configure --with-openssl --with-openssl-dir=../../openssl-0.9.7d \
--with-openssl-libs="ssl crypto"
Building OpenSSL 0.9.7d on Windows for X886
The Windows OpenSSL build system uses Perl and nmake. The following
commands will build the required shared libraries (DLLs) for AppWeb to
use OpenSSL.
perl Configure VC-WIN32
cmd /c ms\\do_masm
rm -f libcrypto.lib libeay32.dll libssl.lib ssleay32.dll
rm -f out32dll/*.exe out32dll/*.dll out32dll/*.lib
rm -f tmp32dll/*
perl Configure VC-WIN32
cmd /c ms\\do_masm.bat
nmake -f ms/ntdll.mak
mv out32dll/libeay32.lib libcrypto.lib
mv out32dll/ssleay32.lib libssl.lib
mv out32dll/*.dll .
cp -r inc32/openssl include
After you have built OpenSSL you must reference the OpenSSL installation
directory in your AppWeb configuration. You can set this via the
configure command. You need to define the base directory and any
libraries that will be needed when AppWeb links with the OpenSSL libraries.
The OpenSSL directory
MUST be a relative path to the top level AppWeb source directory.
./configure --with-openssl --with-openssl-dir=../../openssl-0.9.7d \
--with-openssl-libs="ssl crypto"
uClibc
To get the smallest executable possible, there are several alternatives to the standard libc
C/C++ library. One of the leading tiny libcs on Linux is uClibc. For general information go to:
www.uclibc.org.
To link with uClibc, you must first create a compiler toolchain that
will link AppWeb with the uClibc library. This is not always an easy
process. The easiest way appears to be to get one of the pre built root
file systems that contain the complete cross compiler and uClibc
library. You then mount this file system, make it your root file system
and copy the AppWeb source into it and built it there.
AppWeb supplies a uClibc default configuration file in the
conf/appWeb/uclibc.defaults file. Use this as your base via the
following configure commands.
./configure --defaults uclibc
Next, you should specify your target host that will run AppWeb. For example:
./configure --host arm-linux
The format for the argument to the host switch is:
cpu-vendor-os
Next you need to supply the Cross compiler settings. These are
passed to configure via environment variables. For example, the
following script configures AppWeb to build using the arm-linux cross
compiler (supporting uclibc) that is installed under /usr/local.
DIR=/usr/local ; \
export CC=arm-linux-uclibc-gcc ; \
GCC_DIR=`$$CC -print-libgcc-file-name 2>&1 | sed -e 's/\/libgcc.a//'` ; \
AR=arm-linux-uclibc-ar \
LD=arm-linux-uclibc-ld \
RANLIB=arm-linux-uclibc-ranlib \
IFLAGS="-I$$DIR/arm-linux-uclibc/include -I$$GCC_DIR/include" \
LDFLAGS="-L$$GCC_DIR/lib -L$$DIR/arm-linux-uclibc/lib \
-Wl,--dynamic-linker -Wl,$$DIR/i386-linux/lib/ld-uClibc.so.0" \
./configure
See Building AppWeb from Source for full details on all the available configure switches.
uClinux
A patch for uClinux has been submitted and hopefully will soon be included in the default uClinux distributions from
SnapGear and the
uClinux project. Until then, a
patch
is available to update uClinux with AppWeb support. We have used the
SnapGear distribution and have followed the included instructions.
Once you have uClinux installed, you should extract the appWeb source
code into the user/appWeb directory. The following commands are a
suggestion:
cd UCLINUX_DIR/user
tar xvfz appWeb-src-VERSION.tar.gz
mv appWeb-VERSION appWeb
First you need to run the configuration utility. This can be either X based or curses based. To run the X utility:
make xconfig
After selecting your embedded board vendor, go into the
Kernel/Library/Defaults Selection and Toggle Customize Vendor/User
Settings to be
"y". After you
then click Main Menu, then Save and Exit, a new dialog will be
displayed with the Application Configuration options. Select Network
Applications and you should see AppWeb configuration options toward the
top of the screen. Select
"y" for the appWeb option and select "y" for any other AppWeb options you require. The Help button will explain each option.
After configuring uClinux, you should type:
make dep
make
After the initial build, appWeb remembers all the cross-compiler
settings and you can recompile directly in the appWeb directory. You
can also customize your appWeb configuration and then rebuild. For
example: to enable the Embedded Gateway Interface:
cd user/appWeb
./configure --with-egi
cd ../..
make user_only