History log of /haikuporter/HaikuPorter/ShellScriptlets.py
Revision Date Author Comments
# 36f9a136 27-Apr-2024 Joachim Mairböck <j.mairboeck@gmail.com>

fixCMake: use double quotes in the sed command so that the variables are actually expanded


# c787b408 27-Apr-2024 OscarL <oscar.lesta@gmail.com>

Add `cmd:find` to scriptletPrerequirements (needed by fixCMake). (#281)


# 259fa69d 09-Jun-2023 Oscar Lesta <oscar.lesta@gmail.com>

Workaround for issue #207.

Remove the boot dir from the chroot, even if $buildOK is false.
This avoids that annoying "waiting for package to be activated".

Deleting just "boot/system/packages/administrative/activated_packages"
might be enough, but... this works well for me, and it's already how
it's done if $buildOK is true.


# df3c0a88 25-Apr-2023 Augustin Cavalier <waddlesplash@gmail.com>

HaikuPorter: Make check for both static and shared more robust.


# b3987b8a 28-Feb-2023 Augustin Cavalier <waddlesplash@gmail.com>

ShellScriptlets: Avoid interactivity in checkedUnmount.

Also, always fail builds when unmounting fails.


# 8a574603 06-Dec-2022 Augustin Cavalier <waddlesplash@gmail.com>

HaikuPorter ShellScriptlets: Validate there is only either a shared or a static library.

Having both should always be an error, we only want to provide one.


# 5153d74a 04-Jul-2022 Alex O'Brien <3541@3541.website>

ShellScriptlets: Escape single quotes in variables.

Variables containing single quotes cause problems when imported by Bash.
This patch fixes the issue by replacing ' in these variables with '\''.

Fixes #145.


# 4acf4899 09-Apr-2022 Jerome Duval <jerome.duval@gmail.com>

setupChrootScript: add font settings to the chroot

for fontconfig


# 3834a2fc 18-Dec-2021 Jérôme Duval <jerome.duval@gmail.com>

ShellScriptlets: create shared_memory directory in chroot


# f9131f32 19-Nov-2021 waddlesplash <waddlesplash@gmail.com>

ShellScriptlets: Pass --wrap-mode=nodownload to meson by default.

If strictly necessary, it can be overridden by passing --wrap-mode=default in a later argument, but this is probably what we want generally.


# a2e1ca5f 08-Nov-2021 Jerome Duval <jerome.duval@gmail.com>

ShellScriptlets: cmake/meson wrappers require which


# cd9ed953 20-Oct-2021 Augustin Cavalier <waddlesplash@gmail.com>

ShellScriptlets: Improve cmake/meson wrappers.

Thanks to comments from korli and tqh in cf896154441dc1722e5f442f02e875bc9206475b.


# cf896154 29-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

ShellScriptlets: Require CMAKE_BUILD_TYPE or meson --buildtype arguments.

Otherwise we get a debug, non-optimized build, which is almost certainly
not what we want to build recipies with.


# 86426f64 21-Feb-2020 Augustin Cavalier <waddlesplash@gmail.com>

ShellScriptlets: Add a fixCMake scriptlet.

Much like fixPkgconfig, but for CMake files. Not so useful yet because
of a CMake limitation; see comments in HaikuPorts commit


# 8d5c14b6 31-Jan-2020 Michael Lotz <mmlr@mlotz.ch>

python3: Finish python3 change. python2 breaking

* Based on mmlr's 2017 work to use Python3 with
changes and adjustments for the current codebase


# 5839b82c 07-Sep-2019 Sergei Reznikov <diver@gelios.net>

Convert an error to a warning, improve formatting


# c4c7fe93 12-Jan-2018 fbrosson <fbrosson@users.noreply.github.com>

defineDebugInfoPackage now handles resources correctly.

Before this change, extractDebugInfo was calling:
* xres to make a backup of the resources,
* strip
* xres again, to restore the resources,
* objcopy --add-gnu-debuglink

But objcopy was dropping the resources again! Moving that call
right after the call to strip (and before the second call to
xres) allows to really keep the resources of the runtimes when
a recipe uses defineDebugInfoPackage.


# 6b0ab9e3 15-Dec-2017 alaviss <alaviss@users.noreply.github.com>

ShellScriptlets: add quote (#155)

This fixes packageEntries for package with glob characters in their name


# 9836ce60 10-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

Cleanup: Whitespace and line length cleanup.


# d914f132 09-Dec-2017 Kacper Kasper <kacperkasper@gmail.com>

Replace sed with bash in defineDebugInfoPackage.

* Fixes #152.


# 9b910e2f 22-Nov-2017 Kacper Kasper <kacperkasper@gmail.com>

Change dashes to underscores in debuginfo:.

* This allows to extract debug info from files with
dashes in names.


# 2cf106cd 21-Nov-2017 Kacper Kasper <kacperkasper@gmail.com>

Fix defineDebugInfoPackage.

* It should always get a name with architecture suffix.
* This is consistent with other sections of the recipe.
* Previously it tried to get packageSuffix from packageName.
If that contained architecture suffix, it would end up
creating packages with x86_debuginfo suffix, instead of just
debuginfo.


# 8a6076e6 22-Feb-2017 Humdinger <humdingerb@gmail.com>

Add a addAppletDeskbarSymlink function

Similar to addAppDeskbarSymlink.


# 68e3958c 23-Oct-2016 Jérôme Duval <jerome.duval@gmail.com>

Implement local builders.

* provide info(), warn() to be used instead of print. By default outputs to stdout.
For builders, outputs to files.
* replace most calls to check_call by check_output, and log with info(). Also outputs
the outputs an eventual CalledProcessError output attribute.
* add option --local-builders to be used with --build-master: indicates how many
local builders to use instead of remote builders. If paramiko isn't available,
defaults to 1, otherwise 0.
* rename Builder to RemoteBuilder.
* remove changes of current directory: this doesn't work in a
multithreaded environnement. Policy.py is the most affected as it
expected to run in the packaging directory.


# 21bfed22 25-Jul-2016 fbrosson <fbrosson@users.noreply.github.com>

ShellScriptlets.py: fix corner-case bug in fixLibtoolArchives.

* fixLibtoolArchives assumed each reference to an external lib*.la
file was followed by a white space or by an end of line, but this
is not true for the last lib*.la of the line because of the closing
single quote. The basename of the libtool file was therefore not
detected correctly, so the corresponding package-links directory
could not be found for the last lib*.la of the dependency_libs
parameter in the packages' libtool files. This is now fixed.
* Improve the substitution by using the dirnames of the libtool file
instead of its full path. This allows to also fix any paths passed
with -L.

Reminder: The call to the fixLibtoolArchives helper function takes no
arguments and should happen *before* the "packageEntries devel ..."


# c94025ab 16-Jan-2016 Hannah <hypgci@gmail.com>

extractDebugInfo should preserve resources #70


# 3e60a59f 16-Dec-2015 Michael Lotz <mmlr@mlotz.ch>

ShellScriptlets: Don't mount the ports dir.

It allows to get at external files without referencing them in the
recipe, which is not desirable. This change requires ports to always
explicitly reference any additional files needed.


# 56499b3c 22-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

ShellScriptlets: Internalize parsing of scriptlet prerequires.

Reduces duplication and knowledge of the original format.


# 32bfac6d 06-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

fixPkgconfig: add a "strict" mode.

This will prevent fixPkgconfig from blindly changing the
libdir variable in pkgconfig files, which has caused
problems with libqt4, for example.

This could do with further improvements to make it more
robust in the general case.


# 0867eefc 07-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Revert "fixPkgconfig: don't mess with already functional pc files"

This reverts commit 39c4086bd53ce01cf263d77d4d317f4120daa6ab.


# 39c4086b 06-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

fixPkgconfig: don't mess with already functional pc files


# a49e2e1d 01-May-2015 François Revol <revol@free.fr>

fixLibtoolArchives scriptlet: continue on error

It's best effort here, sometimes we can't find a lib~ symlink
because we are referencing a lib inside our own package.

Like libexslt.la linking to libxslt.la.


# 550b6250 01-May-2015 François Revol <revol@free.fr>

Add FixLibtoolArchives function

Attempt to provide a way to fix the .la files.

We only fix the paths to other referenced .la files,
it seems to be sufficient.

Ideally we'd replace them with /packages/foo_devel-$ver/devel~libfoo/...

However most referenced libraries don't actually get a devel symlink,
so we use /packages/foo-$ver/lib~libfoo/

Tested on sdl_ttf and sdl_mixer.


# fc1d58c6 29-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Revert to tab spacing for Pe's sake.


# a5f922e3 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Try again with whitespace.


# 558fbdb0 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Second attempt to fix whitespace. Options are different on OS X.


# 429ec015 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Convert tabs to spaces.


# 199c4ea7 25-Oct-2014 Jonathan Schleifer <js@webkeks.org>

Fix handling of .so files

* Only search for readelf if there are actually .so files.
* Don't exit when grep does not find a match (disable set -e).

This makes HaikuPorter work on OS X (well enough to bootstrap, that is).


# 6259f761 14-Sep-2014 Jonathan Schleifer <js@webkeks.org>

Provide default action for PATCH

This fixes patch being called on systems with case-insensitive file
system.


# 92d860cd 19-Jul-2014 François Revol <revol@free.fr>

Add an addResourcesToBinaries() function

This allows adding an HVIF icon from an RDEF file directly
to binaries, without having to patch makefiles.


# f540faa2 14-Jul-2014 Oliver Tappe <zooey@hirschkaefer.de>

Fix #3: broken networking in chroot.

* Haikuporter now copies the network settings directory into the chroot,
such that networking should work just as usual.


# 463f228e 14-Jul-2014 Oliver Tappe <zooey@hirschkaefer.de>

Implement support for freestanding package names in recipes.

* Package names used to be linked to port names (they could only extend
it). Now, independent package names and versions can be set by means of
PACKAGE_NAME and PACKAGE_VERSION recipe attributes.


# 469c612e 14-Jun-2014 Oliver Tappe <zooey@hirschkaefer.de>

Ask user what to do if unmounting failed repeatedly.

* Instead of failing, give the user the option to force-unmount
the volume.


# 3c0e4ff2 14-Jun-2014 Oliver Tappe <zooey@hirschkaefer.de>

Improve user experience in chroot shell.

* Activate system inputrc in chroot for improved navigational features.
* Create basic profile in order to show the current dir in the prompt.


# 28ebb93a 01-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

ShellScriptlets: Improve checkedUnmount()

* No need to wait after the last attempt.
* When we give up, let fdinfo print who has still open file descriptors
for the volume in question.


# e0ce01b1 28-Jan-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Remove leftover debug message.


# ffecf212 28-Jan-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

prepareInstalledDevelLib: Also look for readelf.


# eccdea5b 28-Jan-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

prepareInstalledDevelLlib: check sed availability

This uses sed, which must be added to the BUILD_PREREQUIRES. However, it
was not checking for it, leading to silent failure (and waste of time).


# 821b1924 08-Dec-2013 Alexander von Gluck IV <kallisti5@unixzen.com>

ShellScriptlets: fix spaced entries for packageEntries

* bash will automatically parse quoted items using this method
* tested with a local shell script
* only requirement for this to work is a modern bash shell
* http://www.gnu.org/software/bash/manual/bashref.html#Looping-Constructs
* packageEntries blah_devel file/file file/file works as well as
packageEntires blah_devel file/file "file/my file" now
* solves #21, feel free to solve another way if needed


# cf83b765 01-Dec-2013 Michael Lotz <mmlr@mlotz.ch>

ShellScriptlets: Add --omit-buildspec argument to runConfigure.

When it is set, no --build=... argument will be passed to the configure
script and thus allows runConfigure to be used for scripts that don't
support this argument.


# c4c8633b 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

/boot/common has been removed

Mostly the changes are straight-forward (don't look in /boot/common,
adjust paths). A notable change concerns the resolution of port
dependencies: We no longer simply include all /boot/system packages in
the chroot, but only those that have to be pulled in according to the
dependency resolution. This may break some recipes that don't declare
all the things they actually require for building, but have worked
previously due to those dependencies living in /boot/system.


# 3ff34f38 02-Oct-2013 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix location of libs and includes for pkg-config

* They were not right when building hybrid packages
* Hint: set PKG_CONFIG_LIBDIR=/boot/common/develop/lib/x86/pkgconfig
when using pkg-config to build hybrid software.


# be2b93e8 02-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Don't explicitly set build-host when cross-building.

* cross-building was broken due to haikuporter automatically setting
the wrong build host (i.e. the effective target machine triple)


# 6becfa90 30-Aug-2013 Oliver Tappe <zooey@hirschkaefer.de>

Let runConfigure() apply default for --build.

* Many ports have problems guessing the build type for newish
platforms (e.g. in our case 'x86_64-unknown-haiku'. Allow these ports
to get at least a bit further by explicitly setting the build type
to $effectiveTargetMachineTriple.


# f558d203 14-Aug-2013 Oliver Tappe <zooey@hirschkaefer.de>

Improve robustness of unmounting subfolders in work-dir:

* add shell function checkedUnmount($mountPoint) which retries the
unmounting of the given mountpoint up to 5 times
* use checkedUnmount() during cleanup, in order to deal with the race
conditions between the packaging daemon having a FD for the
mountpoint and haikuporter trying to do the unmount


# 2dda9fa3 09-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Bind-mount the correct dir to /port

Was broken since the recipeFile variable was changed to refer to the
copied recipe.


# 426927f1 04-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

prepareInstalledDevelLib: secondary arch fix


# 48e2ca1b 03-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add shell function symlinkRelative

* Works similar to ln, but expects absolute paths (or paths relative to
the current directory) and creates relative symlinks. Comes in handy
when link source and/or target paths are based on shell variable
values.
* Use symlinkRelative in addAppDeskbarSymlink and
addPreferencesDeskbarSymlink. Not strictly necessary in this case, but
yields nicer results.


# 1fa715f2 02-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Support building secondary arch packages from regular recipes

* Add settings SECONDARY_CROSS_DEVEL_PACKAGES, SECONDARY_CROSS_TOOLS,
and SECONDARY_TARGET_ARCHITECTURES to config file and command line
option --secondary-cross-devel-packages, overriding the first.
SECONDARY_TARGET_ARCHITECTURES is the list of secondary target
architectures that ports may be built for (for a hybrid target).
SECONDARY_CROSS_TOOLS is the respectively matching list of cross
tools directories and SECONDARY_CROSS_DEVEL_PACKAGES the list of
Haiku cross development sysroot packages.
* Repository: For all configured secondary architectures add derived
ports.
* BuildPlatformUnix:
- setupNonChrootBuildEnvironment()/cleanNonChrootBuildEnvironment() do
now support an optional secondaryArchitecture parameter which is set
when building a port for a secondary architecture. The build
environment is set up using the respective cross tools and Haiku
cross devel package.
- Fix setting up the system include and library search paths for
gcc 4. It has other paths built in.
* Recipes can now set a SECONDARY_ARCHITECTURES (similar to
ARCHITECTURES) to indicate for which secondary architectures the port
can be built.
* Add new shell variables effectiveTargetArchitecture,
effectiveTargetMachineTriple, and effectiveTargetMachineTripleAsName
which are set to the values for the target architecture we are
actually building for (i.e. the primary or secondary architecture).
When cross-compiling the pre-existing target* variables continue to
correspond to the primary architecture.
* The variables binDir, sbinDir, libDir, includeDir, oldIncludeDir,
developLibDir are set to a respective subdirectory when building for
a secondary architecture.


# e5266aef 19-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Clean up trailing whitespace


# 6b5c6b36 17-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

fixPkgconfig(): fix overly enthusiastic use of installDestDir


# 4b23c69c 17-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix use of target architecture tools


# e800a586 17-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Make several shell functions work for non-chroot builds


# 438c4fce 11-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Call packageDebugInfos() automatically after INSTALL

No need to require the INSTALL() function calling it explicitly. That
it should be done has already been expressed by calling
defineDebugInfoPackage() earlier.


# c1802710 11-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add functions for building debug info packages

* Add python variable commonRecipeScriptHead, which is added as a
prefix to both configFileEvaluatorScript and recipeActionScript.
It contains common functionality (e.g. shared functions).
* Pull new function getPackagePrefix() out of packageEntries().
* Add defineDebugInfoPackage() which can be used to declare a
debug info package and the files from which the debug infos are
extracted. Used at top level in the recipe.
* Add packageDebugInfos() which processes all debug info packages
declared via defineDebugInfoPackage(), extracting the debug info
and moving them to the respective packaging dir. Used in INSTALL().
* Add extractDebugInfo() which extracts the debug info from a given
file to the given file.


# a8d067ee 09-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Use shell variables for passing the wrapper script parameters

Using string formatting has the drawback that "%s" and friends actually
used in the shell script would have to be escaped to prevent
substitution (or an error).


# 55fcaa77 09-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Change the way variables are set for the shell scripts

* We no longer just set the variables in the environment we start the
shell with, as those are inherited by programs the shell starts and
may thus leak into build systems where they may have meaning. Instead
we just prepend setter instructions to the shell script we start.
* Remove the restriction that almost none of the absolute paths
variables can be used outside the action functions:
- Port._updateShellVariables() also sets the variables whose value
depends on the revision in "forParsing" mode, now. Instead of the
not-yet-known revision number it uses the placeholder "$REVISION"
in the value.
- We no longer source the recipe file directly, but copy it to the
work directory (was done already anyway) and inject a function call
to updateRevisionVariables() right after the REVISION variable is
set. In configFileEvaluatorScript that function reevaluates the
concerned variables, so that they get the correct value.


# 501db8c0 17-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup handling of cross-sysroot directory.

* Instead of passing in $isCrossRepository, we now pass in
$crossSysrootDir into the chroot-setup/teardown scriptlets, such that
that path is only defined once (in HaikuPorter).


# 95fd6a8b 17-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add license header (MIT)

* additionally: uppercase copyright notices and separate them from the
top by a single line


# 310f43a9 17-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add addPreferencesDeskbarSymlink() shell function


# 0d92b585 15-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add addAppDeskbarSymlink() service function

It creates the Deskbar symlink for the given application executable.


# 92afe462 09-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

prepareInstalledDevelLib(): Fix readline/readelf mixup


# 560a87c1 07-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Rename cross-build sysroot folder and fix contents.


# bbbc8057 05-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Use target-readline when preparing library of cross build.


# 99cdb4d5 05-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add support for cross-sysroot in /boot/cross/<target-arch>

* pass environment variables isCrossRepository and targetArchitecture
to scriptlets that set up / tear down the chroot
* extend chroot-setup scriptlet to symlink the sysroot package into
a separate packages folder under /boot/cross/<target-arch> and
mount that folder
* extend chroot-tear-down scriptlet to unmount /boot/cross/<target-arch>


# da185b74 02-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Remove 'prereq-repository' in work-folder during cleanup.


# a777f169 21-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add support for making some scriplet prerequirements (i.e. readelf)
depend on the target architecture.


# f735baf4 06-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Ignore Ctrl-C in setup and teardown scriptlets.


# 4913bfbb 05-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Handle dependencies of chroot scriptlets

* define the dependencies of the scriptlets
* add the scriptlet dependencies as prerequirements when determining
the set of packages that are required in the chroot


# e6dba459 30-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add shell function packageEntries()

Given the name suffix for a package and a list of entries, the function
moves the entries to the packaging directory of the respective package.


# 366e7a57 30-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add fixDevelopLibDirReferences() shell function

* It replaces $libDir by $developLibDir in the given files.
* Use it in prepareInstalledDevelLib() to fix *.la files.


# 0868e7c4 29-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Make prepareInstalledDevelLib[s] more flexible

Rename prepareInstalledDevelLibsHelper to prepareInstalledDevelLib and
allow two optional parameters, the glob patterns for the libraries.
This allows the function to be used for libraries with non-standard
naming.


# 56a0cb53 26-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add optional recipe phase PATCH

* ConfigParser does now determine which phases are defined in the
recipe.
* Port.patchSource():
- Call the recipe's PATCH(), if defined.
- If an error occurred applying a patch or calling PATCH() after at
least one patch has already been applied, clear the
checkout/unpack flags.


# 9533550e 25-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add fixPkgconfig() shell function

To be invoked at the end of the installation. It moves the pkgconfig
directory from lib/ to develop/lib and fixes the libdir and includedir
variables in the *.pc files.


# 39f07387 25-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

prepareInstalledDevelLibsHelper(): Use pre-existing variables


# 93ae3cb9 24-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add prepareInstalledDevelLibs utility function for recipes

To be called at the end of the install phase. Given a list of basenames
of libraries, the function moves the respective library files and
symlinks that shouldn't be in lib/ to develop/lib/ and creates
additionally required symlinks there.


# 503333a1 24-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add shell function runConfigure() that can be used in recipes

"runConfigure ./configure" is equivalent to
"./configure $configureDirArgs". The function supports an option
"--omit-dirs <dirs>" which allows to omit directories from
$configureDirArgs thus making it easier to invoke older configure
scripts. Theoretically the function could be made more intelligent,
running the configure script with "--help" to determine which options
are actually supported. Maybe some other day...


# cb96a4a8 22-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Bind-mount the port directory into the chroot

This allows the BUILD() and INSTALL() recipe functions to access
additional files. E.g. in case of Vision there's a settings file
that shall be included in the package.


# 8b8deb25 21-Apr-2013 Oliver Tappe <zooey@hirschkaefer.de>

Improve cleanup of work directory in case of success.


# df75ebb7 15-Apr-2013 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring: rip haikuporter apart into separate modules


# 32bfac6d1b4727f61a0c1ecd522c8f10efdff91b 06-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

fixPkgconfig: add a "strict" mode.

This will prevent fixPkgconfig from blindly changing the
libdir variable in pkgconfig files, which has caused
problems with libqt4, for example.

This could do with further improvements to make it more
robust in the general case.


# 0867eefc694f1243158ccc2b00905613eba7501b 07-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Revert "fixPkgconfig: don't mess with already functional pc files"

This reverts commit 39c4086bd53ce01cf263d77d4d317f4120daa6ab.


# 39c4086bd53ce01cf263d77d4d317f4120daa6ab 06-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

fixPkgconfig: don't mess with already functional pc files


# a49e2e1d325f53529e560df6085e7fa2e10201be 01-May-2015 François Revol <revol@free.fr>

fixLibtoolArchives scriptlet: continue on error

It's best effort here, sometimes we can't find a lib~ symlink
because we are referencing a lib inside our own package.

Like libexslt.la linking to libxslt.la.


# 550b62503630845bcf98b6e4901b2f891055ea87 01-May-2015 François Revol <revol@free.fr>

Add FixLibtoolArchives function

Attempt to provide a way to fix the .la files.

We only fix the paths to other referenced .la files,
it seems to be sufficient.

Ideally we'd replace them with /packages/foo_devel-$ver/devel~libfoo/...

However most referenced libraries don't actually get a devel symlink,
so we use /packages/foo-$ver/lib~libfoo/

Tested on sdl_ttf and sdl_mixer.


# fc1d58c6abe57c99c11ec02b27be40844fb53572 29-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Revert to tab spacing for Pe's sake.


# a5f922e3fded4460be5a3c717862e7e588772487 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Try again with whitespace.


# 558fbdb04ff6cb063a4afba7f15b6f1bd0343af2 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Second attempt to fix whitespace. Options are different on OS X.


# 429ec015d0c47da50e302537ed33bc3f80d035a8 27-Oct-2014 Charlie Clark <charlie.clark@clark-consulting.eu>

Convert tabs to spaces.


# 199c4ea7aa3bb2d7a64932216701f2cea24c5da3 25-Oct-2014 Jonathan Schleifer <js@webkeks.org>

Fix handling of .so files

* Only search for readelf if there are actually .so files.
* Don't exit when grep does not find a match (disable set -e).

This makes HaikuPorter work on OS X (well enough to bootstrap, that is).


# 6259f761307e3078ee763b28867683061f896687 14-Sep-2014 Jonathan Schleifer <js@webkeks.org>

Provide default action for PATCH

This fixes patch being called on systems with case-insensitive file
system.


# 92d860cdc4d71149ca8a1a3bf1386715d8bf28ed 19-Jul-2014 François Revol <revol@free.fr>

Add an addResourcesToBinaries() function

This allows adding an HVIF icon from an RDEF file directly
to binaries, without having to patch makefiles.


# f540faa2a00dbc5941f8a9e212fd7d2573823601 14-Jul-2014 Oliver Tappe <zooey@hirschkaefer.de>

Fix #3: broken networking in chroot.

* Haikuporter now copies the network settings directory into the chroot,
such that networking should work just as usual.


# 463f228e9554935be64f3bfdab5a269ae2a7a93c 14-Jul-2014 Oliver Tappe <zooey@hirschkaefer.de>

Implement support for freestanding package names in recipes.

* Package names used to be linked to port names (they could only extend
it). Now, independent package names and versions can be set by means of
PACKAGE_NAME and PACKAGE_VERSION recipe attributes.


# 469c612e96f10d3767aa2ef39ebaedba473d7d55 14-Jun-2014 Oliver Tappe <zooey@hirschkaefer.de>

Ask user what to do if unmounting failed repeatedly.

* Instead of failing, give the user the option to force-unmount
the volume.


# 3c0e4ff2e53ce240b557a4421ea30ddee083b01d 14-Jun-2014 Oliver Tappe <zooey@hirschkaefer.de>

Improve user experience in chroot shell.

* Activate system inputrc in chroot for improved navigational features.
* Create basic profile in order to show the current dir in the prompt.


# 28ebb93a477cf23168e04d4f122cbf31a1696e59 01-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

ShellScriptlets: Improve checkedUnmount()

* No need to wait after the last attempt.
* When we give up, let fdinfo print who has still open file descriptors
for the volume in question.


# e0ce01b19e0376e267d4f3b144dd8b742a57e574 28-Jan-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Remove leftover debug message.


# ffecf21279f2b068a5cb6b090ca2deb4b208552c 28-Jan-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

prepareInstalledDevelLib: Also look for readelf.


# eccdea5bbd80f9cd3d44eac427905979e4df8de4 28-Jan-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

prepareInstalledDevelLlib: check sed availability

This uses sed, which must be added to the BUILD_PREREQUIRES. However, it
was not checking for it, leading to silent failure (and waste of time).


# 821b1924694bdaf748f77b759e3d94768e2c428c 08-Dec-2013 Alexander von Gluck IV <kallisti5@unixzen.com>

ShellScriptlets: fix spaced entries for packageEntries

* bash will automatically parse quoted items using this method
* tested with a local shell script
* only requirement for this to work is a modern bash shell
* http://www.gnu.org/software/bash/manual/bashref.html#Looping-Constructs
* packageEntries blah_devel file/file file/file works as well as
packageEntires blah_devel file/file "file/my file" now
* solves #21, feel free to solve another way if needed


# cf83b765d66a279cbf870f84450693ac7dead7ea 01-Dec-2013 Michael Lotz <mmlr@mlotz.ch>

ShellScriptlets: Add --omit-buildspec argument to runConfigure.

When it is set, no --build=... argument will be passed to the configure
script and thus allows runConfigure to be used for scripts that don't
support this argument.


# c4c8633bbdf41a3e81391183a4325444f08ed02d 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

/boot/common has been removed

Mostly the changes are straight-forward (don't look in /boot/common,
adjust paths). A notable change concerns the resolution of port
dependencies: We no longer simply include all /boot/system packages in
the chroot, but only those that have to be pulled in according to the
dependency resolution. This may break some recipes that don't declare
all the things they actually require for building, but have worked
previously due to those dependencies living in /boot/system.


# 3ff34f38ecc77f4597ea396b0cfc56a88c03be0a 02-Oct-2013 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix location of libs and includes for pkg-config

* They were not right when building hybrid packages
* Hint: set PKG_CONFIG_LIBDIR=/boot/common/develop/lib/x86/pkgconfig
when using pkg-config to build hybrid software.


# be2b93e8efc6c10b66749254e70083e78984baef 02-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Don't explicitly set build-host when cross-building.

* cross-building was broken due to haikuporter automatically setting
the wrong build host (i.e. the effective target machine triple)


# 6becfa90cd8d6c131e11d0e9087685730966b07a 30-Aug-2013 Oliver Tappe <zooey@hirschkaefer.de>

Let runConfigure() apply default for --build.

* Many ports have problems guessing the build type for newish
platforms (e.g. in our case 'x86_64-unknown-haiku'. Allow these ports
to get at least a bit further by explicitly setting the build type
to $effectiveTargetMachineTriple.


# f558d2038140b6e95374eb400c15d0971b208b11 14-Aug-2013 Oliver Tappe <zooey@hirschkaefer.de>

Improve robustness of unmounting subfolders in work-dir:

* add shell function checkedUnmount($mountPoint) which retries the
unmounting of the given mountpoint up to 5 times
* use checkedUnmount() during cleanup, in order to deal with the race
conditions between the packaging daemon having a FD for the
mountpoint and haikuporter trying to do the unmount


# 2dda9fa30bae245d9e0b0ffd31687f567444cc54 09-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Bind-mount the correct dir to /port

Was broken since the recipeFile variable was changed to refer to the
copied recipe.


# 426927f1a4d6271bfef04e06496c9623b366f356 04-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

prepareInstalledDevelLib: secondary arch fix


# 48e2ca1b9daa441b15bb8d6b575fd7bc0cd44581 03-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add shell function symlinkRelative

* Works similar to ln, but expects absolute paths (or paths relative to
the current directory) and creates relative symlinks. Comes in handy
when link source and/or target paths are based on shell variable
values.
* Use symlinkRelative in addAppDeskbarSymlink and
addPreferencesDeskbarSymlink. Not strictly necessary in this case, but
yields nicer results.


# 1fa715f2a326234d09474bfe732045cb38f2d902 02-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Support building secondary arch packages from regular recipes

* Add settings SECONDARY_CROSS_DEVEL_PACKAGES, SECONDARY_CROSS_TOOLS,
and SECONDARY_TARGET_ARCHITECTURES to config file and command line
option --secondary-cross-devel-packages, overriding the first.
SECONDARY_TARGET_ARCHITECTURES is the list of secondary target
architectures that ports may be built for (for a hybrid target).
SECONDARY_CROSS_TOOLS is the respectively matching list of cross
tools directories and SECONDARY_CROSS_DEVEL_PACKAGES the list of
Haiku cross development sysroot packages.
* Repository: For all configured secondary architectures add derived
ports.
* BuildPlatformUnix:
- setupNonChrootBuildEnvironment()/cleanNonChrootBuildEnvironment() do
now support an optional secondaryArchitecture parameter which is set
when building a port for a secondary architecture. The build
environment is set up using the respective cross tools and Haiku
cross devel package.
- Fix setting up the system include and library search paths for
gcc 4. It has other paths built in.
* Recipes can now set a SECONDARY_ARCHITECTURES (similar to
ARCHITECTURES) to indicate for which secondary architectures the port
can be built.
* Add new shell variables effectiveTargetArchitecture,
effectiveTargetMachineTriple, and effectiveTargetMachineTripleAsName
which are set to the values for the target architecture we are
actually building for (i.e. the primary or secondary architecture).
When cross-compiling the pre-existing target* variables continue to
correspond to the primary architecture.
* The variables binDir, sbinDir, libDir, includeDir, oldIncludeDir,
developLibDir are set to a respective subdirectory when building for
a secondary architecture.


# e5266aef3a8b81f9e6d29e00fecd9da40aafa23b 19-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Clean up trailing whitespace


# 6b5c6b36ffcac8f98218229839f9a12d386fd7f5 17-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

fixPkgconfig(): fix overly enthusiastic use of installDestDir


# 4b23c69c7f047cd82e9661d016783d883013087c 17-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix use of target architecture tools


# e800a5862b5c2918161560f601557d4cd7533210 17-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Make several shell functions work for non-chroot builds


# 438c4fced599cedcb8ddee63612d0c4b57ffee13 11-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Call packageDebugInfos() automatically after INSTALL

No need to require the INSTALL() function calling it explicitly. That
it should be done has already been expressed by calling
defineDebugInfoPackage() earlier.


# c18027105b0dc5ac9db8f0d1d66f2fe15d3c805f 11-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add functions for building debug info packages

* Add python variable commonRecipeScriptHead, which is added as a
prefix to both configFileEvaluatorScript and recipeActionScript.
It contains common functionality (e.g. shared functions).
* Pull new function getPackagePrefix() out of packageEntries().
* Add defineDebugInfoPackage() which can be used to declare a
debug info package and the files from which the debug infos are
extracted. Used at top level in the recipe.
* Add packageDebugInfos() which processes all debug info packages
declared via defineDebugInfoPackage(), extracting the debug info
and moving them to the respective packaging dir. Used in INSTALL().
* Add extractDebugInfo() which extracts the debug info from a given
file to the given file.


# a8d067ee068e6c6e4d7882641dc57266ceb869d6 09-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Use shell variables for passing the wrapper script parameters

Using string formatting has the drawback that "%s" and friends actually
used in the shell script would have to be escaped to prevent
substitution (or an error).


# 55fcaa77e5b7ee9d8a4413ad456fe784d7279a91 09-Jul-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Change the way variables are set for the shell scripts

* We no longer just set the variables in the environment we start the
shell with, as those are inherited by programs the shell starts and
may thus leak into build systems where they may have meaning. Instead
we just prepend setter instructions to the shell script we start.
* Remove the restriction that almost none of the absolute paths
variables can be used outside the action functions:
- Port._updateShellVariables() also sets the variables whose value
depends on the revision in "forParsing" mode, now. Instead of the
not-yet-known revision number it uses the placeholder "$REVISION"
in the value.
- We no longer source the recipe file directly, but copy it to the
work directory (was done already anyway) and inject a function call
to updateRevisionVariables() right after the REVISION variable is
set. In configFileEvaluatorScript that function reevaluates the
concerned variables, so that they get the correct value.


# 501db8c023aa22dd54b52bd8b9d1a3b954706dd0 17-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup handling of cross-sysroot directory.

* Instead of passing in $isCrossRepository, we now pass in
$crossSysrootDir into the chroot-setup/teardown scriptlets, such that
that path is only defined once (in HaikuPorter).


# 95fd6a8bd4d47186696c722b6717b2b073e799a1 17-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add license header (MIT)

* additionally: uppercase copyright notices and separate them from the
top by a single line


# 310f43a97b4a39d59d282a91401c6b7580d21dfe 17-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add addPreferencesDeskbarSymlink() shell function


# 0d92b585d1c98f8f1a77daadb3fe5c92fbdfa828 15-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add addAppDeskbarSymlink() service function

It creates the Deskbar symlink for the given application executable.


# 92afe4622185cf87c8052c733c9dff87f343d0c0 09-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

prepareInstalledDevelLib(): Fix readline/readelf mixup


# 560a87c12e42f67c3904267f17d907b511c36c60 07-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Rename cross-build sysroot folder and fix contents.


# bbbc8057052130d85d4581da6a287e9a5a9582d5 05-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Use target-readline when preparing library of cross build.


# 99cdb4d55c0432ffafd05d562333668a960a53f4 05-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add support for cross-sysroot in /boot/cross/<target-arch>

* pass environment variables isCrossRepository and targetArchitecture
to scriptlets that set up / tear down the chroot
* extend chroot-setup scriptlet to symlink the sysroot package into
a separate packages folder under /boot/cross/<target-arch> and
mount that folder
* extend chroot-tear-down scriptlet to unmount /boot/cross/<target-arch>


# da185b74ce1a99b95f0311c414f5b9c73f6280e4 02-Jun-2013 Oliver Tappe <zooey@hirschkaefer.de>

Remove 'prereq-repository' in work-folder during cleanup.


# a777f16927dd781ab46415bc46832545f789a752 21-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Add support for making some scriplet prerequirements (i.e. readelf)
depend on the target architecture.


# f735baf4a0492be40f652d1a4f7c906e4aabdd02 06-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Ignore Ctrl-C in setup and teardown scriptlets.


# 4913bfbb9847af2c3d485fe896aed2eaadc00a10 05-May-2013 Oliver Tappe <zooey@hirschkaefer.de>

Handle dependencies of chroot scriptlets

* define the dependencies of the scriptlets
* add the scriptlet dependencies as prerequirements when determining
the set of packages that are required in the chroot


# e6dba4595ce3d2a48d87378d62a5625ad61785b2 30-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add shell function packageEntries()

Given the name suffix for a package and a list of entries, the function
moves the entries to the packaging directory of the respective package.


# 366e7a570c22c3d110927e638e9bd2f365424fdf 30-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add fixDevelopLibDirReferences() shell function

* It replaces $libDir by $developLibDir in the given files.
* Use it in prepareInstalledDevelLib() to fix *.la files.


# 0868e7c47a61a63d2ab6b2c105e06ffeeb5a1902 29-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Make prepareInstalledDevelLib[s] more flexible

Rename prepareInstalledDevelLibsHelper to prepareInstalledDevelLib and
allow two optional parameters, the glob patterns for the libraries.
This allows the function to be used for libraries with non-standard
naming.


# 56a0cb53b034d8665648231f8d30e432f448de71 26-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add optional recipe phase PATCH

* ConfigParser does now determine which phases are defined in the
recipe.
* Port.patchSource():
- Call the recipe's PATCH(), if defined.
- If an error occurred applying a patch or calling PATCH() after at
least one patch has already been applied, clear the
checkout/unpack flags.


# 9533550e39e84bd6ac43262d377b1dd536dec360 25-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add fixPkgconfig() shell function

To be invoked at the end of the installation. It moves the pkgconfig
directory from lib/ to develop/lib and fixes the libdir and includedir
variables in the *.pc files.


# 39f073878aeed6a593ffc1030c0222f4fb388c87 25-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

prepareInstalledDevelLibsHelper(): Use pre-existing variables


# 93ae3cb9803fff412ea4762888a9a07b7d1b698e 24-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add prepareInstalledDevelLibs utility function for recipes

To be called at the end of the install phase. Given a list of basenames
of libraries, the function moves the respective library files and
symlinks that shouldn't be in lib/ to develop/lib/ and creates
additionally required symlinks there.


# 503333a1e92300672df499f36832bd952f8f75dc 24-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add shell function runConfigure() that can be used in recipes

"runConfigure ./configure" is equivalent to
"./configure $configureDirArgs". The function supports an option
"--omit-dirs <dirs>" which allows to omit directories from
$configureDirArgs thus making it easier to invoke older configure
scripts. Theoretically the function could be made more intelligent,
running the configure script with "--help" to determine which options
are actually supported. Maybe some other day...


# cb96a4a89ef6eef29f770ba268d4e28de44bb753 22-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Bind-mount the port directory into the chroot

This allows the BUILD() and INSTALL() recipe functions to access
additional files. E.g. in case of Vision there's a settings file
that shall be included in the package.


# 8b8deb25f42364986dd8410a19a6f8b121005181 21-Apr-2013 Oliver Tappe <zooey@hirschkaefer.de>

Improve cleanup of work directory in case of success.


# df75ebb7e7074e47c811442973afefed0360521d 15-Apr-2013 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring: rip haikuporter apart into separate modules