summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Buildsystem/makefile.pm
Commit message (Collapse)AuthorAge
* makefile.pm: remove build directory even if Makefile does not exist yet.Modestas Vainius2011-08-05
| | | | | | Assume that the package can be cleaned (i.e. the build directory can be removed) as long as it is built out-of-source tree and can be configured. This is useful for derivative buildsystems which generate Makefiles.
* makefile buildsystem: Chomp output during test for full compatability with ↵Joey Hess2010-02-19
| | | | | | | | | | | | | | debhelper 7.4.11. Closes: #570503 Previously the test used make -s -n | head -n 1 and then chomped the output. In the case of this bug, root-system's Makefile *always* outputs something to stdout, even for targets that don't exist, before configure is run. It accidentially worked before, since the first line it outputs happens to be empty. So bring back the chomp to retain compatability with this package that used to work before, but the test only does the right thing for this package due to sheer luck, really.
* The fix for #563557 caused some new trouble involving makefile that ↵Joey Hess2010-02-18
| | | | misbehave when stderr is closed. Reopen it to /dev/null when testing for the existance of a makefile target. Closes: #570443
* makefile: Support the (asking for trouble) case of MAKE being set to ↵Joey Hess2010-01-03
| | | | something with a space in it. Closes: #563557
* make: Avoid infinite loop that occurrs when testing existence of a target in ↵Joey Hess2009-11-21
| | | | | | | a certian horribly broken makefile by making the test stop after it sees one line of output from make. (This may be better replaced with dh's makefile parser in the future.)
* Improve build system auto-selection processModestas Vainius2009-11-18
| | | | | | | | | | | | | | | This patch alters semantics of check_auto_buildable() a bit. Now it can also indicate if the source has already been partitially built with the build system and if so, such build system may be auto-selected over a less specific its parent (in the inheritance tree) even if the latter is earlier in the @BUILDSYSTEMS array. However, this still leaves a requirement that a derivative build system must not do anything that may break packages of the parent build system. Otherwise, introduction of a new derivative build system might break packages which already had that build system implemented via overrides... Signed-off-by: Modestas Vainius <modestas@vainius.eu>
* support unlimited parallel jobsJoey Hess2009-10-29
| | | | | | | | dpkg-buildpackage -j sets DEB_BUILD_OPTIONS=parallel=-1. Policy does not cover this but the intent is to allow unlimited parallel jobs. Also, there is no longer any way for parallel to be set to undef, so remove code to handle that.
* reduce amount of MAKEFLAGS cleaningJoey Hess2009-10-28
| | | | | | | | | | | Now clean_jobserver_makeflags will only remove --jobserver settings from MAKEFLAGS. This is simpler and easier to understand than the old behavior, which, if there was no --jobserver, removed all -j and --jobs, while leaving those when removing --jobserver. This relies on -j options passed to make overriding -j settings in MAKEFLAGS. So we don't need to clean those out, we can just override them.
* split get_make_jobserver_status into two functionsJoey Hess2009-10-28
| | | | | | | | | | | I disliked the complexity of the return values, and the boilerplate code that followed the two calls to the function, to clean/unset MAKEFLAGS. To solve both, I refactored it into two functions, one simply tests to see if a jobserver is specified but unavailable, while the other cleans/unsets MAKEFLAGS. This loses the ability to pull the jobs-N count out of MAKEFLAGS, but that was not currently used.
* move obscure function to EOFJoey Hess2009-10-28
|
* Support parallel building in makefile buildsystemModestas Vainius2009-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Add routine to Dh_Lib (used by dh and makefile.pm) which is capable of detecting make jobserver and job control options from the MAKEFLAGS environment variable. It also generates and returns a clean up MAKEFLAGS from these options. 2) Add --parallel option to build system framework which allows source packages to specify that they support parallel building. Optional value for this option is the number of maximum parallel process to allow. However, the actual number of parallel process (if any) for the specific build is determined from DEB_BUILD_OPTIONS env variable as specified by Debian Policy. By default (no --parallel option) parallel is neither enabled nor disabled (depends on the external environment). However, dh may pass --parallel to dh_auto_* implicitly in case 4) described below. 3) Add parallel support for makefile buildsystem. This implementation forcefully starts a new make job server (or disables parallel) for the number of process requested. If --parallel was not passed to the build system at all, the build system will only clean up MAKEFLAGS from stale jobserver options to avoid pointless make warnings. 4) If dh detects that it is being run by dpkg-buildpackage -jX and it is NOT run with "+" prefix from debian/rules (i.e. jobserver is not reachable), it enables --parallel implicitly. This closes: #532805. Signed-off-by: Modestas Vainius <modestas@vainius.eu>
* misc minor changesJoey Hess2009-06-29
|
* Revert "Update dh_auto documentation."Joey Hess2009-06-28
| | | | | | | | | | | I'm reverting the documentation addition to try doing it myself, more simply and less verbosely. This reverts commit 962a2e10c930e3504ea1c0327be2fdf70d53023e. Conflicts: dh_auto.pod
* Update dh_auto documentation.Modestas Vainius2009-06-18
| | | | | | | | | | | | | | | | | * dh_auto.pod -> dh_auto.7 - contains general information about dh_auto, its features, build systems supported by default (the latter is injected by man/dh_auto_pod script from Debian/Debhelper/Buildsystem/*.pm PODs via placeholders (#PLACEHOLDER#)) * POD in Debian/Debhelper/Buildsystem/*.pm -> dh_auto_<buildsystem>.7 - build system specific information. * dh_auto_* -> dh_auto_*.1 - relatively shorty description of the specific dh_auto_* program and build system specific info for that step injected from Debian/Debhelper/Buildsystem/*.pm with man/dh_auto_pod script. * man/dh_auto_pod $step - generates full dh_auto_$step POD (replaces placeholders). * man/dh_auto_pod - generates full dh_auto.pod (replaces placeholders). Signed-off-by: Modestas Vainius <modestas@vainius.eu>
* Some cosmetic changes in the comments and strings.Modestas Vainius2009-06-17
| | | | | | | | * buildsystem -> build system * dh_auto build system -> debhelper build system * plugin -> class * a few rewording changes in the comments. * Enhance python_distutils::DESCRIPTION().
* Ensure make doesn't print directories when checking for target existance.Modestas Vainius2009-06-11
| | | | | | | | | | Whenever make is run with --print-directory option, make -C sometimes print Entering/Leaving directory messages to stdout even with -s in effects This breakes a check for target existance as it relies on make printing nothing when target does not do anything. Hence explicitly pass --no-print-directory to make to avoid it. Signed-off-by: Modestas Vainius <modestas@vainius.eu>
* Implement source directory switching support (Closes: #530597).Modestas Vainius2009-06-09
| | | | | | | | * New optional option --sourcedirectory/-d. * New Buildsystem API methods for getting source directory/path (since sourcedir may no longer be topdir), source 2 build directory convertions, doit_in_sourcedir() etc. * clean_builddir() -> rmdir_builddir() rename.
* Use the term "build step" instead of "build action" everywhere in the source.Modestas Vainius2009-06-08
| | | | | I'm going to use this new term in documentation. I have never liked "action" in this context, just couldn't think of anything better.
* reword descriptionsJoey Hess2009-04-20
| | | | | Shorten, remove duplicate verbiage, and list the characteristic file of the build system.
* rename Dh_Buildsystem to BuildsystemJoey Hess2009-04-20
| | | | | This way the root of the class hierarchy has the same name as the directory holding the classes.
* use $this rather than $selfJoey Hess2009-04-20
|
* let's write class, not clsJoey Hess2009-04-20
|
* removal of comments I'm satisfied withJoey Hess2009-04-15
|
* debhelper modular buildsystems (try 3).Modestas Vainius2009-04-15
| | | | | | | | | | | | | | | * New feature - when listing buildsystems, list their status too (auto/specified). * Dh_Buildsystem_Basic.pm renamed to Dh_Buildsystem.pm * Addressed a few issues expressed in the comments, answered a few comments. * Cache DEB_BUILD_GNU_TYPE value. Performance hit is noticable when listing build systems. * is_auto_buildable() renamed to check_auto_buildable() (again). Since there is is_buildable() now, I didn't want to use is_ for that method. Signed-off-by: Modestas Vainius <modestas@vainius.eu>
* more commentsJoey Hess2009-04-14
|
* update and remove XXX commentsJoey Hess2009-04-14
|
* Modular object-orientied buildsystem implementation (try 2).Modestas Vainius2009-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Major changess: * Dh_Buildsystem_Option dropped and Dh_Buildsystem_Chdir functionality partitially merged into Dh_Buildsystem_Basic. Dh_Buildsystem_Bases.pm renamed to Dh_Buildsystem_Basic.pm to match classname. * *_impl() ditched completely. Previous {configure,build,test,install,clean}_impl() renamed to just configure(), build(), test(), install(), clean() instead. Added pre_action($action) and post_action($action) hooks instead which are called by Dh_Buildsystems::buildsystems_do(). * Builddir is handled via mkdir_builddir(), doit_in_buildddir(), clean_builddir() methods which buildsystems should call directly. Removed get_top* method, added get_rel2builddir_path(). * is_buildable() method renamed to is_auto_buildable() to reflect its purpose more. * ::perl_makefile renamed to ::perl_makemaker and which is based on ::makefile now. MakeMaker hack moved from ::makefile to ::perl_makemaker where it belongs (thanks for the tip). * Dh_Buildsystems refactored into a simple perl module rather than OO class and simplified a bit. * @BUILDSYSTEMS and is_auto_buildable() modified to 100% match historical order. TODO: user documentation (e.g. DH_AUTO_BUILDDIRECTORY and DH_AUTO_BUILDSYSTEM environment variables and common dh_auto_* options (--buildsystem and --builddirectory)). Current plugin inheritance hierarchy is like this: Buildsystem::perl_build -> Dh_Buildsystem_Basic <- Buildsystem::python_distutils ^ | Buildsystem::makefile <- Buildsystem::perl_makemaker ^ ^ ^ / | \ Buildsystem::autotools Buildsystem::cmake Buildsystem::python_distutils Signed-off-by: Modestas Vainius <modestas@vainius.eu>
* code review, added commentsJoey Hess2009-04-10
| | | | | I went through every line of the buildsystem implementation, and added numerous comments. Search for "XXX JEH" to find them.
* Modular object-orientied buildsystem implementation.Modestas Vainius2009-04-10
Dh_Buildsystems: A manager module for buildsystem "plugins". It deals with the following tasks: * Handles common command line and environment options. As currently implemented by the patch they are: - DH_AUTO_BUILDSYSTEM envvar, -m/--build-system - disables autoguessing of the build system and allows the user to specify which one to use. - DH_AUTO_BUILDDIRECTORY envvar, -b/--build-directory - option to enable building outside source if supported by the buildsystem. User can specify the build directory name or let it be autogenerated (currently "obj-`dpkg_architecture('DEB_BUILD_GNU_TYPE')`" as per CDBS convention). Outside source building has an advantage of avoiding sourcedir pollution which the clean routine cannot deal with properly (at least common in cmake or autotools case). The "clean" is simple in such a case - just rm -rf builddir. - -l/--list - lists all buildsystems known to Dh_Buildsystems along with their descriptions. * Manages buildsystem plugins: - provides a way to list them and collect information about them. - provides a way to force loading & use of a specific buildsystem. - determines which build system is applicable to the source in question using common API (::is_buildable() method) exposed by each build system plugin. * @BUILDSYSTEMS variable contains all buildsystems known to the manager in the order of specialization. ----------------------------- ----------------------------- Dh_Buildsystem_Bases.pm: Contains a few classes which define a common interface for buildsystem plugins and implements handling of common features (i.e. two types of the build directory support, see below). Each specific build system plugin is supposed to inherit from any of these base classes or from another build system plugin. Currently implemented classes (packages) inside this .pm are: -- Dh_Buildsystem_Basic -- a basic class describing buildsystem plugin API. It stores build directory internally (can be retrieved with ::get_builddir() or path constructed using ::get_buildpath() (useful in is_buildable())) but does nothing with it. This class is intended to be inherited by the build system plugins which do not support outside-source tree building or there is no way to control this option (as far as tell, Build.PL is like this). It also describes common buildsystem plugin API and lays down the basic architecture: * ::configure/::build/::test/::install/::clean methods - they will be called to perform a respective action. These are wrapper methods by default and provide a place to implement common features specific the action itself (like creating build directory, see Dh_Buildsystem_Chdir::configure()) before calling real buildsystem specific implementation. Default implementations call the respective *_impl() method via another invoke_impl() wrapper. * ::configure_impl/::build_impl/::test_impl/::install_impl/::clean-impl methods - placeholders for the buildsystem specific implementation of the action (by overriding the methods as needed). Default implementations do nothing. * ::invoke_impl($method_name, @args) - a convenient way to hook in the code which needs to be run before or after respective ::*_impl() of *each* action (e.g. a simple case like setting envvar, see perl_build.pm). Default implementation calls $self->$method_name(@args) by default. So we have such a chain by default (and each can be overriden by any derived class): $self->$action() calls: $self->invoke_impl("${action}_impl", @_) calls: $self->$action_impl(@_) <- does buildsystem specific stuff here; -- Dh_Buildsystem_Option -- extends Dh_Buildsystem_Basic and adds support for passing build directory name via command line option to the build script (specific plugins should override ::get_builddir_option() method). ::invoke_impl() is overriden to pass value of $self->get_builddir_option() to each ::$action_impl() method (python distutils use such a way to set "build place", i.e. --build-place=builddir, see python_distutils.pm). -- Dh_Buildsystem_Chdir -- extends Dh_Buildsystem_Option. This class implements support for outside source building when you need to chdir to the building directory before building (like e.g. makefile.pm and its derivatives: autotools.pm and cmake.pm). All the code in there deals with chdir'ing/mkdir'ing to the build directory as needed before calling ::$action_impl() and finally going back. This is done by overriding ::invoke_impl() method. ----------------------------- ----------------------------- And finally we have build system specific plugins as Debian/Debhelper/Buildsystem/*.pm. Currently I have implemented 100% functionality of the former dh_auto_* tools inside these plugins + cmake support in the cmake.pm: $ ./dh_auto_configure -l autotools - support for building GNU Autotools based packages. cmake - support for building CMake based packages (outside-source tree only). perl_build - support for building Perl Build.PL based packages (in-source only). perl_makefile - support for building Perl Makefile.PL based packages (in-source only). python_distutils - support for building Python distutils based packages. makefile - support for building Makefile based packages (make && make install). Current plugin inheritance hierarchy is like this: Buildsystem::perl_build -> Dh_Buildsystem_Basic <- Buildsystem::perl_makefile ^ (maybe it should derive from ::perl_build?) | Buildsystem::python_distutils -> Dh_Buildsystem_Option ^ | Dh_Buildsystem_Chdir ^ | Buildsystem::makefile ^ ^ / \ Buildsystem::autotools Buildsystem::cmake Signed-off-by: Modestas Vainius <modestas@vainius.eu>