[haikuports] Re: Recipes that depend on themselves

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haikuports@xxxxxxxxxxxxx
  • Date: Sat, 01 Aug 2015 18:52:01 +0200

On 08/01/2015 02:42 PM, gus knight wrote:

On Sat, Aug 1, 2015 at 2:53 AM, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
Building OpenJDK requires a java compiler, so bootstrapping requires either
some cross-compilation or a java compiler that isn't java based (e.g. gcj).
I don't known what method Hamish used. At any rate, once you have a working
OpenJDK, it is easiest to do further builds using a pre-existing OpenJDK
package.

I'd prefer if we use the "java compiler that isn't java based" method.

AFAIK, that isn't entirely trivial. I'm not even sure that there is any such open source compiler that can still build the current OpenJDK. Maybe Hamish can provide better info.

As for the self-dependency, apparently the (1.8) recipe lists openjdk as
BUILD_REQUIRES. I believe it really should be a BUILD_PREREQUIRES. This
should solve your dependency problem (assuming Kitchen's dependency resolver
works as it should). It also shows that a haikuports.cross recipe can (and
should) be created.

Why does it make any difference if it's in PREREQIRES vs. REQUIRES?
Isn't the only difference when the package is activated?

No, this is not related to package activation at all. BUILD_REQUIRES must be built from the repository (*). BUILD_PREREQUIRES are (somehow) provided by the build host. For native builds -- where build host system and target system are the same -- that includes building from the repository (it is even preferred) but also just using what is installed on the system, when building is not possible.

In essence the main purpose of BUILD_PREREQUIRES for native builds is to be able to break dependency cycles. OpenJDK is a simple example, gcc is another one. I don't know what the state of haikuporter's dependency resolver is and whether it actually does everything correctly.

For cross-builds the distinction is a lot clearer: BUILD_PREREQUIRES contains the stuff (mostly executables) that must run on the build host, while BUILD_REQUIRES contains the stuff (e.g. libraries) for the target. One obviously cannot mix the two.

And no, it
doesn't make a difference to the Kitchen at least, because the Kitchen
doesn't assume it has previous versions of these packages available
for building.

That doesn't make sense, as there are quite a few packages (binutils, gcc,...) that depend on themselves.

CU, Ingo

(*) Unless I'm mistaken fetching the same version of the package via pkgman from an existing package repository instead of building it has been implemented in haikuporter. This is, however, only a convenience shortcut to save time and should be equivalent to actually building the package.

Other related posts: