Haiku packaging workshop Case studies : ● Data package ● Espeak ● SuperTux Workshop by:
François Revol
[email protected]
Prerequisites ●
Notions ●
Shell usage
●
Basic git / SVN
●
Basic C / C++
●
VirtualBox
●
Network connection
Workshop VM setup ●
VirtualBox appliance ●
●
Import RMLL2014_HaikuPackageWorkshop.ova
Run the "QuickConfig.sh" script on the desktop ●
Regenerates SSH keys
●
Sets language/keymap
●
Sets the default $EDITOR in ~/.profile
●
Edits git and haikuporter settings for user and email
What's in there? ●
~/sources/ (already checked-out) The Haiku source tree, just in case
●
haiku/
●
haikuporter/ The tool to build packages from recipes –
Already available in PATH
●
haikuports/ Ports tree (all the recipes and patches)
●
espeak/
Espeak subversion tree
Case 1 – Simple data package ●
● ●
●
●
Using the low-level package tool Let's package the RMLL logos mkdir rmll_logos20141any ●
Version: 2014 ; Package revision: 1
●
any = not architecture dependent
●
This will be the package root, that is, our /system
mkdir p data/artwork/rmll cp ~/Desktop/RMLL\ logos/* data/artwork/rmll/
Simple data package – info file ●
Now we need a manifest for the package tool ●
.PackageInfo file at package root (hint) name rmll_logos version 20141 architecture any summary "Some logos from RMLL/LSM" description "Here are some logos from the Libre Software Meeting / RMLL" packager "John Doe " vendor "RMLL"
Simple data package – info file ●
Some more fields required… ●
licenses {"CC BYSA 3.0"}
●
copyrights {"Copyright (C) 2014 by RMLL"}
●
provides {rmll_logos = 20141}
●
● ●
requires {haiku >= r1~alpha4_pm_hrev462131} urls {"https://2014.rmll.info/"} sourceurls {"Logos from "}
Simple data package – Try 1… ●
package create C rmll_logos20141any rmll_logos20141any.hpkg ●
License 'CC BYSA 3.0' isn't contained in package!
●
License isn't yet known, we must add it
●
Plain text file is here – –
mkdir data/licenses wget http://creativecommons.org/…/legalcode.txt O data/licenses/'CC BYSA 3.0'
Simple data package – Try 2… ●
package create C rmll_logos20141any rmll_logos20141any.hpkg ●
●
package list rmll_logos20141any.hpkg ●
●
Success \o/ Package-attributes (the manifest) + the files
cp rmll_logos20141any.hpkg /system/packages/
●
ls /system/data/artwork/rmll/ … \o/
●
HaikuDepot … "rmll" … here it is!
Case 2 – Espeak ●
Text-to-speech engine ●
●
Command-line application ●
●
http://espeak.sourceforge.net/ Quick port : without live audio output
We'll use the haikuporter tool
Espeak: how does it build? ●
Do we have it yet? ●
●
Checkout ●
●
ls haikuports/*/*espeak* → let's fix this! svn co https://svn.code.sf.net/p/espeak/code/trunk
How does it compile? ●
README ? INSTALL ? Online README not useful…
●
There is a Makefile… so let's try to make… –
… ld: cannot find -lstdc++
Espeak: fixing the build… ●
Missing libstdc++ ●
Due to binary-compatibility (BeOS) gcc 2.95 is default –
● ●
●
And the std C++ library for gcc2 is -lstdc++.r4
Patch Makefile (move hardcoded -lstdc++ to a variable) make LIB_STDCPP=lstdc++.r4
ld: cannot find lportaudio ●
Linux only, plus we don't want live audio output anyway –
make LIB_STDCPP=lstdc++.r4 AUDIO=wave
Espeak: fixing the build… ●
ld: cannot find lpthread ● ● ●
●
Patch Makefile (move hardcoded -lpthread to a variable) make LIB_STDCPP=lstdc++.r4 AUDIO=wave LIB_PTHREAD=
Invalid option `fvisibility=hidden' ●
●
Pthread support is built into libroot (linked to by default)
Patch Makefile again for gcc2…
make LIB_STDCPP=lstdc++.r4 AUDIO=wave LIB_PTHREAD= VISIBILITY_FLAG= → \o/
Espeak: trying to install… ●
Outside packagefs (which is read-only) ●
{/system,/boot/home/config}/nonpackaged/
●
Override default install places –
make … ● ●
●
PREFIX=`finddir B_USER_NONPACKAGED_DIRECTORY` DATADIR=`finddir B_USER_NONPACKAGED_DATA_DIRECTORY`/espeakdata clean install
Espeak: trying to run… ●
espeak ●
Can't read data file: ' … /espeak data/phontab' /o\
●
It seems the subversion tree misses some data …
●
Clean up the files (no make uninstall …)
●
We'll make the recipe use the release source tarball instead.
Espeak: let's make a recipe! ●
Where to put it? ●
We use gentoo's ebuild naming convention –
●
Copy the recipe template ●
cd haikuports;
●
mkdir p appaccessibility/espeak
●
●
http://packages.gentoo.org/ … app-accessibility/espeak
cp ../haikuporter/generic/generic_haiku_app 1.2.3.recipe appaccessibility/espeak/espeak 1.48.04.recipe
It's a gentoo ebuild-like shell script. Let's edit this!
Espeak: let's make a recipe! ●
●
SUMMARY="Speech synthesizer for English and other languages" DESCRIPTION=" eSpeak is a compact open source software speech synthesizer \ ← note line-continuation. for English and other languages, for Linux and Windows. …"
●
HOMEPAGE="http://espeak.sourceforge.net"
●
Self-explanatory for now … documentation here.
Espeak: let's make a recipe! ●
SRC_URI="http://sf.net/…/…1.48.….zip" ●
Can also be : –
git[+http[s]]://…#revision svn[+http[s]]://…#revision
–
fossil://… or csv://… or …
–
●
REVISION="1" increment for each change
●
LICENSE="GNU GPL v3" (can have several lines)
●
COPYRIGHT="20052014 Jonathan Duddington" (can have several lines)
Espeak: let's make a recipe! ●
●
ARCHITECTURES="x86_gcc2 ?x86 ?x86_64" ●
x86 = gcc4
●
! = broken
●
? = untested
PROVIDES=" espeak = $portVersion cmd:espeak = $portVersion" ●
One cmd:* for each command-line tool
Espeak: let's make a recipe! ●
REQUIRES="haiku >= $haikuVersion" ●
●
Runtime requirements
BUILD_REQUIRES=" haiku_devel >= $haikuVersion" ●
●
Build-time requirements (libraries…)
BUILD_PREREQUIRES="cmd:make cmd:gcc" ●
Commands required on the host
Espeak: let's make a recipe! ●
SOURCE_DIR="${portVersionedName}source"
●
BUILD() { (build steps) cd src make LIB_STDCPP=lstdc++.r4 \ AUDIO=wave LIB_PTHREAD= \ VISIBILITY_FLAG= \ PREFIX=$prefix \ DATADIR=$dataDir/espeakdata }
●
INSTALL() : same; just add the install target
Espeak: First bake… ●
haikuporter nodependencies espeak ●
CHECKSUM TEMPLATE CHECKSUM_SHA256="bf9a17673adffcc28ff7ea18 764f06136547e97bbd9edf2ec612f09b207f0659" Warning: No checksum found in recipe! –
●
Need to add the checksum to the recipe
ld: cannot find lstdc++ –
Of course, we must patch it!
Espeak: try 2 (checksum and patch) ●
Add the CHECKSUM_SHA256 line
●
Create a patch from the svn attempt
●
●
svn diff trunk/ > espeaksvn.patch
●
Might apply with some fuzz on the release source
"keeping chroot folder …/work1.48.04 intact for inspection" ●
The source is always converted to a git repo
●
Let's go there and try to apply the patch …
Espeak: try 2 (checksum and patch) ●
Applying the svn patch ●
●
cd …/work1.48.04/sources/espeak1.48.04 source patch p1 = 0.12.0 devel:libSDL_mixer_1.2$secondaryArchSuffi x >= 0.12.0
Install sdl_mixer and sdl_mixer_devel
SuperTux: Try 2 ●
haikuporter nodependencies supertux ●
error: SDL_image library required –
●
Add to REQUIRES : ●
●
One more lib we need… install sdl_image and patch:
lib:libSDL_mixer_1.2$secondaryArchSuffix >= 0.12.0
Add to BUILD_REQUIRES : ●
devel:libSDL_mixer_1.2$secondaryArchSuffi x >= 0.12.0
SuperTux: Try 3 ●
error: *** zlib is missing
●
Add to REQUIRES : ●
●
Add to BUILD_REQUIRES : ●
●
lib:libz$secondaryArchSuffix >= 1.2.8 devel:libz$secondaryArchSuffix >= 1.2.8
Try 4: \o/ ●
Let's test it… not too much though, we have work to do �
SuperTux: debriefing ●
Recipe validated ●
●
Send it upstream (fork haikuports on BitBuckets + PR)
Package built and working ●
Will need publishing –
●
Currently requires pushing to main Haiku repo
TODO ● ●
Add dependencies for OpenGL and test it Fix settings location (~/.supertux to ~/config/settings/supertux)
Diploma Haiku, Inc. certifies that: ____________________ has passed the Haiku packaging workshop at RMLL 2014.
Montpellier, Thursday 10th july 2014. The graduated : (signature)
Links � ●
Solutions are available ●
●
http://revolf.free.fr/RMLL/2014/workshop/
References ●
●
https://dev.haiku-os.org/wiki/PackageManagement/Buil dingPackages http://bb.haikuports.org/haikuports/wiki/HaikuPorterFor PM/BuildRecipes