Creating a HPKG package for your application can be done via the haikuporter tool.
However in case you don't want to use haikuporter, the other alternative is to use the "package" command.
Let's review how to do that. Creating manually a package can be useful in case you only need to distribute a single executable.
Let's suppose you have created the SimpleOpenGLCube program, as detailed in the "Setup a C++ environment" article.
Now you would like to distribute it in HPKG format. How to do so ?
First create a folder with the convention <applicationname>-<version>-<revision> and edit the file ".PackageInfo" in Pe editor :
mkdir simpleopenglcube-1.0.0-1
lpe .PackageInfo
Copy/paste the below content in the ".PackageInfo" :
name simpleopenglcube
version 1.0.0-1
architecture x86_64
summary "This is a sample SimpleOpenGLCube package file"
description "Get a sneak peek at the next generation SimpleOpenGLCube"
packager "DigitalBox <digitalbox98@gmail.com>"
vendor "Haiku Project"
licenses {
"MIT"
}
copyrights {
"Copyright (C) 2023-2024 by DigitalBox <digitalbox98@gamil.com>"
}
provides {
simpleopenglcube = 1.0.0-1
app:simpleopenglcube = 128.1.0
}
requires {
haiku >= r1~beta5_hrev57937_5-1
lib:libgl
lib:libglu
}
urls {
"http://haikuinsider.wordpress.com/"
}
As you can see, this file details the program name, version, architecture, summary and description.
An important point is the "provides" section indicating the "simpleopenglcube" application will be provided once the package is installed.
The "requires" part is also important in case of dependencies of your program with other libraries.
For this program, two libraries are required : libgl and libglu.
It will be used during the package's installation, and if one of the library is not yet installed, it will alert you about the installation needed for additional libraries :
Ok the ".PackageInfo" file is now ready! Create the "apps" folder and copy your application's binary inside this directory :
Then create the "data/deskbar/menu/Applications" folder as below:
Go into that directory, and create a symbolic link to the application's binary:
cd data/deskbar/menu/Applications
ln -s ../../../../apps/simpleopenglcube ./SimpleOpenGLCube
The below symbolic link should now be visible :
This "SimpleOpenGLCube" will be the shortcut of your application in the deskbar applications menu.
Once the preparation step is completed, the creation of the package is now quite straightforward.
Go into the top folder containing the "simpleopenglcube-1.0.0-1" directory, and type in a Terminal :
package create -C simpleopenglcube-1.0.0-1 simpleopenglcube-1.0.0-1_x86_64.hpkg
Your package is now created :) Open a new window in the Tracker :
open .
And double click on the package :
If you check the contents, there are two things in addition to the PackageInfo :
Proceed with the installation :
Now check the entry of the program in the "Applications" and launch it :
It's working perfectly !
Congratulations, you have made your first package on Haiku.
If you want to know more on packaging on Haiku, you can display the help of the "package" command :
There's a nice "extract" feature, which can be used to explore the structure and the content of existing HPKG packages for learning purpose.
You can also check the Building Packages page on the Haiku internals documentation website.