buildsys and kernel modules (was: Re: Summary from yesterdays fesco meeting)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-02-17 at 16:16 -0500, Dan Williams wrote:

> a) Let packages do whatever the heck they want with their Exclusive,
> Exclude, BuildArch tags, including using %{ix86} as Mike suggests
> b) Have the buildsystem recognize kmod packages somehow (which we have
> to do anyway), then filter kmod packages through a "supported" list of
> sub-arches, including i586, i686, x86_64, ppc, athlon.  There's some
> support for this already in the buildsystem.

+1

Attached is a couple of rough patches I have had in my local working dir
for some time; they add support for passing arbitrary arguments to
builds and makes the build archs configurable in local "make foo"
builds.  plague/mock will need changes too, but I think this could be
useful; it already allows eg. "make i686" in local checkouts to do the
right thing wrt. kmod packages, and plague/mock could probably take
advantage of the buildarchs and buildargs targets:

    $ pwd
    /home/scop/cvs/fedora/extras/lirc-kmod/devel

    $ make buildarchs
    i586 i686 x86_64 ppc

    $ make buildargs ARCH=i686
    --define 'kver 2.6.15-1.1955_FC5' --define 'variants "" smp'

    $ make buildargs ARCH=x86_64
    --define 'kver 2.6.15-1.1955_FC5' --define 'variants ""'

    # etc

The kmod patch obviously needs updating wrt. xen* and possibly other
variants, so it's informational only for now.

One nice "side effect" of this is that it would be applicable to all
packages that need non-default build archs or arguments for whatever
reason, not just kmod-*.
Index: Makefile
===================================================================
RCS file: /cvs/extras/rpms/lirc-kmod/devel/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- Makefile	26 Jan 2006 22:33:54 -0000	1.1
+++ Makefile	18 Feb 2006 13:52:25 -0000
@@ -19,3 +19,11 @@
 endif
 
 include $(MAKEFILE_COMMON)
+
+RPM_BUILDARCHS = i586 i686 x86_64 ppc
+
+RPM_BUILDARGS = --define 'kver 2.6.15-1.1955_FC5'
+RPM_BUILDARGS_i586 = --define 'variants ""'
+RPM_BUILDARGS_i686 = --define 'variants "" smp'
+RPM_BUILDARGS_x86_64 = --define 'variants ""'
+RPM_BUILDARGS_ppc = --define 'variants "" smp'
Index: Makefile.common
===================================================================
RCS file: /cvs/extras/common/Makefile.common,v
retrieving revision 1.35
diff -u -r1.35 Makefile.common
--- Makefile.common	16 Dec 2005 16:57:12 -0000	1.35
+++ Makefile.common	18 Feb 2006 13:52:02 -0000
@@ -33,11 +33,11 @@
 $(error "You can not run this Makefile without having NAME defined")
 endif
 ifndef VERSION
-VERSION := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{VERSION}\n" --specfile $(SPECFILE)| head -1)
+VERSION := $(shell rpm $(RPM_BUILDARGS) $(DIST_DEFINES) -q --qf "%{VERSION}\n" --specfile $(SPECFILE)| head -1)
 endif
 # the release of the package
 ifndef RELEASE
-RELEASE := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{RELEASE}\n" --specfile $(SPECFILE)| head -1)
+RELEASE := $(shell rpm $(RPM_BUILDARGS) $(DIST_DEFINES) -q --qf "%{RELEASE}\n" --specfile $(SPECFILE)| head -1)
 endif
 # this is used in make patch, maybe make clean eventually.
 # would be nicer to autodetermine from the spec file...
@@ -240,7 +240,7 @@
 
 # build for a particular arch
 $(ARCHES) : sources $(TARGETS)
-	$(RPM_WITH_DIRS) --target $@ -ba $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) $(RPM_BUILDARGS_$@) --target $@ -ba $(SPECFILE)
 
 # empty target to force checking of md5sums in FULLSOURCEFILES
 FORCE:
@@ -248,10 +248,10 @@
 # attempt to apply all the patches, optionally only for a particular arch
 ifdef PREPARCH
 prep: sources $(TARGETS)
-	$(RPM_WITH_DIRS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) $(RPM_BUILDARGS_$(PREPARCH)) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
 else
 prep: sources $(TARGETS)
-	$(RPM_WITH_DIRS) --nodeps -bp $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) --nodeps -bp $(SPECFILE)
 endif
 
 # this allows for make prep-i686, make prep-ppc64, etc
@@ -259,13 +259,13 @@
 	$(MAKE) prep PREPARCH=$*
 
 compile: sources $(TARGETS)
-	$(RPM_WITH_DIRS) -bc $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) -bc $(SPECFILE)
 
 compile-short: sources $(TARGETS)
-	$(RPM_WITH_DIRS) --nodeps --short-circuit -bc $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) --nodeps --short-circuit -bc $(SPECFILE)
 
 install-short: sources $(TARGETS)
-	$(RPM_WITH_DIRS) --nodeps --short-circuit -bi $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) --nodeps --short-circuit -bi $(SPECFILE)
 
 CVS_ROOT	:= $(shell if [ -f CVS/Root ] ; then cat CVS/Root ; fi)
 CVS_REPOSITORY	:= $(shell if [ -f CVS/Repository ] ; then cat CVS/Repository ; fi)
@@ -292,7 +292,7 @@
 	echo "Checking arches: $$archs" ; \
 	for arch in $$archs; do \
 	    echo "Checking $$arch..."; \
-	    if ! $(RPM_WITH_DIRS) -bp --target $$arch $(SPECFILE); then \
+	    if ! $(RPM_WITH_DIRS) $(RPM_BUILDARGS) -bp --target $$arch $(SPECFILE); then \
 		echo "*** make prep failed for $$arch"; \
 		exit 1; \
 	    fi; \
@@ -300,11 +300,17 @@
 
 ## use this to build an srpm locally
 srpm: sources $(TARGETS)
-	$(RPM_WITH_DIRS) $(DIST_DEFINES) --nodeps -bs $(SPECFILE)
+	$(RPM_WITH_DIRS) $(RPM_BUILDARGS) $(DIST_DEFINES) --nodeps -bs $(SPECFILE)
 
 verrel:
 	@echo $(NAME)-$(VERSION)-$(RELEASE)
 
+buildarchs:
+	@echo $(RPM_BUILDARCHS)
+
+buildargs:
+	@echo "$(subst ",\",$(RPM_BUILDARGS))" "$(subst ",\",$(RPM_BUILDARGS_$(ARCH)))"
+
 # If you build a new version into the tree, first do "make tag",
 # then "make srpm", then build the package.  
 tag::    $(SPECFILE) $(COMMON_DIR)/branches
@@ -346,7 +352,7 @@
 # mop up, printing out exactly what was mopped.
 clean ::
 	@echo "Running the %clean script of the rpmbuild..."
-	-@$(RPM_WITH_DIRS) --clean --nodeps $(SPECFILE)
+	-@$(RPM_WITH_DIRS) $(RPM_BUILDARGS) --clean --nodeps $(SPECFILE)
 	@for F in $(FULLSOURCEFILES); do \
                 if test -e $$F ; then \
                         echo "Deleting $$F" ; /bin/rm -f $$F ; \
-- 
fedora-extras-list mailing list
fedora-extras-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-extras-list

[Index of Archives]     [Fedora General Discussion]     [Fedora Art]     [Fedora Docs]     [Fedora Package Review]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite Backpacking]     [KDE Users]

  Powered by Linux