From: Matthias Braun Date: Tue, 23 Nov 2004 19:36:28 +0000 (+0000) Subject: add a dist target to jam X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6c3a5307b87bc3fff19e819281cf2b87a2b5010b;p=supertux.git add a dist target to jam SVN-Revision: 2157 --- diff --git a/Jamfile b/Jamfile index 49fb49739..95093248b 100644 --- a/Jamfile +++ b/Jamfile @@ -5,3 +5,13 @@ SubInclude TOP lib ; SubInclude TOP src ; SubInclude TOP data ; +UseAutoconf ; + +# for now... +Package [ Wildcard po : *.po *.in Changelog ] ; +Package [ Wildcard intl : *.c *.h ChangeLog VERSION Makefile.in ] ; +Package INSTALL NEWS README COPYING AUTHORS ChangeLog ABOUT-NLS depcomp + install-sh mkinstalldirs missing ; + +Package Makefile.am src/Makefile.am lib/Makefile.am data/Makefile.am + po/Makefile.in.in intl/Makefile.in ; diff --git a/Makefile.am b/Makefile.am index 1d62db060..a7bc78362 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = intl m4 lib src data po +SUBDIRS = intl lib src data po EXTRA_DIST = LEVELDESIGN TODO contrib/levelconverter-0.0.6_0.0.7.py autogen.sh -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I mk/autoconf AUTOMAKE_OPTIONS = 1.6 dist-bzip2 diff --git a/autogen.sh b/autogen.sh index c433b4205..acdf7e7dc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,6 +6,10 @@ if test ! -f configure.ac ; then exit 1 fi +autoheader +libtoolize --force +aclocal -I mk/autoconf + # generate Jamconfig.in autoconf --trace=AC_SUBST \ | sed -e 's/configure.ac:[0-9]*:AC_SUBST:\([^:]*\).*/\1 ?= "@\1@" ;/g' \ @@ -19,9 +23,6 @@ echo 'JAMCONFIG_READ = yes ;' >> Jamconfig.in # see AUTOMAKE_OPTIONS in Makefile.am export WANT_AUTOMAKE=1.6 -autoheader -libtoolize --force -aclocal -I mk/autoconf automake --copy --add-missing autoconf diff --git a/configure.ac b/configure.ac index 71368a66a..9c6f8a57c 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ AC_CHECK_FUNCS(mkdir strdup strstr) AC_INIT_JAM AC_CONFIG_FILES([Jamconfig]) -AC_OUTPUT(Makefile m4/Makefile intl/Makefile +AC_OUTPUT(Makefile intl/Makefile src/Makefile data/Makefile po/Makefile.in diff --git a/data/Jamfile b/data/Jamfile index 61f0297b7..dc05e24bd 100644 --- a/data/Jamfile +++ b/data/Jamfile @@ -9,6 +9,7 @@ IMAGEPATHS = images/intro images/leveleditor images/map + images/shared images/shared/smalltux images/shared/bigtux images/status diff --git a/mk/jam/application.jam b/mk/jam/application.jam index 10106ef4f..e561df057 100644 --- a/mk/jam/application.jam +++ b/mk/jam/application.jam @@ -24,55 +24,63 @@ ## all target. rule Application { - # check options - CheckOptions noinstall console independent : $(3) : $(<) ; + # check options + CheckOptions noinstall console independent : $(3) : $(<) ; - local target = [ ConstructApplicationTarget $(<) : $(3) ] ; - local sources = [ DoSourceGrist $(>) ] ; - local objects = [ CompileObjects $(sources) ] ; + local target = [ ConstructApplicationTarget $(<) : $(3) ] ; + local sources = [ DoSourceGrist $(>) ] ; + local objects = [ CompileObjects $(sources) ] ; - $(<)_TYPE = application ; - $(<)_OBJECTS = $(objects) ; - $(<)_SOURCES = $(sources) ; - $(<)_TARGET = $(target) ; - $(<)_OPTIONS = $(3) ; - $(<)_INSTALLTARGET = ; + $(<)_TYPE = application ; + $(<)_OBJECTS = $(objects) ; + $(<)_SOURCES = $(sources) ; + $(<)_TARGET = $(target) ; + $(<)_OPTIONS = $(3) ; + $(<)_INSTALLTARGET = ; - # create target clean rule - Always $(<)clean ; - NotFile $(<)clean ; - Clean $(<)clean : $(objects) ; # create target clean rule - Depends clean : $(<)clean ; + # create target clean rule + Always $(<)clean ; + NotFile $(<)clean ; + Clean $(<)clean : $(objects) ; # create target clean rule + Depends clean : $(<)clean ; - # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X) - if $(target) != $(<) - { - Depends $(<) : $(target) ; - NotFile $(<) ; - } + # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X) + if $(target) != $(<) + { + Depends $(<) : $(target) ; + NotFile $(<) ; + } - # make dependency on apps target - if ! [ IsElem independent : $(3) ] - { - Depends apps : $(<) ; - } + # make dependency on apps target + if ! [ IsElem independent : $(3) ] + { + Depends apps : $(<) ; + } - # construct Install target - if ! [ IsElem noinstall : $(3) ] - { - $(<)_INSTALLTARGET = [ DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) ] ; - Depends install_bin : $($(<)_INSTALLTARGET) ; - } + # construct Install target + if ! [ IsElem noinstall : $(3) ] + { + $(<)_INSTALLTARGET = [ + DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) : nopackage + ] ; + Depends install_bin : $($(<)_INSTALLTARGET) ; + } - # Link - MakeLocate $(target) : $(LOCATE_TARGETS) ; - SystemLinkApplication $(<) : $(objects) : $(3) ; + # Link + MakeLocate $(target) : $(LOCATE_TARGETS) ; + SystemLinkApplication $(<) : $(objects) : $(3) ; - # Import default flags - CppFlags $(<) : $(CPPFLAGS) $(APPLICTION_CPPFLAGS) ; - CFlags $(<) : $(CFLAGS) $(APPLICATION_CFLAGS) ; - C++Flags $(<) : $(C++FLAGS) $(APPLICATION_C++FLAGS) ; - LFlags $(<) : $(LFLAGS) $(APPLICATION_LFLAGS) ; + # Import default flags + CppFlags $(<) : $(CPPFLAGS) $(APPLICTION_CPPFLAGS) ; + CFlags $(<) : $(CFLAGS) $(APPLICATION_CFLAGS) ; + C++Flags $(<) : $(C++FLAGS) $(APPLICATION_C++FLAGS) ; + LFlags $(<) : $(LFLAGS) $(APPLICATION_LFLAGS) ; + + # Sources are part of the package + if ! [ IsElem nopackage : $(3) ] + { + Package $(sources) ; + } } #---------------------------------------------------------------------------- diff --git a/mk/jam/autoconf.jam b/mk/jam/autoconf.jam index 185b26319..507aceacc 100644 --- a/mk/jam/autoconf.jam +++ b/mk/jam/autoconf.jam @@ -1,15 +1,25 @@ # Clean rules for autoconf generated stuff -# construct some clean targets -Clean distclean : config.log config.status config.cache aclocal.m4 - Jamconfig config.h out.txt log.txt stamp-h1 - libtool ; -CleanDir distclean : autom4te.cache out ; -Depends distclean : clean ; +## Setup some stuff that makes usage of autoconf easier +rule UseAutoconf +{ + # construct some clean targets + Clean distclean : config.log config.status config.cache aclocal.m4 + Jamconfig config.h out.txt log.txt stamp-h1 + libtool ; + CleanDir distclean : autom4te.cache out ; + Depends distclean : clean ; -Clean cvsclean : configure aclocal.m4 config.h.in Jamconfig.in ; -Depends cvsclean : distclean ; + Clean cvsclean : configure aclocal.m4 config.h.in Jamconfig.in ; + Depends cvsclean : distclean ; -Help clean : "Cleanup objectfiles and targets" ; -Help distclean : "Cleanup objectfiles and build configuration" ; -Help cvsclean : "Cleanup all objectfiles, buildconfig and generated files." ; + Help clean : "Cleanup objectfiles and targets" ; + Help distclean : "Cleanup objectfiles and build configuration" ; + Help cvsclean : + "Cleanup all objectfiles, buildconfig and generated files." ; + Package autogen.sh configure.ac configure config.h.in + Jamrules Jamconfig.in ; + Package [ Wildcard mk/jam : *.jam ] [ Wildcard mk/autoconf : *.m4 ] + mk/autoconf/config.guess mk/autoconf/config.sub + mk/autoconf/install-sh ; +} diff --git a/mk/jam/build.jam b/mk/jam/build.jam index 099c30cd0..08d9ffb4b 100644 --- a/mk/jam/build.jam +++ b/mk/jam/build.jam @@ -11,6 +11,8 @@ include $(jamrulesdir)/jamcompatibility.jam ; include $(jamrulesdir)/helper.jam ; include $(jamrulesdir)/subdir.jam ; +include $(jamrulesdir)/package.jam ; + include $(jamrulesdir)/variant.jam ; include $(jamrulesdir)/resource.jam ; diff --git a/mk/jam/helper.jam b/mk/jam/helper.jam index 965f616ae..e359ca4f0 100644 --- a/mk/jam/helper.jam +++ b/mk/jam/helper.jam @@ -167,7 +167,7 @@ rule ConcatDirs ## Copy source file to target. actions Copy { - $(CP) $(>) $(<) + $(CP) "$(>)" "$(<)" } actions ignore Move diff --git a/mk/jam/install.jam b/mk/jam/install.jam index 9d3553ff5..ad85e41c2 100644 --- a/mk/jam/install.jam +++ b/mk/jam/install.jam @@ -85,7 +85,7 @@ rule InstallMan } } -## DoInstall sourcename : directories [ : installapp ] +## DoInstall sourcename : directories [ : installapp ] [ : options ] ## Creates a new installtarget for the given sources. The target(s) are ## returned as function result. rule DoInstall @@ -96,7 +96,7 @@ rule DoInstall gdir = $(dir:G=dir) ; MkDir $(gdir) ; - for i in $(1) { + for i in $(<) { target = $(i:BSR=$(dir):G=install) ; targets += $(target) ; Depends $(target) : $(gdir) $(i) ; @@ -109,6 +109,11 @@ rule DoInstall } } + # We want to package all files we install + if ! [ IsElem nopackage : $(4) ] { + Package $(<) ; + } + Always $(targets) ; return $(targets) ; } diff --git a/mk/jam/library.jam b/mk/jam/library.jam index 3a7bc0f14..1be44286e 100644 --- a/mk/jam/library.jam +++ b/mk/jam/library.jam @@ -59,7 +59,7 @@ rule Library # Generate install rules if ! [ IsElem noinstall : $(3) ] { - install_targets = [ DoInstall $(target) : $(libdir) ] ; + install_targets = [ DoInstall $(target) : $(libdir) : $(INSTALL) : nopackage ] ; Depends install_lib : $(install_targets) ; } @@ -117,6 +117,12 @@ rule Library CFlags $(<) : $(CFLAGS) $(LIBRARY_CFLAGS) ; C++Flags $(<) : $(C++FLAGS) $(LIBRARY_C++FLAGS) ; LFlags $(<) : $(LFLAGS) $(LIBRARY_LFLAGS) ; + + # Sources are part of the package + if ! [ IsElem nopackage : $(3) ] + { + Package $(sources) ; + } } ## LibraryVersion diff --git a/mk/jam/package.jam b/mk/jam/package.jam new file mode 100644 index 000000000..a1d558693 --- /dev/null +++ b/mk/jam/package.jam @@ -0,0 +1,33 @@ +#============================================================================ +# Rules for creating distribution packages +#============================================================================ + +PACKAGE_FILES = ; +PACKAGE_FILE = $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2 ; +PACKAGE_DIR = $(PACKAGE_NAME)-$(PACKAGE_VERSION) ; +LOCATE_DISTTEMP ?= $(top_builddir)/build/dist ; + +## Package files +## Add files to distribution package +rule Package +{ + for i in $(<) { + local target = $(i:R=$(LOCATE_DISTTEMP)/$(PACKAGE_DIR)/$(SUBDIR)) ; + local dir = $(i:DR=$(LOCATE_DISTTEMP)/$(PACKAGE_DIR)/$(SUBDIR)) ; + local source = $(i:G=$(SOURCE_GRIST:E)_PACKAGE) ; + MkDir $(dir) ; + Copy $(target) : $(source) ; + LOCATE on $(source) = $(SUBDIR) ; + Depends $(target) : $(dir) ; + Depends $(target) : $(source) ; + Depends $(PACKAGE_FILE) : $(target) ; + } +} + +actions TarBz2 +{ + tar -c --bzip2 -C $(LOCATE_DISTTEMP) -f $(<) $(PACKAGE_DIR) +} + +TarBz2 $(PACKAGE_FILE) ; +Depends dist : $(PACKAGE_FILE) ; diff --git a/mk/jam/subdir.jam b/mk/jam/subdir.jam index bb1ba5073..fa613095a 100644 --- a/mk/jam/subdir.jam +++ b/mk/jam/subdir.jam @@ -3,9 +3,9 @@ # (until jampeople accept my patches :-/ ) #============================================================================ -LOCATE_OBJECTS ?= $(top_builddir)/out/$(target) ; +LOCATE_OBJECTS ?= $(top_builddir)/build/$(target) ; LOCATE_TARGETS ?= $(top_builddir) ; -LOCATE_DOCS ?= $(top_builddir)/out ; +LOCATE_DOCS ?= $(top_builddir)/build ; SUBDIRRULES += FixSubDirPath ; @@ -16,6 +16,9 @@ rule FixSubDirPath { LOCATE_SOURCE = [ ConcatDirs $(LOCATE_OBJECTS) $(SUBDIR_TOKENS) ] ; LOCATE_TARGET = [ ConcatDirs $(LOCATE_OBJECTS) $(SUBDIR_TOKENS) ] ; + + # We need to package the Jamfile (a bit hacky here...) + Package Jamfile ; } # fix bug in Jambase where SubInclude in the middle of a jam file made it break