All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
@ 2009-10-25 21:40 Thomas Petazzoni
  2009-10-25 23:51 ` Lionel Landwerlin
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2009-10-25 21:40 UTC (permalink / raw)
  To: buildroot

Hello,

I'm currently working on improving the package infrastructure for
Buildroot. Basically, the idea is to :

 1. Generalize the Makefile.autotools.in infrastructure into something
    that can be used for any type of package (not limited to packages
    built using autotools). The advantages over the current
    situation are mainly :

     * Several steps can be automated: download, extraction, patch, etc.
     * The infrastructure would hide the gory details of the stamp
       files, ensuring a more coherent handling of the build process
       throughout our package set
     * The ability to easily add pre/post operations at the various
       steps (configure, compile, install, etc.)

    Of course, this infrastructure would still let the package .mk file
    do a lot of things : specify how the package must be configured,
    built and installed.

 2. Rework the Makefile.autotools.in infrastructure so that it inherits
    from the generic package infrastructure.

I've already started prototyping a solution, but I'm facing a choice on
which I'd like to have the community opinion. Usually, I don't like
talking without showing patches, but as this choice is fairly intrusive
in the design of the new infrastructure, I don't want to start the
wrong way.

The choice is on how the individual packages .mk files should specify
the operations that must be performed at the configure, build and
install steps. We have two choices :

 1. Use make variables, such as :

======================================================================
define ICU_CONFIGURE
 $(TARGET_CONFIGURE_OPTS) \
 $(TARGET_CONFIGURE_ARGS) \
 $(TARGET_CONFIGURE_ENV) \
 ./configure \
                --target=$(GNU_TARGET_NAME) \
                --host=$(GNU_TARGET_NAME) \
                --build=$(GNU_HOST_NAME) \
                --prefix=/usr \
                --mandir=/usr/man \
                --infodir=/usr/info \
                --enable-samples
endef

define ICU_COMPILE
 make -C $(@D)/$(ICU_SUBDIR)
endef

$(eval $(call PKGTARGETS,package,icu,target))
======================================================================

    These variables are defined *before* the call to $(eval
    $(call ...)). I find this approach fairly clean. This approach
    also allows to add several hooks as a Pre/Post operation by doing
    something like : 

======================================================================
define MYPKG_PRE_CONFIGURE_DO_THIS
 foobar
endef

MYPKG_PRE_CONFIGURE_HOOKS += MYPKG_PRE_CONFIGURE_DO_THIS
======================================================================

    This approach is the one used by OpenWRT. The only drawback of this
    approach is that since the variables are defined *before* calling
    the generating function $(eval $(call ...)), we don't have access
    to any variable that could be defined by the generating function.
    So, for example, the ICU_COMPILE variable must use
    $(@D)/$(ICU_SUBDIR) as the directory for the sources, instead of
    something like $(ICU_SRCDIR) that could be defined by the package
    infrastructure. In OpenWRT, they solved this problem by having a
    "include package.mk" after the package definition (name, version,
    URL, etc.), but before the definition of the different steps. But
    in our case, this means having two $(eval $(call ...)).

 2. Use make targets, as we do today for the hooks. The make targets
    must be defined *after* the call to $(eval $(call ...)). For zlib,
    it would look like :

======================================================================
$(eval $(call PKGTARGETS,package,zlib,target))

$(ZLIB_TARGET_CONFIGURE):
        (cd $(PKGSRCDIR); rm -rf config.cache; \
                $(TARGET_CONFIGURE_ARGS) \
                $(TARGET_CONFIGURE_OPTS) \
                CFLAGS="$(TARGET_CFLAGS) $(ZLIB_PIC)" \
                ./configure \
                $(ZLIB_SHARED) \
                --prefix=/usr \
                --exec-prefix=$(STAGING_DIR)/usr/bin \
                --libdir=$(STAGING_DIR)/usr/lib \
                --includedir=$(STAGING_DIR)/usr/include \
        )
        touch $@

$(ZLIB_TARGET_BUILD):
        $(MAKE) -C $(PKGSRCDIR) all libz.a
        touch $@
======================================================================

    The advantage is that the package infrastructure can pass variables
    to these make targets (here PKGSRCDIR). However, the package
    infrastructure is much harder to write, we cannot have several
    hooks registered for the same Pre/Post operation (which makes the
    inheritance of the autotools infrastructure more difficult), and I
    find it strange to have some definitions *before* the $(eval
    $(call ...)) and some others *after*.

Thanks for your input,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-25 21:40 [Buildroot] [RFC] Package infrastructure: make variables or make targets ? Thomas Petazzoni
@ 2009-10-25 23:51 ` Lionel Landwerlin
  2009-10-26  8:35   ` Thomas Petazzoni
  2009-10-27  8:06 ` Thomas Petazzoni
  2009-10-29 15:42 ` Thomas Petazzoni
  2 siblings, 1 reply; 15+ messages in thread
From: Lionel Landwerlin @ 2009-10-25 23:51 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

Le dimanche 25 octobre 2009 ? 22:40 +0100, Thomas Petazzoni a ?crit :
> Hello,
> 
> I'm currently working on improving the package infrastructure for
> Buildroot. Basically, the idea is to :
> 
>  1. Generalize the Makefile.autotools.in infrastructure into something
>     that can be used for any type of package (not limited to packages
>     built using autotools). The advantages over the current
>     situation are mainly :
> 
>      * Several steps can be automated: download, extraction, patch, etc.
>      * The infrastructure would hide the gory details of the stamp
>        files, ensuring a more coherent handling of the build process
>        throughout our package set
>      * The ability to easily add pre/post operations at the various
>        steps (configure, compile, install, etc.)
> 
>     Of course, this infrastructure would still let the package .mk file
>     do a lot of things : specify how the package must be configured,
>     built and installed.
> 
>  2. Rework the Makefile.autotools.in infrastructure so that it inherits
>     from the generic package infrastructure.
> 
> I've already started prototyping a solution, but I'm facing a choice on
> which I'd like to have the community opinion. Usually, I don't like
> talking without showing patches, but as this choice is fairly intrusive
> in the design of the new infrastructure, I don't want to start the
> wrong way.
> 
> The choice is on how the individual packages .mk files should specify
> the operations that must be performed at the configure, build and
> install steps. We have two choices :
> 
>  1. Use make variables, such as :
> 
> ======================================================================
> define ICU_CONFIGURE
>  $(TARGET_CONFIGURE_OPTS) \
>  $(TARGET_CONFIGURE_ARGS) \
>  $(TARGET_CONFIGURE_ENV) \
>  ./configure \
>                 --target=$(GNU_TARGET_NAME) \
>                 --host=$(GNU_TARGET_NAME) \
>                 --build=$(GNU_HOST_NAME) \
>                 --prefix=/usr \
>                 --mandir=/usr/man \
>                 --infodir=/usr/info \
>                 --enable-samples
> endef
> 
> define ICU_COMPILE
>  make -C $(@D)/$(ICU_SUBDIR)
> endef
> 
> $(eval $(call PKGTARGETS,package,icu,target))

I like this first approach.

> ======================================================================
> 
>     These variables are defined *before* the call to $(eval
>     $(call ...)). I find this approach fairly clean. This approach
>     also allows to add several hooks as a Pre/Post operation by doing
>     something like : 
> 
> ======================================================================
> define MYPKG_PRE_CONFIGURE_DO_THIS
>  foobar
> endef
> 
> MYPKG_PRE_CONFIGURE_HOOKS += MYPKG_PRE_CONFIGURE_DO_THIS

I like it less.

Why not defining entry points like thoses :

$PACKAGE_PRE_CONFIGURE
$PACKAGE_POST_CONFIGURE
$PACKAGE_PRE_COMPILE
$PACKAGE_POST_COMPILE
etc...

And we just do something like this in the Makefile.in :

$(1) => package name

$(BR_OUTPUT)/build/$(1)-$($(1)_VERSION)/.stamp_configured:
ifdef $(1)_PRE_CONFIGURE
	$($(1)_PRE_CONFIGURE)
endif
ifdef $(1)_CONFIGURE
	$($(1)_CONFIGURE)
else
	# Do default stuff...
endef
ifdef $(1)_POST_CONFIGURE
	$($(1)_POST_CONFIGURE)
endif

So the package doesn't have to manipulate variables like
MYPKG_PRE_CONFIGURE_HOOKS, it just defines its entry points.

> ======================================================================
> 
>     This approach is the one used by OpenWRT. The only drawback of this
>     approach is that since the variables are defined *before* calling
>     the generating function $(eval $(call ...)), we don't have access
>     to any variable that could be defined by the generating function.
>     So, for example, the ICU_COMPILE variable must use
>     $(@D)/$(ICU_SUBDIR) as the directory for the sources, instead of
>     something like $(ICU_SRCDIR) that could be defined by the package
>     infrastructure. In OpenWRT, they solved this problem by having a
>     "include package.mk" after the package definition (name, version,
>     URL, etc.), but before the definition of the different steps. But
>     in our case, this means having two $(eval $(call ...)).

Could we split the package's makefile in two parts ?

One defining data stuff like package version, source, site, etc...
Then we call something like that :

$(eval $(call PKGDATA,package,mypkg))

That defines all paths we need etc...

And them we describe the actions we want to be triggered at each step of
the build process, just like you described before.

Finally we call the rule evaluation defining actions with all the stamp
files stuff.

> 
>  2. Use make targets, as we do today for the hooks. The make targets
>     must be defined *after* the call to $(eval $(call ...)). For zlib,
>     it would look like :
> 
> ======================================================================
> $(eval $(call PKGTARGETS,package,zlib,target))
> 
> $(ZLIB_TARGET_CONFIGURE):
>         (cd $(PKGSRCDIR); rm -rf config.cache; \
>                 $(TARGET_CONFIGURE_ARGS) \
>                 $(TARGET_CONFIGURE_OPTS) \
>                 CFLAGS="$(TARGET_CFLAGS) $(ZLIB_PIC)" \
>                 ./configure \
>                 $(ZLIB_SHARED) \
>                 --prefix=/usr \
>                 --exec-prefix=$(STAGING_DIR)/usr/bin \
>                 --libdir=$(STAGING_DIR)/usr/lib \
>                 --includedir=$(STAGING_DIR)/usr/include \
>         )
>         touch $@
> 
> $(ZLIB_TARGET_BUILD):
>         $(MAKE) -C $(PKGSRCDIR) all libz.a
>         touch $@
> ======================================================================
> 
>     The advantage is that the package infrastructure can pass variables
>     to these make targets (here PKGSRCDIR). However, the package
>     infrastructure is much harder to write, we cannot have several
>     hooks registered for the same Pre/Post operation (which makes the
>     inheritance of the autotools infrastructure more difficult), and I
>     find it strange to have some definitions *before* the $(eval
>     $(call ...)) and some others *after*.
> 
> Thanks for your input,
> 
> Thomas

Regards,

-- 
Lionel Landwerlin <llandwerlin@gmail.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-25 23:51 ` Lionel Landwerlin
@ 2009-10-26  8:35   ` Thomas Petazzoni
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2009-10-26  8:35 UTC (permalink / raw)
  To: buildroot

Hi Lionel,

Thanks for your input!

Le Mon, 26 Oct 2009 00:51:42 +0100,
Lionel Landwerlin <llandwerlin@gmail.com> a ?crit :

> > ======================================================================
> > define MYPKG_PRE_CONFIGURE_DO_THIS
> >  foobar
> > endef
> > 
> > MYPKG_PRE_CONFIGURE_HOOKS += MYPKG_PRE_CONFIGURE_DO_THIS
> 
> I like it less.
> 
> Why not defining entry points like thoses :
> 
> $PACKAGE_PRE_CONFIGURE
> $PACKAGE_POST_CONFIGURE
> $PACKAGE_PRE_COMPILE
> $PACKAGE_POST_COMPILE
> etc...
> 
> And we just do something like this in the Makefile.in :
> 
> $(1) => package name
> 
> $(BR_OUTPUT)/build/$(1)-$($(1)_VERSION)/.stamp_configured:
> ifdef $(1)_PRE_CONFIGURE
> 	$($(1)_PRE_CONFIGURE)
> endif
> ifdef $(1)_CONFIGURE
> 	$($(1)_CONFIGURE)
> else
> 	# Do default stuff...
> endef
> ifdef $(1)_POST_CONFIGURE
> 	$($(1)_POST_CONFIGURE)
> endif
> 
> So the package doesn't have to manipulate variables like
> MYPKG_PRE_CONFIGURE_HOOKS, it just defines its entry points.

Because this allows to have only one hook registered for each hook
location. And this is not enough with the inheritance of
Makefile.autotools.in from the generic package infrastructure.

The generic package infrastructure will define steps for :

 * download, implemented in a generic way
 * extract, implemented in a generic way
 * patch, implemented in a generic way
 * configure, calling a package specific definition
 * build, calling a package specific definition
 * install to target/staging/host, calling a package specific definition

With pre/post hooks mechanism before and after all these steps.

The Makefile.autotools.in infrastructure will plug into the generic one
by at least :

 * defining what configure, build, install to target/staging/host do
 * defining a post-patch hook to autoreconf if necessary, patch libtool
   if necessary

Then, if the package specific makefile using the autotools
infrastructure wants to define a post-patch hook, it cannot since, the
?slot? is already used by the generic infrastructure.

Therefore, I was thinking of a mechanism similar to OpenWRT, where the
hooks variables are list of variables names that in turn contain what
to do.

See for example
https://dev.openwrt.org/browser/trunk/include/autotools.mk (the end).

> Could we split the package's makefile in two parts ?
> 
> One defining data stuff like package version, source, site, etc...
> Then we call something like that :
> 
> $(eval $(call PKGDATA,package,mypkg))
> 
> That defines all paths we need etc...
> 
> And them we describe the actions we want to be triggered at each step
> of the build process, just like you described before.
> 
> Finally we call the rule evaluation defining actions with all the
> stamp files stuff.

Yes, we could. However, for the moment, the only variable I have in
mind is this package source code directory.

Would look like something like this:

=============================================================================
ICU_VERSION:=4c-3_8_1
ICU_SOURCE:=icu$(ICU_VERSION)-src.tgz
ICU_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/icu
ICU_DEPENDENCIES:=host-icu
ICU_SUBDIR:=source

HOST_ICU_VERSION:=$(ICU_VERSION)
HOST_ICU_SOURCE:=$(ICU_SOURCE)
HOST_ICU_SITE:=$(ICU_SITE)
HOST_ICU_SUBDIR:=source

$(eval $(call pkgdefinitions,package,icu,target))
$(eval $(call pkgdefinitions,package,icu,host))

define HOST_ICU_CONFIGURE
 $(HOST_CONFIGURE_OPTS) \
 $(HOST_CONFIGURE_ARGS) \
 $(HOST_CONFIGURE_ENV)  \
 ./configure --prefix=/usr
endef

define HOST_ICU_COMPILE
 make -C $(ICU_SRCDIR) # this variable was defined by pkgdefinitions above
endef

define HOST_ICU_INSTALL
 make -C $(ICU_SRCDIR) DESTDIR=$(HOST_DIR) install
endef

define ICU_CONFIGURE
 $(TARGET_CONFIGURE_OPTS) \
 $(TARGET_CONFIGURE_ARGS) \
 $(TARGET_CONFIGURE_ENV) \
 ./configure \
                --target=$(GNU_TARGET_NAME) \
                --host=$(GNU_TARGET_NAME) \
                --build=$(GNU_HOST_NAME) \
                --prefix=/usr \
                --mandir=/usr/man \
                --infodir=/usr/info \
                --enable-samples
endef

define ICU_COMPILE
 make -C $(ICU_SRCDIR)
endef

$(eval $(call pkgrules,package,icu,target))
$(eval $(call pkgrules,package,icu,host))
=============================================================================

Note 1: ICU is a fairly bad example since it should be converted to
Makefile.autotools.in, but since it is not converted yet, I've used it
as an example during my prototyping.

Note 2: I'd like HOST_ICU_VERSION, HOST_ICU_SOURCE, HOST_ICU_SITE and
HOST_ICU_SUBDIR default to ICU_VERSION, ICU_SOURCE, ICU_SITE and
ICU_SUBDIR so that they aren't duplicated, but this isn't implemented
in my prototype yet.

So, in the end, I understand you prefer the "make variables" way over
the "make targets" way. Am I correct ?

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-25 21:40 [Buildroot] [RFC] Package infrastructure: make variables or make targets ? Thomas Petazzoni
  2009-10-25 23:51 ` Lionel Landwerlin
@ 2009-10-27  8:06 ` Thomas Petazzoni
  2009-10-29 15:39   ` Thomas Petazzoni
  2009-11-01 21:26   ` Lionel Landwerlin
  2009-10-29 15:42 ` Thomas Petazzoni
  2 siblings, 2 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2009-10-27  8:06 UTC (permalink / raw)
  To: buildroot

Hello,

Le Sun, 25 Oct 2009 22:40:56 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

> I've already started prototyping a solution, but I'm facing a choice
> on which I'd like to have the community opinion. Usually, I don't like
> talking without showing patches, but as this choice is fairly
> intrusive in the design of the new infrastructure, I don't want to
> start the wrong way.

I've pushed a set of commits to
http://git.buildroot.net/~tpetazzoni/git/buildroot/log/?h=package-infrastructure
which shows the current status of my work. Warning: it is currently in
an ugly state: documentation not updated, the generic package
infrastructure still contains some autotools-specific stuff, the
autotools infrastructure ported over the generic infrastructure does
not work yet.

But it still allows you to see how the .mk files look like for three
examples : icu, zlib and olsr (randomly choosen).

Please do not pull this branch anywhere except for experimentations, as
I will rebase it heavily.

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-27  8:06 ` Thomas Petazzoni
@ 2009-10-29 15:39   ` Thomas Petazzoni
  2009-10-29 17:11     ` H Hartley Sweeten
                       ` (2 more replies)
  2009-11-01 21:26   ` Lionel Landwerlin
  1 sibling, 3 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2009-10-29 15:39 UTC (permalink / raw)
  To: buildroot

Hello,

Le Tue, 27 Oct 2009 09:06:28 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

> > I've already started prototyping a solution, but I'm facing a choice
> > on which I'd like to have the community opinion. Usually, I don't
> > like talking without showing patches, but as this choice is fairly
> > intrusive in the design of the new infrastructure, I don't want to
> > start the wrong way.
> 
> I've pushed a set of commits to
> http://git.buildroot.net/~tpetazzoni/git/buildroot/log/?h=package-infrastructure
> which shows the current status of my work. Warning: it is currently in
> an ugly state: documentation not updated, the generic package
> infrastructure still contains some autotools-specific stuff, the
> autotools infrastructure ported over the generic infrastructure does
> not work yet.
> 
> But it still allows you to see how the .mk files look like for three
> examples : icu, zlib and olsr (randomly choosen).

I've pushed more changes. Since my previous e-mails, the changes are
the following :

 * Improved the autotools infrastructure on top of the new generic
   package infrastructure. It now works for at least the few packages
   I've tested ;

 * Improved the generic infrastructure to support registration of
   multiple hooks. The old hook mechanism is also kept for backward
   compatibility, but if we agree on the new hook mechanism, I'd like
   to slowly get rid of the old one ;

 * The pkg-config for host build has been rewritten on top of the new
   autotools infrastructure. Much simpler. But packages must now depend
   on host-pkg-config instead of host-pkgconfig (a commit in my branch
   updates all packages) ;

 * directfb + directfb-examples build properly, which means that
   pkg-config for host, libpng, libts, zlib, freetype, jpeg, directfb
   and directfb-examples do work on top of the new infrastructure ;

 * I've added a crappy package statistics script, which tries to guess
   which package should be converted to autotools, to the new
   infrastructure, both for target and host.

A lot more work remains:

 * Cleanup
 * Documentation
 * Testing

I have one naming issue in the generic package infrastructure
(package/Makefile.package.in) on which I'd like to get your input. The
generic package infrastructure let the package specific .mk file
specify what the configure, build and install steps should do, by
defining variables :

 <PKG>_CONFIGURE for configure
 <PKG>_BUILD for build

for installation, I wanted to use

 <PKG>_INSTALL_STAGING for staging installation
 <PKG>_INSTALL_TARGET for target installation

but these variables are already existing boolean variables (YES/NO)
that allows the package to specify whether it wants TARGET installation
and/or STAGING installation. So we have a naming conflict, that I
solved by using

 <PKG>_INSTALL_STAGING_CMDS
 <PKG>_INSTALL_TARGET_CMDS

for the variables that a package specific .mk must define to list the
operations to be performed at staging install and target install. But I
don't like this naming since it isn't coherent with <PKG>_CONFIGURE and
<PKG>_BUILD.

Any suggestion ?

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-25 21:40 [Buildroot] [RFC] Package infrastructure: make variables or make targets ? Thomas Petazzoni
  2009-10-25 23:51 ` Lionel Landwerlin
  2009-10-27  8:06 ` Thomas Petazzoni
@ 2009-10-29 15:42 ` Thomas Petazzoni
  2 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2009-10-29 15:42 UTC (permalink / raw)
  To: buildroot

Hello,

Le Sun, 25 Oct 2009 22:40:56 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

>  1. Use make variables, such as :

FWIW, since only Lionel gave his opinion and because as him I was more
convinced by make variables, I followed this path.

>     This approach is the one used by OpenWRT. The only drawback of
> this approach is that since the variables are defined *before* calling
>     the generating function $(eval $(call ...)), we don't have access
>     to any variable that could be defined by the generating function.
>     So, for example, the ICU_COMPILE variable must use
>     $(@D)/$(ICU_SUBDIR) as the directory for the sources, instead of
>     something like $(ICU_SRCDIR) that could be defined by the package
>     infrastructure. In OpenWRT, they solved this problem by having a
>     "include package.mk" after the package definition (name, version,
>     URL, etc.), but before the definition of the different steps. But
>     in our case, this means having two $(eval $(call ...)).

In fact this is not true. By escaping the variable expansions, it is
possible to post-pone the moment at which variables are expanded.

If you do :

======================================================================
define PKG_COMPILE
 make -C $($(PKG)_SRCDIR)
endef

$(eval $(call PKGTARGETS,package,foo,target))
======================================================================

Then it doesn't work since $(PKG)_SRCDIR is defined while evaluating
PKGTARGETS. But if you do:

======================================================================
define PKG_COMPILE
 make -C $$($$(PKG)_SRCDIR)
endef

$(eval $(call PKGTARGETS,package,foo,target))
======================================================================

Then things work as expected. Therefore, I've solved what I thought to
be the main drawback of the "make variables" solution, which is also
why I've choosen to go deeper into this direction.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-29 15:39   ` Thomas Petazzoni
@ 2009-10-29 17:11     ` H Hartley Sweeten
  2009-10-29 21:01       ` Lionel Landwerlin
  2009-10-29 17:41     ` Will Newton
  2009-11-02 23:24     ` Thomas Petazzoni
  2 siblings, 1 reply; 15+ messages in thread
From: H Hartley Sweeten @ 2009-10-29 17:11 UTC (permalink / raw)
  To: buildroot

On Thursday, October 29, 2009 8:39 AM, Thomas Petazzoni wrote:
> I have one naming issue in the generic package infrastructure
> (package/Makefile.package.in) on which I'd like to get your input. The
> generic package infrastructure let the package specific .mk file
> specify what the configure, build and install steps should do, by
> defining variables :
> 
>  <PKG>_CONFIGURE for configure
>  <PKG>_BUILD for build
> 
> for installation, I wanted to use
> 
>  <PKG>_INSTALL_STAGING for staging installation
>  <PKG>_INSTALL_TARGET for target installation
> 
> but these variables are already existing boolean variables (YES/NO)
> that allows the package to specify whether it wants TARGET installation
> and/or STAGING installation. So we have a naming conflict, that I
> solved by using
> 
>  <PKG>_INSTALL_STAGING_CMDS
>  <PKG>_INSTALL_TARGET_CMDS
> 
> for the variables that a package specific .mk must define to list the
> operations to be performed at staging install and target install. But I
> don't like this naming since it isn't coherent with <PKG>_CONFIGURE and
> <PKG>_BUILD.
> 
> Any suggestion ?

How about changing the boolean variables to:

<PKG>_STAGING_INSTALL to indicate a STAGING installation is wanted
<PKG>_TARGET_INSTALL to indicate a TARGET installation is wanted

Then you can use:

<PKG>_INSTALL_STAGING for staging installation
<PKG>_INSTALL_TARGET for target installation

Regards,
Hartley

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-29 15:39   ` Thomas Petazzoni
  2009-10-29 17:11     ` H Hartley Sweeten
@ 2009-10-29 17:41     ` Will Newton
  2009-11-02 23:24     ` Thomas Petazzoni
  2 siblings, 0 replies; 15+ messages in thread
From: Will Newton @ 2009-10-29 17:41 UTC (permalink / raw)
  To: buildroot

On Thu, Oct 29, 2009 at 3:39 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> Le Tue, 27 Oct 2009 09:06:28 +0100,
> Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
>
>> > I've already started prototyping a solution, but I'm facing a choice
>> > on which I'd like to have the community opinion. Usually, I don't
>> > like talking without showing patches, but as this choice is fairly
>> > intrusive in the design of the new infrastructure, I don't want to
>> > start the wrong way.
>>
>> I've pushed a set of commits to
>> http://git.buildroot.net/~tpetazzoni/git/buildroot/log/?h=package-infrastructure
>> which shows the current status of my work. Warning: it is currently in
>> an ugly state: documentation not updated, the generic package
>> infrastructure still contains some autotools-specific stuff, the
>> autotools infrastructure ported over the generic infrastructure does
>> not work yet.
>>
>> But it still allows you to see how the .mk files look like for three
>> examples : icu, zlib and olsr (randomly choosen).
>
> I've pushed more changes. Since my previous e-mails, the changes are
> the following :
>
> ?* Improved the autotools infrastructure on top of the new generic
> ? package infrastructure. It now works for at least the few packages
> ? I've tested ;
>
> ?* Improved the generic infrastructure to support registration of
> ? multiple hooks. The old hook mechanism is also kept for backward
> ? compatibility, but if we agree on the new hook mechanism, I'd like
> ? to slowly get rid of the old one ;
>
> ?* The pkg-config for host build has been rewritten on top of the new
> ? autotools infrastructure. Much simpler. But packages must now depend
> ? on host-pkg-config instead of host-pkgconfig (a commit in my branch
> ? updates all packages) ;
>
> ?* directfb + directfb-examples build properly, which means that
> ? pkg-config for host, libpng, libts, zlib, freetype, jpeg, directfb
> ? and directfb-examples do work on top of the new infrastructure ;
>
> ?* I've added a crappy package statistics script, which tries to guess
> ? which package should be converted to autotools, to the new
> ? infrastructure, both for target and host.
>
> A lot more work remains:
>
> ?* Cleanup
> ?* Documentation
> ?* Testing
>
> I have one naming issue in the generic package infrastructure
> (package/Makefile.package.in) on which I'd like to get your input. The
> generic package infrastructure let the package specific .mk file
> specify what the configure, build and install steps should do, by
> defining variables :
>
> ?<PKG>_CONFIGURE for configure
> ?<PKG>_BUILD for build
>
> for installation, I wanted to use
>
> ?<PKG>_INSTALL_STAGING for staging installation
> ?<PKG>_INSTALL_TARGET for target installation
>
> but these variables are already existing boolean variables (YES/NO)
> that allows the package to specify whether it wants TARGET installation
> and/or STAGING installation. So we have a naming conflict, that I
> solved by using
>
> ?<PKG>_INSTALL_STAGING_CMDS
> ?<PKG>_INSTALL_TARGET_CMDS
>
> for the variables that a package specific .mk must define to list the
> operations to be performed at staging install and target install. But I
> don't like this naming since it isn't coherent with <PKG>_CONFIGURE and
> <PKG>_BUILD.
>
> Any suggestion ?

Hi Thomas,

This stuff looks really good, it seems to reduce the lines of code in
each Makefile which is definitely a good sign.

Perhaps all the targets should have a _CMDS suffix to distinguish them
from other types of variables?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-29 17:11     ` H Hartley Sweeten
@ 2009-10-29 21:01       ` Lionel Landwerlin
  0 siblings, 0 replies; 15+ messages in thread
From: Lionel Landwerlin @ 2009-10-29 21:01 UTC (permalink / raw)
  To: buildroot

Le jeudi 29 octobre 2009 ? 13:11 -0400, H Hartley Sweeten a ?crit :
> On Thursday, October 29, 2009 8:39 AM, Thomas Petazzoni wrote:
> > I have one naming issue in the generic package infrastructure
> > (package/Makefile.package.in) on which I'd like to get your input. The
> > generic package infrastructure let the package specific .mk file
> > specify what the configure, build and install steps should do, by
> > defining variables :
> > 
> >  <PKG>_CONFIGURE for configure
> >  <PKG>_BUILD for build
> > 
> > for installation, I wanted to use
> > 
> >  <PKG>_INSTALL_STAGING for staging installation
> >  <PKG>_INSTALL_TARGET for target installation
> > 
> > but these variables are already existing boolean variables (YES/NO)
> > that allows the package to specify whether it wants TARGET installation
> > and/or STAGING installation. So we have a naming conflict, that I
> > solved by using
> > 
> >  <PKG>_INSTALL_STAGING_CMDS
> >  <PKG>_INSTALL_TARGET_CMDS
> > 
> > for the variables that a package specific .mk must define to list the
> > operations to be performed at staging install and target install. But I
> > don't like this naming since it isn't coherent with <PKG>_CONFIGURE and
> > <PKG>_BUILD.
> > 
> > Any suggestion ?
> 
> How about changing the boolean variables to:
> 
> <PKG>_STAGING_INSTALL to indicate a STAGING installation is wanted
> <PKG>_TARGET_INSTALL to indicate a TARGET installation is wanted
> 
> Then you can use:
> 
> <PKG>_INSTALL_STAGING for staging installation
> <PKG>_INSTALL_TARGET for target installation

Sound confusing...

I would rather prefer <PKG>_INSTALL_TARGET or <PKG>_HAS_INSTALL_TARGET.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-27  8:06 ` Thomas Petazzoni
  2009-10-29 15:39   ` Thomas Petazzoni
@ 2009-11-01 21:26   ` Lionel Landwerlin
  2009-11-03  8:14     ` Thomas Petazzoni
  1 sibling, 1 reply; 15+ messages in thread
From: Lionel Landwerlin @ 2009-11-01 21:26 UTC (permalink / raw)
  To: buildroot

Le mardi 27 octobre 2009 ? 09:06 +0100, Thomas Petazzoni a ?crit :
> Hello,
> 
> Le Sun, 25 Oct 2009 22:40:56 +0100,
> Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> I've pushed a set of commits to
> http://git.buildroot.net/~tpetazzoni/git/buildroot/log/?h=package-infrastructure
> which shows the current status of my work. Warning: it is currently in
> an ugly state: documentation not updated, the generic package
> infrastructure still contains some autotools-specific stuff, the
> autotools infrastructure ported over the generic infrastructure does
> not work yet.
> 
> But it still allows you to see how the .mk files look like for three
> examples : icu, zlib and olsr (randomly choosen).
> 
> Please do not pull this branch anywhere except for experimentations, as
> I will rebase it heavily.
> 
> Sincerly,

Hi Thomas,

First thanks for your work. I like it much, it makes package's makefiles
a lot more clean.

I have little question about the autotool stuff. I seen that the
patching and the autoreconf steps has been merged together. Is it
because you did not finish yet or do you plan keep it like that ?

I'm asking that because I'm using buildroot more as a development tool
than a rootfs generation tool. I try to work upstream with packages I'm
hacking on. A few days ago I sent a patch to allow to retrigger some
part of the build process on a particular package
(http://lists.busybox.net/pipermail/buildroot/2009-October/030104.html).
It currently only work with "autotooled" packages, but with you ongoing
work it will be easier to provide that feature on all packages.

So to me, it is important to separate the patching from the
autoreconfiguring part, because when adding new source files to an
autotooled package there is a need to regenerate the Makefile.in files
without repatching.

Regards,

-- 
Lionel Landwerlin <llandwerlin@gmail.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-10-29 15:39   ` Thomas Petazzoni
  2009-10-29 17:11     ` H Hartley Sweeten
  2009-10-29 17:41     ` Will Newton
@ 2009-11-02 23:24     ` Thomas Petazzoni
  2009-11-03  1:14       ` Lionel Landwerlin
  2 siblings, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2009-11-02 23:24 UTC (permalink / raw)
  To: buildroot

Le Thu, 29 Oct 2009 16:39:16 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

> I've pushed more changes. Since my previous e-mails, the changes are
> the following :

I've pushed even more changes. Mostly conversion of packages to the new
autotargets host infrastructure, which simplifies a lot of existing
makefiles.

See
http://git.buildroot.net/~tpetazzoni/git/buildroot/log/?h=package-infrastructure
for details.

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-11-02 23:24     ` Thomas Petazzoni
@ 2009-11-03  1:14       ` Lionel Landwerlin
  2009-11-03  8:15         ` Thomas Petazzoni
  0 siblings, 1 reply; 15+ messages in thread
From: Lionel Landwerlin @ 2009-11-03  1:14 UTC (permalink / raw)
  To: buildroot

test ?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-11-01 21:26   ` Lionel Landwerlin
@ 2009-11-03  8:14     ` Thomas Petazzoni
  2009-11-03 14:01       ` Lionel Landwerlin
  0 siblings, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2009-11-03  8:14 UTC (permalink / raw)
  To: buildroot

Hello,

Thanks Lionel for your feedback.

Le Sun, 01 Nov 2009 22:26:58 +0100,
Lionel Landwerlin <llandwerlin@gmail.com> a ?crit :

> First thanks for your work. I like it much, it makes package's
> makefiles a lot more clean.

Thanks :)

> I have little question about the autotool stuff. I seen that the
> patching and the autoreconf steps has been merged together. Is it
> because you did not finish yet or do you plan keep it like that ?

I was planning to keep it like that, but if it's not satisfying, we can
probably find ways to improve it.

The generic package infrastructure, in package/Makefile.package.in [1]
is not supposed to know anything about autotools. Therefore, it
implements a set of generic steps :

 * Download
 * Extract
 * Patch
 * Configure
 * Build
 * Host installation
 * Target installation
 * Staging installation
 * Clean
 * Uninstall

? autoreconf ? is *not* one of these steps because it is autotools
specific.

Then, the package/Makefile.autotools.in [2] ? inherits ? from this
package infrastructure by :

 * Providing a definition for the Configure, Build, Host installation,
   Target installation, Staging installation, Clean and Uninstall
   steps ;

 * Add hooks for autoreconf and libtool patching. The autoreconf hook
   is attached to the $(PKG)_POST_PATCH_HOOKS hook point, and is
   therefore included into the generic ? Patch ? step in terms of stamp
   files and dependencies

Considering this more or less clean separation between generic
infrastructure and autotools infrastructure, I'd like (if possible) to
keep autotools-specific things outside the generic infrastructure.

> I'm asking that because I'm using buildroot more as a development tool
> than a rootfs generation tool. I try to work upstream with packages
> I'm hacking on. A few days ago I sent a patch to allow to retrigger
> some part of the build process on a particular package
> (http://lists.busybox.net/pipermail/buildroot/2009-October/030104.html).
> It currently only work with "autotooled" packages, but with you
> ongoing work it will be easier to provide that feature on all
> packages.
> 
> So to me, it is important to separate the patching from the
> autoreconfiguring part, because when adding new source files to an
> autotooled package there is a need to regenerate the Makefile.in files
> without repatching.

Would attaching the autoreconf hook to a
(not-yet-existing-but-easily-created) $(PKG)_PRE_CONFIGURE_HOOKS hook
point solve the problem ?

Sincerly,

Thomas

[1]
http://git.buildroot.net/~tpetazzoni/git/buildroot/tree/package/Makefile.package.in?h=package-infrastructure

[2]
http://git.buildroot.net/~tpetazzoni/git/buildroot/tree/package/Makefile.autotools.in?h=package-infrastructure
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-11-03  1:14       ` Lionel Landwerlin
@ 2009-11-03  8:15         ` Thomas Petazzoni
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2009-11-03  8:15 UTC (permalink / raw)
  To: buildroot

Le Tue, 03 Nov 2009 02:14:55 +0100,
Lionel Landwerlin <llandwerlin@gmail.com> a ?crit :

> test ?

ACK.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
  2009-11-03  8:14     ` Thomas Petazzoni
@ 2009-11-03 14:01       ` Lionel Landwerlin
  0 siblings, 0 replies; 15+ messages in thread
From: Lionel Landwerlin @ 2009-11-03 14:01 UTC (permalink / raw)
  To: buildroot

Woaa, this mail took more than a day to be delivered...

Le mardi 03 novembre 2009 ? 09:14 +0100, Thomas Petazzoni a ?crit :
> Hello,
> 
> Thanks Lionel for your feedback.
> 
> Le Sun, 01 Nov 2009 22:26:58 +0100,
> Lionel Landwerlin <llandwerlin@gmail.com> a ?crit :
> 
> > First thanks for your work. I like it much, it makes package's
> > makefiles a lot more clean.
> 
> Thanks :)
> 
> > I have little question about the autotool stuff. I seen that the
> > patching and the autoreconf steps has been merged together. Is it
> > because you did not finish yet or do you plan keep it like that ?
> 
> I was planning to keep it like that, but if it's not satisfying, we can
> probably find ways to improve it.
> 
> The generic package infrastructure, in package/Makefile.package.in [1]
> is not supposed to know anything about autotools. Therefore, it
> implements a set of generic steps :
> 
>  * Download
>  * Extract
>  * Patch
>  * Configure
>  * Build
>  * Host installation
>  * Target installation
>  * Staging installation
>  * Clean
>  * Uninstall
> 
> ? autoreconf ? is *not* one of these steps because it is autotools
> specific.
> 
> Then, the package/Makefile.autotools.in [2] ? inherits ? from this
> package infrastructure by :
> 
>  * Providing a definition for the Configure, Build, Host installation,
>    Target installation, Staging installation, Clean and Uninstall
>    steps ;
> 
>  * Add hooks for autoreconf and libtool patching. The autoreconf hook
>    is attached to the $(PKG)_POST_PATCH_HOOKS hook point, and is
>    therefore included into the generic ? Patch ? step in terms of stamp
>    files and dependencies
> 
> Considering this more or less clean separation between generic
> infrastructure and autotools infrastructure, I'd like (if possible) to
> keep autotools-specific things outside the generic infrastructure.
> 
> > I'm asking that because I'm using buildroot more as a development tool
> > than a rootfs generation tool. I try to work upstream with packages
> > I'm hacking on. A few days ago I sent a patch to allow to retrigger
> > some part of the build process on a particular package
> > (http://lists.busybox.net/pipermail/buildroot/2009-October/030104.html).
> > It currently only work with "autotooled" packages, but with you
> > ongoing work it will be easier to provide that feature on all
> > packages.
> > 
> > So to me, it is important to separate the patching from the
> > autoreconfiguring part, because when adding new source files to an
> > autotooled package there is a need to regenerate the Makefile.in files
> > without repatching.
> 
> Would attaching the autoreconf hook to a
> (not-yet-existing-but-easily-created) $(PKG)_PRE_CONFIGURE_HOOKS hook
> point solve the problem ?
> 

The fact you had removed the stamp file for the autoreconf step annoyed
me at first, but in the end I can add a rule that does not prerequise
the stamp files to retrigger the autogen stuff.

Create a PRE_CONFIGURE hook could be better but that's just
trolling... :)

Thanks for the explanation/rebased patches.

-- 
Lionel Landwerlin <llandwerlin@gmail.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-11-03 14:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-25 21:40 [Buildroot] [RFC] Package infrastructure: make variables or make targets ? Thomas Petazzoni
2009-10-25 23:51 ` Lionel Landwerlin
2009-10-26  8:35   ` Thomas Petazzoni
2009-10-27  8:06 ` Thomas Petazzoni
2009-10-29 15:39   ` Thomas Petazzoni
2009-10-29 17:11     ` H Hartley Sweeten
2009-10-29 21:01       ` Lionel Landwerlin
2009-10-29 17:41     ` Will Newton
2009-11-02 23:24     ` Thomas Petazzoni
2009-11-03  1:14       ` Lionel Landwerlin
2009-11-03  8:15         ` Thomas Petazzoni
2009-11-01 21:26   ` Lionel Landwerlin
2009-11-03  8:14     ` Thomas Petazzoni
2009-11-03 14:01       ` Lionel Landwerlin
2009-10-29 15:42 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.