Building on linux

Jefferson González edited this page Jun 15, 2014 · 21 revisions

Automatic building

Since v3.0.0.1 of wxPHP the configure script can automatically download wxWidgets, compile and link to it. So if you already have the required build environment the following steps would do:

cd wxphp.git
phpize
./configure
make
sudo make install

If you want to link an existing build of wxWidgets on your system or need to know the build dependencies as some more details, please check the steps below.


Install C/C++ compilers and autoconf tools

Ubuntu and Debian based distros:

sudo apt-get install build-essential

Compile wxWidgets library and development packages

wxWebView, a web browser like control, was enabled on the wrapper, in order to compile wxWidgets with wxWebView support you will need to have libwebkitgtk development files and library. On ubuntu and debian based distros this could be done with:

sudo apt-get install libwebkitgtk-dev

Also wxMediaCtrl is binded so you need to install gconf and gstreamer development files on linux platforms, besides that the distro jpeg distribution is recommended instead of build-in one:

sudo apt-get install libjpeg-dev libgconf2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

For fedora users all the dependencies should be resolved with the following:

yum install libjpeg-devel GConf2-devel webkitgtk-devel gstreamer-devel gstreamer-plugins-base-devel

Download wxWidgets tar file and uncompress it on your directory of choice or svn checkout with:

*NOTE: Remember to use tar.bz2 when downloading sources, using the zip file results on compilation errors under linux, since file line endings are formatted for windows.

svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/tags/WX_3_0_0 wxWidgets

NOTE: Currently we have tested with wxWidgets 3.0.0 version.

On the console change to the wxWidgets directory and:

./configure --prefix=/opt/wxWidgets
make
sudo make install

Install php5 development packages

Ubuntu and Debian based distros:

apt-get install php5-dev

Configure and build the extension

cd wxphp
phpize
./configure --with-wxwidgets=/opt/wxWidgets
make

Installing the extension

After make a file named wxwidgets.so will be generated on the modules directory. You can reduce the file size by stripping debugging symbols by using the strip utility:

strip modules/wxwidgets.so

Then you can copy the resulting wxwidgets.so file on the modules directory to the php extensions directory. PHP extensions directory is usually found on /usr/lib/php5/ On Ubuntu 10.04 - 12.04 this directory is /usr/lib/php5/20090626/

To automate the installation process just use:

sudo make install

If you want the wxWidget extension to be automatically loaded, add the following lines to your php.ini:

; load php wxwidgets module
extension=wxwidgets.so

If not, then enable dynamic loading on your php.ini usually on:

/etc/php5/cli/php.ini

modify enable_dl = off to enable_dl = on

Creating a DEB Package

Before creating a deb package you need the following dependencies to be satisfied:

  • php5-dev
  • git
  • libwebkitgtk-dev
  • libgconf2-dev
  • libgstreamer0.10-dev

To build the package you need the dpkg development tools. You can install it by typing:

sudo apt-get install dpkg-dev

On the root wxphp source tree execute:

dpkg-buildpackage

That should take care of building and creating a deb package. We aren't using upstream wxWidgets packages since they are sometimes compiled with less features and there aren't 3.0.0 packages of wxWidgets available on ubuntu or debian repositories.

Creating an ArchLinux Package.

A PKGBUILD file was submitted to the archlinux user repository which you can install with a package manager that supports aur like yaourt. Installing with yaourt would be something like this:

yaourt -S php-wxwidgets-git

You could also download the PKGBUILD from this wxPHP github repo and place it on a directory like /home/youruser/wxphp, leaving you with the simple structure as follows:

/home/youruser/wxphp
    PKGBUILD

Once you have the empty wxphp directory with the PKGBUILD on it do as follows:

cd wxphp
makepkg
sudo pacman -U php-wxwidgets-git-version.xz.pkg

Note: The PKGBUILD will take care of downloading wxWidgets and wxPHP source files so you don't have to download anything else.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.