Writing BepFile
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
- Read porting Guidelines
- Download the sources of program you want to build
- Unpack them
- Try to build them
- 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
- Make a patch
- If some additional packages are needed prior to building this program, specify them in the DEPEND section
- Try installing the package
- If it fails, find the reason why and fix it
- Make a patch
- 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
- Write INSTALL section
- When adding paths to the BepFile, don't hardcode them. Use finddir instead
- If program has tests, write TEST section
- 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 (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 (example)
- Open ticket at the trac if it is not created yet
- 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 (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 (example). For more info about creating patch files consult CreatePatch.