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 Embedthis
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. Depending on your PHP options, the list of
libraries may vary.
./configure --with-php5=loadable --with-php5-dir=/usr/local/php5 --with-php5-libpath=/usr/local/php5/libs \
--with-php5-libs="php5 resolv db z" --with-php5-iflags="-I/usr/local/php5 -I/usr/local/php5/main \
-I/usr/local/php5/Zend -I/usr/local/php5/TSRM"
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
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.
./configure --with-php5=loadable --with-php5-dir=/php5 --with-php5-libpath=/php5/libs/release_ts \
--with-php5-libs="php5ts" --with-php5-iflags="-I/php5 -Iphp5/main \
-I/php5/Zend -I/php5/TSRM"
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-libpath=/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-libpath=/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.
A typical uclibc configure session might look like this: 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