[csw-devel] SF.net SVN: gar:[10118] csw/mgar/pkg/TEMPLATES/createpkg
theferret at users.sourceforge.net
theferret at users.sourceforge.net
Tue Jun 8 03:29:07 CEST 2010
Revision: 10118
http://gar.svn.sourceforge.net/gar/?rev=10118&view=rev
Author: theferret
Date: 2010-06-08 01:29:07 +0000 (Tue, 08 Jun 2010)
Log Message:
-----------
TEMPLATES/createpkg: fairly functional now
Modified Paths:
--------------
csw/mgar/pkg/TEMPLATES/createpkg/Makefile.lib
csw/mgar/pkg/TEMPLATES/createpkg/README
csw/mgar/pkg/TEMPLATES/createpkg/top.Makefile
Modified: csw/mgar/pkg/TEMPLATES/createpkg/Makefile.lib
===================================================================
--- csw/mgar/pkg/TEMPLATES/createpkg/Makefile.lib 2010-06-08 01:27:29 UTC (rev 10117)
+++ csw/mgar/pkg/TEMPLATES/createpkg/Makefile.lib 2010-06-08 01:29:07 UTC (rev 10118)
@@ -2,21 +2,40 @@
# You MUST build this with gnu make, unfortunately.
# Mainly just because of the ARCH expansion, but also for "?="
+
+# If you do NOT want to build 64bit libs, remove the $(ARCH)-64 from
+# the "all:" target.
+
+# If you DO want to, then leave it in, and also customize your
+# the build/.stage-$(ARCH)-64.done target(s),
+# PLUS, customize your prototype file(s) as needed
+# Dont forget to handle any 64bit pkg-config .pc files properly!!
+
# Organization: variable defintions up top,
# targets in second half.
# Note that assignments with "?=" mean "assign if not already assigned.
+# Where do we keep local downloads of software src files
+ARCHIVEDIR ?= /home/src
+ARCHIVENAME ?= FooSoft.1.2.3.tar.gz
+EXTRACTPROG ?= /usr/sfw/bin/gtar zfx
+
+# Only use ONE here. The name is used for compat with 'gar'.
+MASTER_SITES ?= http://xorg.freedesktop.org/releases/X11R7.5/src/lib
+
ARCH := $(shell /bin/uname -p)
LDFLAGS_COMMON :=
SRCDIR= build/*
-# DO NOT specify the arch-blah stuff such as -m64 here.
+# DO NOT specify the arch-64 stuff such as -m64 here.
# the individual targets will do that.
CFLAGS_COMMON ?= -mt -xnorunpath -xO2
CXXFLAGS_COMMON ?= -mt -norunpath -xO2
+CFLAGS_sparc ?= -xarch=v8
+CFLAGS_i386 ?= -xarch=i386
# Keep this arch-neutral if possible. add arch-specific tweaks
# to arch-specific target
@@ -27,33 +46,24 @@
CONFIGURE_64_EXTRAS:= --libdir=/opt/csw/lib/64 $(CONFIGURE_64_$(ARCH))
-test:
- @echo extras = $(CONFIGURE_64_EXTRAS)
-# Where do we keep local downloads of software src files
-ARCHIVEDIR ?= /home/src
-ARCHIVENAME ?= FillThisInHere.tar.foo
-# Only use ONE here. The name is used for compate with 'gar'.
-MASTER_SITES ?= http://www.url.here/download
+CREATEPKG=createpkg -r `pwd`/build/*/cswstage
-all: $(ARCH)-32 clean $(ARCH)-64 package
+all: $(ARCH)-32 build/.stage1 $(ARCH)-64 package
+
# ARCH-XX handles configure, build, and stage for its own combo
#
-EXTRACTPROG=/bin/echo ERROR: UNKNOWN archive type ; exit 1 ;
+EXTRACTPROG ?= /bin/echo ERROR: need to set EXTRACTPROG ; exit 1 ;
-ifeq ($(suffix $(ARCHIVENAME)), ".gz")
- EXTRACTPROG=gtar zf
-endif
-ifeq ($(suffix $(ARCHIVENAME)), ".bz2")
- EXTRACTPROG=gtar jf
-endif
+
extract:
test -d build || mkdir build
@if test -f $(ARCHIVEDIR)/$(ARCHIVENAME) ; then \
+ echo Extracting $(ARCHIVENAME) under build dir... ;\
( cd build && $(EXTRACTPROG) $(ARCHIVEDIR)/$(ARCHIVENAME) ) ; \
else echo Cannot extract - $(ARCHIVEDIR)/$(ARCHIVENAME) does not exist ;\
exit 1; \
@@ -61,9 +71,24 @@
clean distclean:
+ @echo Calling $@ in $(SRCDIR)
$(MAKE) -C $(SRCDIR) $@
+# This is a bit of a hack.. it does a "make clean",
+# only when we're between 32bit and 64bit builds, when doing "make all".
+# Once we're IN the 64bit builds, it should not be automatically called.
+build/.stage1:
+ @echo Doing inter 32-64 bit cleanup
+ $(MAKE) -C $(SRCDIR) distclean
+ touch $@
+
+reallyclean: distclean
+ @echo Removing any milestone files in build as well...
+ @rm -f build/.??*
+ @echo '(However, leaving src tree intact, with any patches in it)'
+ @echo '(If you want, you could rm -r build, then make extract once more)'
+
garchive:
@echo Call the fetch target instead: it does the same thing.
@@ -78,46 +103,28 @@
patch:
@echo patch: patching is handled automatically as part of the configure phase.
-
-
-
package:
- @echo make $@ not implemented yet
- ### potentially want to handle "merge" type stuff in 'package'
- # we also want to handle multi-package thingies.
+ $(CREATEPKG)
-# initial announce here. more down below for individual targets
-sparc-32 sparc-64 i386-32 i386-64::
- @echo Building $@ target
+# split out generic $(ARCH) sections to platform-specific sections if needed.
+# but it usually should not be neccessary
-configure-$(ARCH)-32: build/.configure-$(ARCH)-32.done
- @echo $@ done
-build-$(ARCH)-32: build/.build-$(ARCH)-32.done
- @echo $@ done
-stage-$(ARCH)-32: build/.stage-$(ARCH)-32.done
- @echo $@ done
-configure-$(ARCH)-64: build/.configure-$(ARCH)-64.done
- @echo $@ done
-build-$(ARCH)-64: build/.build-$(ARCH)-64.done
- @echo $@ done
-stage-$(ARCH)-64: build/.stage-$(ARCH)-64.done
- @echo $@ done
+$(ARCH)-32 :: configure-$(ARCH)-32 build-$(ARCH)-32 stage-$(ARCH)-32
+ @echo Completed $(ARCH)-32 configure, build and stage
+ touch build/.$(ARCH)-32.done
-# split out generic $(ARCH) sections to specific platform if needed.
-# but it usually should not be.
+$(ARCH)-64 :: stage-$(ARCH)-32 configure-$(ARCH)-64 build-$(ARCH)-64 stage-$(ARCH)-64
+ @echo Completed $@ configure, build and stage
+ touch build/.$(ARCH)-64.done
build/.$(ARCH)-32.done: $(ARCH)-32
+build/.$(ARCH)-64.done: $(ARCH)-64
-build/.stage-$(ARCH)-32.done \
-build/.stage-$(ARCH)-64.done ::
- @echo debug: handling $@ target
- touch $@
-
# Since we share the same src tree, we should only need to
# pre-configure patching one time for all.
build/.patch-preconf.done:
@@ -126,38 +133,81 @@
touch $@
+#Note: I WANT to use LDFLAGS=-R$$ORIGIN, but stupid libtool
+# wont allow it! so force it at build time
build/.configure-$(ARCH)-32.done: build/.patch-preconf.done
@echo handling $@ target
(cd $(SRCDIR) ; \
- CFLAGS="$(CFLAGS_COMMON)" \
+ CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_$(ARCH))" \
CXXFLAGS="$(CXXFLAGS_COMMON)" \
+ LDFLAGS='-R/opt/csw/lib -L/opt/csw/lib' \
$(CONFIGURE) )
if test -f patchfile.postconf ; then \
gpatch -d $(SRCDIR) -p0 <patchfile.postconf ; fi
touch $@
build/.configure-$(ARCH)-64.done: build/.patch-preconf.done
+ if test "$(ARCH)" = "i386" -a "`uname -r`" != "5.10" ; then \
+ echo Error: do 64bit for i386 on sol19 only ; exit 1 ; fi
@echo handling $@ target
(cd $(SRCDIR) ; \
CFLAGS="$(CFLAGS_COMMON) -m64" \
CXXFLAGS="$(CXXFLAGS_COMMON) -m64" \
+ LDFLAGS='-R/opt/csw/lib/sparcv9 -L/opt/csw/lib/sparcv9' \
PKG_CONFIG_PATH=/opt/csw/lib/64 \
$(CONFIGURE) $(CONFIGURE_64_EXTRAS) )
if test -f patchfile.postconf ; then \
gpatch -d $(SRCDIR) -p0 <patchfile.postconf ; fi
touch $@
-
-build/.build-$(ARCH)-32.done build/.build-$(ARCH)-64.done::
- (cd $(SRCDIR) ; \
- $(MAKE) $(MFLAGS) )
+
+# See note about LDFLAGS higher up
+build/.build-$(ARCH)-32.done build/.build-$(ARCH)-64.done:
+ @echo handling $@ target
+ LD_OPTIONS='-R$$ORIGIN' $(MAKE) -C $(SRCDIR) $(MFLAGS)
touch $@
-$(ARCH)-32 :: configure-$(ARCH)-32 build-$(ARCH)-32 stage-$(ARCH)-32
- @echo Completed $(ARCH)-32 configure, build and stage
- touch build/.$(ARCH)-32.done
-$(ARCH)-64 :: stage-$(ARCH)-32 configure-$(ARCH)-64 build-$(ARCH)-64 stage-$(ARCH)-64
- @echo Completed $@ configure, build and stage
- touch build/.$(ARCH)-64.done
+## NOTE: This is a DESTRUCTIVE target build!!
+## 'stagepkg' will destroy any prior "cswstage" directory!!!
+## So, we remove all 64bit milestones
+build/.stage-$(ARCH)-32.done:
+ @echo Handling stage of $(ARCH)-32
+ (cd $(SRCDIR) ; MAKE=gmake stagepkg)
+ @rm -f build/.*64.done
+ touch $@
+
+
+# Note: This is the tricky bit. we cannot just call
+# "stagepkg": we dont usually want EVERYTHING; just the
+# libs that are rebuilt in 64bit, and we need them to go to
+# the subdirs, not the regular place!
+# SOME things, will have a clean libdir, and respect --libdir,
+# and do the right thing easily. However, many will not!
+# SO, odds are you'll have to write a customized target
+build/.stage-$(ARCH)-64.done: $(SRCDIR)/cswstage
+ @echo ""
+ @echo debug: Using generic stage-64 routines
+ @echo relying on customized prototype file
+ @(cd $(SRCDIR)/*/.libs; tar cf - lib*.so.*.*.* ) | (cd $(SRCDIR)/cswstage ; tar xf -)
+ @(cd $(SRCDIR); cp *.pc cswstage)
+ @echo ""
+ touch $@
+
+
+
+#These are the easy-to-type targets. They just trigger the real ones.
+configure-$(ARCH)-32: build/.configure-$(ARCH)-32.done
+ @echo $@ done
+build-$(ARCH)-32: build/.build-$(ARCH)-32.done
+ @echo $@ done
+stage-$(ARCH)-32: build/.stage-$(ARCH)-32.done
+ @echo $@ done
+configure-$(ARCH)-64: build/.configure-$(ARCH)-64.done
+ @echo $@ done
+build-$(ARCH)-64: build/.build-$(ARCH)-64.done
+ @echo $@ done
+stage-$(ARCH)-64: build/.stage-$(ARCH)-64.done
+ @echo $@ done
+
Modified: csw/mgar/pkg/TEMPLATES/createpkg/README
===================================================================
--- csw/mgar/pkg/TEMPLATES/createpkg/README 2010-06-08 01:27:29 UTC (rev 10117)
+++ csw/mgar/pkg/TEMPLATES/createpkg/README 2010-06-08 01:29:07 UTC (rev 10118)
@@ -60,10 +60,10 @@
Make Targets
--------------------
-The makefiles are current a work in progress. The most developed
-initially is "Makefile.lib".
+The makefiles are current a work in progress. The most fully developed
+at the moment is "Makefile.lib".
-Currently aimed-for supported makefile targets are:
+Currently supported makefile targets are:
* extract
* sparc-32 sparc64 i386-32 i386-64
@@ -71,7 +71,9 @@
* build-(ARCH)-(32/64)
* stage-(ARCH)-(32/64)
* clean
- * distclean.
+ * distclean
+ * reallyclean
+ * package
Note that there is a single shared upstream source tree, that should be
extracted under a "build" directory.
Modified: csw/mgar/pkg/TEMPLATES/createpkg/top.Makefile
===================================================================
--- csw/mgar/pkg/TEMPLATES/createpkg/top.Makefile 2010-06-08 01:27:29 UTC (rev 10117)
+++ csw/mgar/pkg/TEMPLATES/createpkg/top.Makefile 2010-06-08 01:29:07 UTC (rev 10118)
@@ -10,6 +10,6 @@
# The -C means you must use gmake, unfortunately.
-garchive extract configure build package:
+all package build garchive extract configure clean distclean reallyclean :
+ @echo Going to make $@ in $(DEFAULT_DIR)
$(MAKE) -C $(DEFAULT_DIR) $@
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list