This article gives basic overview of writing a .bep file for haikuporter. Prior to reading it, you are advised to read BepFile article. This entry assumes that you have read and understood it. == BepFile name == BepFile should be named as "Program name"-"Program version".bep format, e.g. `transmission-2.75.bep`, `curl-7.28.1.bep`. Also some additional information can be added to the filename. An example of that case is `libsdl-2.0-hg-cmake.bep` file. From it's name we can notice that version to be built with cmake is going to be downloaded from sdl's mercurial server. == How HaikuPorter works == HaikuPorter works as follows: * Process the arguments passed * Search for the specified package in ports tree * Read data from BepFile * If port is not stable, then warn the user * Print the `MESSAGE` string from the bep * Clean the work directory (it is the directory where the downloaded package is unarchived, all the patching and compilation is being done there) (*) * Warn user about the port dependencies * Download the sources * Check that downloaded file's checksum matches with the one specified in the `CHECKSUM_MD5` field of the BepFile (if it is not empty) * Unpack sources to the work directory * Patch sources (*) * Build port (*) * Install port (*) * Make redistributable package (*) * Macke patched archive (*) * Test the port (*) Items marked with (*) are controlled by the commandline arguments, default behaviour is to patch and build. == Writing BepFile == 0. Read porting Guidelines 1. Download the sources of program you want to build 2. Unpack them 3. Try to build them a. If building fails, find the reason why it does and what files have to be edited in order to be able to be built on Haiku * If you cannot solve the problem, create a ticket at the [http://ports.haiku-files.org trac] and add the refernece to it from the PortLog using TracLinks b. [#Patchfile Make a patch] c. If some additional packages are needed prior to building this program, specify them in the `DEPEND` section 6. Try installing the package a. If it fails, find the reason why and fix it b. [#Patchfile Make a patch] 7. Write `BUILD` section of your BepFile reflecting the steps you have made * Don't forget that by default the `BUILD` script is launched from the work directory, so you possibly need to cd in the beginning 8. Write `INSTALL` section * When adding paths to the BepFile, don't hardcode them. Use [wiki:FindDirectory finddir] instead 9. If program has tests, write `TEST` section 10. Add miscellaneous info * `DESCRIPTION`, `COPYRIGHT`, `LICENSE` sections can be found on the program's website * To calculate `CHECKSUM_MD5` use md5sum utility * If gcc4 or gcc2 is mandatory needed in order to compile this program, add warning in the `MESSAGE` section ([http://ports.haiku-files.org/browser//haikuports/trunk/net-p2p/transmission/transmission-2.75.bep example]) * You may add multiple links in the `SRC_URI` variable. HaikuPorter will try all of them in the order they are specified, until the working one is found ([http://ports.haiku-files.org/browser//haikuports/trunk/dev-lang/fpc/fpc-2.6.0.bep example]) 11. Open ticket at the [http://ports.haiku-files.org trac] if it is not created yet 12. Add your bep, patch and license files to the ticket == License file == If project you are porting has license that hasn't been added yet to the haiku's default list of licenses, make a text file with the name of this license containing it's text and add it to the license folder in BepFile's dir ([http://ports.haiku-files.org/browser//haikuports/trunk/app-misc/figlet example]). == Patch file == Patch file should be named same as the .bep, except that it has to have .patch extension and be located in the patch directory ([http://ports.haiku-files.org/browser//haikuports/trunk/games-action/bzflag example]). For more info about creating patch files consult CreatePatch.