| author | Raphaël Hertzog <hertzog@debian.org> | |
| Mon, 11 Jul 2011 08:37:41 +0000 (10:37 +0200) | ||
| committer | Raphaël Hertzog <hertzog@debian.org> | |
| Fri, 22 Jul 2011 19:46:15 +0000 (21:46 +0200) |
data/architecture.mk: variables related to dpkg-architecture
data/buildflags.mk: variables related to dpkg-builflags
data/vendor.mk: variables related to dpkg-vendor
data/default.mk: all of the above
data/buildflags.mk: variables related to dpkg-builflags
data/vendor.mk: variables related to dpkg-vendor
data/default.mk: all of the above
| configure.ac | patch | blob | history | |
| debian/changelog | patch | blob | history | |
| debian/dpkg-dev.install | patch | blob | history | |
| debian/dpkg.install | patch | blob | history | |
| scripts/Makefile.am | patch | blob | history | |
| scripts/mk/Makefile.am | [new file with mode: 0644] | patch | blob |
| scripts/mk/architecture.mk | [new file with mode: 0644] | patch | blob |
| scripts/mk/buildflags.mk | [new file with mode: 0644] | patch | blob |
| scripts/mk/default.mk | [new file with mode: 0644] | patch | blob |
| scripts/mk/vendor.mk | [new file with mode: 0644] | patch | blob |
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
man/Makefile
po/Makefile.in
scripts/Makefile
+ scripts/mk/Makefile
scripts/po/Makefile.in
src/Makefile
utils/Makefile ])
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
Closes: #633627
* Improve dpkg-source's error message complaining about the lack
of the upstream tarball. Closes: #634510
+ * Add some common makefile snippets for use in rules files in
+ /usr/share/dpkg/: default.mk, architecture.mk, buildflags.mk, vendor.mk
+ Closes: #606839
[ Guillem Jover ]
* Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520
--- a/debian/dpkg-dev.install
+++ b/debian/dpkg-dev.install
usr/bin/dpkg-shlibdeps
usr/bin/dpkg-source
usr/bin/dpkg-vendor
+usr/share/dpkg/*.mk
usr/share/man/{*/*,*}/deb-control.5
usr/share/man/{*/*,*}/deb-src-control.5
usr/share/man/{*/*,*}/deb-version.5
diff --git a/debian/dpkg.install b/debian/dpkg.install
--- a/debian/dpkg.install
+++ b/debian/dpkg.install
usr/bin/dpkg-trigger
usr/bin/update-alternatives
usr/sbin
-usr/share/dpkg
+usr/share/dpkg/*table
usr/share/locale/*/LC_MESSAGES/dpkg.mo
usr/share/man/{*/*,*}/dpkg-deb.1
usr/share/man/{*/*,*}/dpkg-divert.8
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
## Process this file with automake to produce Makefile.in
-SUBDIRS = po
+SUBDIRS = mk po
bin_SCRIPTS = \
dpkg-architecture \
diff --git a/scripts/mk/Makefile.am b/scripts/mk/Makefile.am
--- /dev/null
+++ b/scripts/mk/Makefile.am
@@ -0,0 +1,16 @@
+## Process this file with automake to produce Makefile.in
+
+dist_pkgdata_DATA = \
+ architecture.mk \
+ buildflags.mk \
+ default.mk \
+ vendor.mk
+
+do_path_subst = $(AM_V_GEN) \
+ sed -e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):"
+
+install-data-hook:
+ cp -p $(DESTDIR)$(pkgdatadir)/default.mk $(DESTDIR)$(pkgdatadir)/default.mk.tmp
+ $(do_path_subst) <$(DESTDIR)$(pkgdatadir)/default.mk.tmp \
+ >$(DESTDIR)$(pkgdatadir)/default.mk
+ rm $(DESTDIR)$(pkgdatadir)/default.mk.tmp
diff --git a/scripts/mk/architecture.mk b/scripts/mk/architecture.mk
--- /dev/null
@@ -0,0 +1,25 @@
+# This Makefile snippet defines all the DEB_HOST_* / DEB_BUILD_* variables
+# that dpkg-architecture can return. Existing values of those variables
+# are preserved as per policy.
+
+dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+
+DEB_HOST_ARCH ?= $(call dpkg_late_eval,DEB_HOST_ARCH,dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_ARCH_OS ?= $(call dpkg_late_eval,DEB_HOST_ARCH_OS,dpkg-architecture -qDEB_HOST_ARCH_OS)
+DEB_HOST_ARCH_CPU ?= $(call dpkg_late_eval,DEB_HOST_ARCH_CPU,dpkg-architecture -qDEB_HOST_ARCH_CPU)
+DEB_HOST_ARCH ?= $(call dpkg_late_eval,DEB_HOST_ARCH,dpkg-architecture -qDEB_HOST_ARCH_BITS)
+DEB_HOST_ARCH_ENDIAN ?= $(call dpkg_late_eval,DEB_HOST_ARCH_ENDIAN,dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)
+DEB_HOST_GNU_CPU ?= $(call dpkg_late_eval,DEB_HOST_GNU_CPU,dpkg-architecture -qDEB_HOST_GNU_CPU)
+DEB_HOST_GNU_SYSTEM ?= $(call dpkg_late_eval,DEB_HOST_GNU_SYSTEM,dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
+DEB_HOST_GNU_TYPE ?= $(call dpkg_late_eval,DEB_HOST_GNU_TYPE,dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_HOST_MULTIARCH ?= $(call dpkg_late_eval,DEB_HOST_MULTIARCH,dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+DEB_BUILD_ARCH ?= $(call dpkg_late_eval,DEB_BUILD_ARCH,dpkg-architecture -qDEB_BUILD_ARCH)
+DEB_BUILD_ARCH_OS ?= $(call dpkg_late_eval,DEB_BUILD_ARCH_OS,dpkg-architecture -qDEB_BUILD_ARCH_OS)
+DEB_BUILD_ARCH_CPU ?= $(call dpkg_late_eval,DEB_BUILD_ARCH_CPU,dpkg-architecture -qDEB_BUILD_ARCH_CPU)
+DEB_BUILD_ARCH ?= $(call dpkg_late_eval,DEB_BUILD_ARCH,dpkg-architecture -qDEB_BUILD_ARCH_BITS)
+DEB_BUILD_ARCH_ENDIAN ?= $(call dpkg_late_eval,DEB_BUILD_ARCH_ENDIAN,dpkg-architecture -qDEB_BUILD_ARCH_ENDIAN)
+DEB_BUILD_GNU_CPU ?= $(call dpkg_late_eval,DEB_BUILD_GNU_CPU,dpkg-architecture -qDEB_BUILD_GNU_CPU)
+DEB_BUILD_GNU_SYSTEM ?= $(call dpkg_late_eval,DEB_BUILD_GNU_SYSTEM,dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
+DEB_BUILD_GNU_TYPE ?= $(call dpkg_late_eval,DEB_BUILD_GNU_TYPE,dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_BUILD_MULTIARCH ?= $(call dpkg_late_eval,DEB_BUILD_MULTIARCH,dpkg-architecture -qDEB_BUILD_MULTIARCH)
diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk
--- /dev/null
+++ b/scripts/mk/buildflags.mk
@@ -0,0 +1,25 @@
+# This Makefile snippet defines the following variables:
+#
+# CFLAGS: flags for the C compiler
+# CPPFLAGS: flags for the C preprocessor
+# CXXFLAGS: flags for the C++ compiler
+# FFLAGS: flags for the Fortran compiler
+# LDFLAGS: flags for the linker
+#
+# You can also export them in the environment by setting
+# DPKG_EXPORT_BUILDFLAGS to a non-empty value.
+#
+# This list is kept in sync with the default set of flags returned
+# by dpkg-buildflags.
+
+dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+
+CFLAGS = $(call dpkg_late_eval,CFLAGS,dpkg-buildflags --get CFLAGS)
+CPPFLAGS = $(call dpkg_late_eval,CPPFLAGS,dpkg-buildflags --get CPPFLAGS)
+CXXFLAGS = $(call dpkg_late_eval,CXXFLAGS,dpkg-buildflags --get CXXFLAGS)
+FFLAGS = $(call dpkg_late_eval,FFLAGS,dpkg-buildflags --get FFLAGS)
+LDFLAGS = $(call dpkg_late_eval,LDFLAGS,dpkg-buildflags --get LDFLAGS)
+
+ifdef DPKG_EXPORT_BUILDFLAGS
+ export CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS
+endif
diff --git a/scripts/mk/default.mk b/scripts/mk/default.mk
--- /dev/null
+++ b/scripts/mk/default.mk
@@ -0,0 +1,7 @@
+# Include all the Makefiles that define variables that can be useful
+# within debian/rules
+
+dpkg_datadir = .
+include $(dpkg_datadir)/architecture.mk
+include $(dpkg_datadir)/buildflags.mk
+include $(dpkg_datadir)/vendor.mk
diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
--- /dev/null
+++ b/scripts/mk/vendor.mk
@@ -0,0 +1,18 @@
+# Makefile snippet defining the following vendor-related variables:
+#
+# DEB_VENDOR: output of dpkg-vendor --query Vendor
+# DEB_PARENT_VENDOR: output of dpkg-vendor --query Parent (can be empty)
+#
+# The snippet also defines a macro "dpkg_vendor_derives_from" that you can
+# use to verify if the current vendor derives from another vendor with a
+# simple test like this one:
+# ifeq ($(call dpkg_vendor_derives_from ubuntu),yes)
+# ...
+# endif
+
+dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+
+DEB_VENDOR = $(call dpkg_late_eval,DEB_VENDOR,dpkg-vendor --query Vendor)
+DEB_PARENT_VENDOR = $(call dpkg_late_eval,DEB_PARENT_VENDOR,dpkg-vendor --query Parent)
+
+dpkg_vendor_derives_from = dpkg-vendor --derives-from $(1) && echo yes || echo no
