wiki:en/sources
developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
Last modified 16 months ago Last modified on 11/24/15 21:05:57

Working with jelix sources

/!\ Warning! these instructions are only valid for jelix 1.6.x branch and lower''' Jelix 1.7.x and master branches are now composer packages, no build required.

These are important informations for those who want to contribute or to retrieve sources directly from the repository.

Principles

Sources stored in the GIT repository are not ready to be performed by PHP. There are some preprocessing instructions in some php files, so, sources should be parsed by a preprocessor in order to be used by PHP. This preprocessing instruction allow to build packages for some specific PHP configurations, or some specific jelix editions.

So, here is the process :

  1. get sources of jelix from the git repository (git clone)
  2. create an ini file which contains options for the builder
  3. launch the build/buildjelix.php script by giving the ini file, then you have in an other directory the php files of jelix
  4. copy this files into your application, or package them etc..

For a contributeur of course he will do :

  1. gets sources of jelix from the repository
  2. makes modification in sources (bug fix, new feature..)
  3. creates an ini file which contains options for the builder
  4. launches the build/buildjelix.php script by giving the ini file
  5. in the target directory, he have the php files of jelix : he can test jelix.
  6. when it works well, he send a patch or commit his modification.

Getting sources

We use Git to store sources of jelix and to follow the history of modifications. So you have to install a Git client on your machine. Then you can access to the repository by giving the address of the repository to git commands. See instructions on Github.com.

In the past, we used subversion (January 2006 - June 2009), then Mercurial on our own server (June 2009 - March 2010), and on Bitbucket (March 2010 - August 2011). The official repositories of Jelix are now on github since August 2011.

Directories

The master branch contains latest improvements for the next major release, and branches named jelix-x.y are branches of stable releases. In these branches, we only fix bugs. No major new features are commited in them.

The directories you find are:

  • build: the scripts to build jelix sources
  • ext: the extension for PHP (in C language), for the gold edition of Jelix
  • lib: all the files of jelix itself
  • temp: temporary directory for the testapp application
  • testapp: an application which contains all unit tests, and some examples

How to build

After you retrieve the sources, you need to "build" jelix. There is a script, build/buildjelix.php, which do this build. this is like a "makefile", and it takes a ini file name as a first parameter. This ini file contains options for the build. You have some examples of this files into build/config/.

Building

Before doing modifications, you should prepare an working environment: a directory where the built files of jelix will be stored. In this "target" directory, you could use jelix in your applications. Example:

Your local copy of the repository could be at:

   /home/laurent/projects/jelix/src/

And the target directory where you will have usable files:

   /home/laurent/projects/jelix/tests/

Create a ini file mybuild.ini. You can copy from one of those which are in build/config, jelix-test.ini for example. It will contain this parameters:

MAIN_TARGET_PATH = /home/laurent/projects/jelix/tests/
EDITION_NAME = 
PHP_VERSION_TARGET =

ENABLE_PHP_FILTER =
ENABLE_PHP_JSON =
ENABLE_PHP_XMLRPC =
ENABLE_PHP_JELIX =
WITH_BYTECODE_CACHE = auto

ENABLE_DEVELOPER = 1

STRIP_COMMENT = 
ENABLE_OPTIMIZED_SOURCE = 

PACKAGE_TAR_GZ = 
PACKAGE_ZIP = 

TARGET_REPOSITORY = 

You can have a full list of availabled parameters by doing:

  php build/buildjelix.php -h

To generate the sources:

  php build/buildjelix.php mybuild.ini

If you want to build the testapp application, use an other provided script, build/buildapp.php with an other ini file, (see build/config/testapp-test.ini)

  php build/buildapp.php mytestapp.ini

Note: Of course, you should run the build after each modification in the sources of jelix, on order to test this changes.

Generating a package

The principle is the same as previous. You just have to indicate a directory where the packages will be generated, and you have to activate the flags (PACKAGE_TAR_GZ and/or PACKAGE_ZIP) in your ini file (mypackages.ini for example).

MAIN_TARGET_PATH = /home/laurent/projects/jelix/dist/
EDITION_NAME = 
PHP_VERSION_TARGET =

ENABLE_PHP_FILTER =
ENABLE_PHP_JSON =
ENABLE_PHP_XMLRPC =
ENABLE_PHP_JELIX =
WITH_BYTECODE_CACHE = auto

ENABLE_DEVELOPER = 1
STRIP_COMMENT = 
ENABLE_OPTIMIZED_SOURCE = 

PACKAGE_TAR_GZ = 1
PACKAGE_ZIP = 1

And then:

  php build/buildjelix.php mypackages.ini