Debian packaging support, which should now correctly support building source packages.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@37834 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Ivan Vučica 2014-05-05 00:47:20 +00:00
parent 551cf1669f
commit 8ef9b0927d
7 changed files with 198 additions and 26 deletions

View file

@ -1,3 +1,19 @@
2014-05-05 Ivan Vucica <ivan@vucica.net>
* GNUmakefile.in: Separately building source and binary package,
optionally signing. Support for gnustep-make-ld.so.conf.
* Master/deb.make: Tweaked procedure for building Debian packages
to avoid cleaning when attempting to get 'make' variables that can
be passed on to bake_debian_files.sh as environment variables.
Signing packages is now optional, and source and binary packages
are built separately.
* bake_debian.files.sh: Improved .spec parsing. Introduced
dependency on CDBS (which simplifies customizing of debian/rules)
while automating some edge cases. Handling of DEB_VERSION_SUFFIX.
* configure, configure.ac: Support for --enable-install-ld-so-conf.
* gnustep-make-ld.so.conf.in: Template for the dynamic linker
configuration file ld.so.conf/gnustep-make.conf.
2014-04-07 Ivan Vucica <ivan@vucica.net>
* Master/deb.make, bake_debian_files.sh: Rewrite of .deb-building

View file

@ -161,6 +161,14 @@ else
EC = @
endif
# To produce a signed Debian source and binary package,
# call 'make debsign=yes'.
ifeq ($(debsign),yes)
DEBUILD_ARGS = -nc
else
DEBUILD_ARGS = -us -uc -nc
endif
all: generated-files
$(EC)(echo "Thanks. All is ready: type '$(MAKE) install' to install gnustep-make.")
@ -253,6 +261,12 @@ install: generated-files
echo "Stripping makefiles and shell scripts..."; \
cd "$(makedir)"; ./strip_makefiles.sh; \
fi)
$(EC)(if [ "@GNUSTEP_INSTALL_LD_SO_CONF@" = "yes" ] ; then \
echo "Installing ld.so.conf.d/gnustep-make.conf due to custom prefix..."; \
"$(srcdir)/mkinstalldirs" $(DESTDIR)/etc/ld.so.conf.d ; \
$(INSTALL_DATA) gnustep-make-ld.so.conf "$(DESTDIR)/etc/ld.so.conf.d/gnustep-make.conf"; \
\
fi)
uninstall:
rm -f "$(mandir)/man1/debugapp.1" "$(mandir)/man1/debugapp.1.gz"; \
@ -423,13 +437,15 @@ debian_dist/gnustep-make_$(GNUSTEP_MAKE_VERSION)_all.deb: dist
cp gnustep-make-$(GNUSTEP_MAKE_VERSION).tar.gz debian_dist/gnustep-make_$(GNUSTEP_MAKE_VERSION).orig.tar.gz
cd debian_dist && tar xfz gnustep-make_$(GNUSTEP_MAKE_VERSION).orig.tar.gz
PACKAGE_NAME="gnustep-make" VERSION=$(GNUSTEP_MAKE_VERSION) DEB_MAINTAINER="GNUstep Developers <gnustep-dev@gnu.org>" DEB_ARCHITECTURE=all /bin/bash bake_debian_files.sh debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/
printf "\noverride_dh_auto_configure:\n\tdh_auto_configure -- $(DEB_CONFIGURE_FLAGS)\n" >> debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/debian/rules
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && debuild -us -uc
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && dpkg-source --commit -q
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && debuild $(DEBUILD_ARGS) -S
cd debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)/ && debuild $(DEBUILD_ARGS) -b
# rm -rf debian_dist/gnustep-make-$(GNUSTEP_MAKE_VERSION)
generated-files: GNUmakefile GNUstep.sh GNUstep.csh fixpath.sh config-noarch.make config.make \
openapp opentool gnustep-make.spec executable.template gnustep-config \
filesystem.make filesystem.sh filesystem.csh GNUstep.conf GNUstep-strict-v2.conf
filesystem.make filesystem.sh filesystem.csh GNUstep.conf GNUstep-strict-v2.conf \
gnustep-make-ld.so.conf
GNUmakefile: GNUmakefile.in config.status
$(SHELL) config.status
@ -478,3 +494,7 @@ executable.template: executable.template.in
gnustep-config: gnustep-config.in
$(SHELL) config.status
gnustep-make-ld.so.conf: gnustep-make-ld.so.conf.in
$(SHELL) config.status

View file

@ -69,23 +69,63 @@ else
DEB_BUILD_DEPENDS+=, gnustep-make (=$(GNUSTEP_MAKE_VERSION))
endif
.PHONY: deb
# To produce a signed Debian source and binary package,
# call 'make debsign=yes'.
ifeq ($(debsign),yes)
DEBUILD_ARGS = -nc
else
DEBUILD_ARGS = -us -uc -nc
endif
###
ifeq ($(_DEB_SHOULD_EXPORT), )
deb:
if [ ! -e ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz ] ; then make dist ; else echo "Source file already exists; NOT rebuilding. Please manually remove if desired." ; fi
$(ECHO_NOTHING)echo "Generating the deb package..."$(END_ECHO)
#
.PHONY: deb
_debenv.phony::
-rm _debenv
_DEB_SHOULD_EXPORT=1 make _debenv
# Order is important; we want debfiles to be done first so ./configure
# is not unnecessarily run during submake.
../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz: | _debenv.phony dist
deb-prep:: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
$(ECHO_NOTHING)echo "Baking deb control files ("$(GNUSTEP_TARGET_CPU)")..."$(END_ECHO)
/bin/bash -c ". _debenv && mkdir -p $(_ABS_OBJ_DIR)/debian_files && $(GNUSTEP_MAKEFILES)/bake_debian_files.sh $(_ABS_OBJ_DIR)/debian_files"
-rm _debenv
$(ECHO_NOTHING)echo "Preparing directory layout for building deb package..."$(END_ECHO)
-rm -rf $(_ABS_OBJ_DIR)/debian_dist
mkdir -p $(_ABS_OBJ_DIR)/debian_dist
cp ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz $(_ABS_OBJ_DIR)/debian_dist/$(_DEB_ORIGTARNAME).orig.tar.gz
cd $(_ABS_OBJ_DIR)/debian_dist && tar xfz $(_DEB_ORIGTARNAME).orig.tar.gz
_DEB_SHOULD_EXPORT=1 make _debfiles
printf "\noverride_dh_auto_configure:\n\tdh_auto_configure -- $(DEB_CONFIGURE_FLAGS)\noverride_dh_auto_build:\n\tmake\n\tdh_auto_build\nbuild::\n\tmake" >> $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian/rules
cd $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ && debuild -us -uc
mkdir -p $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian
mv $(_ABS_OBJ_DIR)/debian_files/debian/* $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian
-rm -rf $(_ABS_OBJ_DIR)/debian_files
deb:: deb-prep
$(ECHO_NOTHING)echo "Building Debian package..."$(END_ECHO)
cd $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ && debuild $(DEBUILD_ARGS) -S
cd $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ && debuild $(DEBUILD_ARGS) -b
#
else
#
.PHONY: debfiles
# Export all variables, but only if we explicitly are working with bake_debian_files.sh
export
_debfiles:
/bin/bash $(GNUSTEP_MAKEFILES)/bake_debian_files.sh $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/
_debenv:
export > _debenv
endif
###

View file

@ -40,28 +40,31 @@ if [[ "${distrib_id}" == "Ubuntu" ]] ; then
default_distribution=$(grep DISTRIB_CODENAME /etc/lsb-release | sed 's/DISTRIB_CODENAME=//')
fi
target_arch=${GNUSTEP_TARGET_CPU:-any}
if [[ "${target_arch}" -eq "i686" ]] ; then
if [[ "${target_arch}" == "i686" ]] ; then
target_arch=i386
elif [[ "${target_arch}" -eq "x86_64" ]] ; then
elif [[ "${target_arch}" == "x86_64" ]] ; then
target_arch=amd64
fi
PACKAGE_VERSION=${PACKAGE_VERSION:-${VERSION}}
DEB_SOURCE=${DEB_SOURCE:-${deb_lowercase_package_name}}
DEB_PACKAGE=${DEB_PACKAGE:-${deb_lowercase_package_name}}
DEB_ARCHITECTURE=${DEB_ARCHITECTURE:-${target_arch}} #$(shell (/bin/bash -c "$(CC) -dumpmachine | sed -e 's,\\([^-]*\\).*,\\1,g'"))}
DEB_SECTION=${DEB_SECTION:-gnustep}
DEB_PRIORITY=${DEB_PRIORTY:-optional}
DEB_VCS_SVN=${DEB_VCS_SVN:-${svn_path}}
DEB_VERSION=${DEB_VERSION:-${PACKAGE_VERSION:-${VERSION}}}
DEB_VERSION=${DEB_VERSION:-${PACKAGE_VERSION}}
if [ -z "${DEB_BUILD_DEPENDS}" ] ; then
DEB_BUILD_DEPENDS="debhelper (>= 9)"
DEB_BUILD_DEPENDS="debhelper (>= 9), cdbs"
else
DEB_BUILD_DEPENDS="${DEB_BUILD_DEPENDS}, debhelper (>= 9)"
DEB_BUILD_DEPENDS="${DEB_BUILD_DEPENDS}, debhelper (>= 9), cdbs"
fi
DEB_DEPENDS='${shlibs:Depends}, ${misc:Depends}'" ${DEB_DEPENDS}"
DEB_DISTRIBUTION=${DEB_DISTRIBUTION:-${default_distribution}}
# DEB_VERSION_SUFFIX intentionally unset.
# Attempt to extract information from a .spec or a .spec.in file.
if which python > /dev/null ; then
FN=$(python - << _EOF
@ -80,7 +83,7 @@ def process_specfile(specfilename):
for line in specfile.readlines():
line=line.rstrip()
for var in vars:
line.replace('%{%s}' % var, vars[var])
line=line.replace('%{' + var + '}', vars[var])
if description_mode:
if len(line.lstrip()) > 0 and line.lstrip()[0] == '#':
@ -152,9 +155,9 @@ def process_specfile(specfilename):
if line == "%description":
description_mode = True
elif line.startswith('%define'):
segs=line[len('%define')+1].lstrip().split(' ')
segs=line[len('%define')+1:].lstrip().replace('\\t', ' ').split(' ')
segs=[seg.rstrip().lstrip() for seg in segs]
vars[segs[0]] = ' '.segs[1:].join()
vars[segs[0]] = ' '.join(segs[1:])
try:
@ -177,7 +180,7 @@ DEB_DESCRIPTION="${DEB_DESCRIPTION:-$(printf "Debian packaging for GNUstep based
# Check that maintainer and package builder are set.
if [ -z "${DEB_MAINTAINER}" ] ; then
echo "error: You must set DEB_MAINTAINER in GNUmakefile or on command line."
echo "error: You must set DEB_MAINTAINER in GNUmakefile, in .spec file, or on command line."
exit 1
fi
if [ -z "${DEB_PACKAGE_BUILDER}" ] ; then
@ -196,6 +199,10 @@ if [ -z "${DEB_VERSION}" ] ; then
echo "error: Package version was not properly set in GNUmakefile."
exit 1
fi
if [ ! -z "${DEB_VERSION_SUFFIX}" ] ; then
DEB_VERSION=${DEB_VERSION}-${DEB_VERSION_SUFFIX}
#ln -s ${destination}/../../${PACKAGE_NAME}-${VERSION}.orig.tar.gz ${destination}/../../${PACKAGE_NAME}-${DEB_VERSION}.orig.tar.gz
fi
echo ${destination}
# For documentation, see:
@ -291,8 +298,32 @@ echo "3.0 (quilt)" > "${destination}"/source/format
# Intentionally overwriting.
cat > "${destination}"/rules << _EOF
#!/usr/bin/make -f
%:
dh \$@
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
DEB_BUILD_PARALLEL = 1
DEB_CONFIGURE_EXTRA_FLAGS += ${DEB_CONFIGURE_EXTRA_FLAGS}
DEB_CONFIGURE_SCRIPT_ENV += ${DEB_CONFIGURE_SCRIPT_ENV}
DEB_DH_LINK_ARGS += ${DEB_DH_LINK_ARGS}
DEB_SHLIBS_ARGS_ALL += ${DEB_SHLIBS_ARGS_ALL}
DEB_SHLIBS_ARGS += ${DEB_SHLIBS_ARGS}
DEB_SHLIBS_INCLUDE += ${DEB_SHLIBS_INCLUDE}
DEB_MAKE_ENVVARS += BUILDING_DEB=1
export build :
ifneq (${PACKAGE_NAME}, gnustep-make)
GNUSTEP_MAKEFILES = \$(shell gnustep-config --variable=GNUSTEP_MAKEFILES)
ifneq (\$(GNUSTEP_MAKEFILES), )
DEB_MAKE_ENVVARS += \$(shell sh -c ". \$(GNUSTEP_MAKEFILES)/GNUstep.sh && env |grep GNUSTEP")
else
$(error Failed to get GNUSTEP_MAKEFILES variable. Is gnustep-config properly installed?)
exit 1
endif
endif
_EOF
chmod 755 "${destination}"/rules

38
configure vendored
View file

@ -715,6 +715,7 @@ GNUSTEP_NETWORK_ROOT
GNUSTEP_LOCAL_ROOT
GNUSTEP_USER_DIR
GNUSTEP_MULTI_PLATFORM
GNUSTEP_INSTALL_LD_SO_CONF
BACKEND_BUNDLE
cc_gnuruntime
OBJC_LIB_FLAG
@ -734,6 +735,7 @@ OBJCFLAGS
GNUSTEP_DEFAULT_DEBUG
GNUMAKE
MAKE_WITH_INFO_FUNCTION
GNUSTEP_PREFIX
GNUSTEP_STRIP_MAKEFILES
GNUSTEP_MAKE_PARALLEL_BUILDING
GNUSTEP_MAKE_VERSION
@ -1427,6 +1429,16 @@ Optional Features:
not supported / does not work on your machine.
--enable-install-ld-so-conf
Enable installation of ld.so.conf/gnustep-make.conf. This is useful
if you are installing in a non-standard prefix, and a component of
the build system needs to be able to find libraries even without
GNUstep.sh or equivalent providing environment. Some packaging
systems clear out the environment at certain points during the
packaging build process, hence making LD_LIBRARY_PATH set by
gnustep-make.conf ineffective.
--enable-objc-nonfragile-abi
Use the non-fragile ABI for Objective-C. Use this option if you want
to use non-fragile instance variables provided by clang and libobjc2.
@ -5356,6 +5368,25 @@ else
fi
#--------------------------------------------------------------------
# Enable installation of ld.so.conf.d/gnustep-make.conf
#--------------------------------------------------------------------
#
# Check whether --enable-install-ld-so-conf was given.
if test "${enable_install_ld_so_conf+set}" = set; then
enableval=$enable_install_ld_so_conf; ac_cv_install_ld_so_conf=$enableval
else
ac_cv_install_ld_so_conf="undefined"
fi
if test "$ac_cv_install_ld_so_conf" = "yes"; then
GNUSTEP_INSTALL_LD_SO_CONF=yes;
else
GNUSTEP_INSTALL_LD_SO_CONF=;
fi
#--------------------------------------------------------------------
# Miscellaneous flags and setup
#--------------------------------------------------------------------
@ -7117,7 +7148,7 @@ fi
#--------------------------------------------------------------------
# Produce the output files
#--------------------------------------------------------------------
ac_config_files="$ac_config_files config-noarch.make config.make openapp opentool executable.template GNUmakefile GNUstep.conf GNUstep-strict-v2.conf GNUstep.sh GNUstep.csh fixpath.sh gnustep-make.spec gnustep-config TestFramework/gnustep-tests filesystem.make filesystem.sh filesystem.csh"
ac_config_files="$ac_config_files config-noarch.make config.make openapp opentool executable.template GNUmakefile GNUstep.conf GNUstep-strict-v2.conf GNUstep.sh GNUstep.csh fixpath.sh gnustep-make.spec gnustep-make-ld.so.conf gnustep-config TestFramework/gnustep-tests filesystem.make filesystem.sh filesystem.csh"
ac_config_commands="$ac_config_commands default"
@ -7710,6 +7741,7 @@ do
"GNUstep.csh") CONFIG_FILES="$CONFIG_FILES GNUstep.csh" ;;
"fixpath.sh") CONFIG_FILES="$CONFIG_FILES fixpath.sh" ;;
"gnustep-make.spec") CONFIG_FILES="$CONFIG_FILES gnustep-make.spec" ;;
"gnustep-make-ld.so.conf") CONFIG_FILES="$CONFIG_FILES gnustep-make-ld.so.conf" ;;
"gnustep-config") CONFIG_FILES="$CONFIG_FILES gnustep-config" ;;
"TestFramework/gnustep-tests") CONFIG_FILES="$CONFIG_FILES TestFramework/gnustep-tests" ;;
"filesystem.make") CONFIG_FILES="$CONFIG_FILES filesystem.make" ;;
@ -7915,6 +7947,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
GNUSTEP_PREFIX!$GNUSTEP_PREFIX$ac_delim
GNUSTEP_NETWORK_ADMIN_APPS!$GNUSTEP_NETWORK_ADMIN_APPS$ac_delim
GNUSTEP_NETWORK_WEB_APPS!$GNUSTEP_NETWORK_WEB_APPS$ac_delim
GNUSTEP_NETWORK_TOOLS!$GNUSTEP_NETWORK_TOOLS$ac_delim
@ -7955,6 +7988,7 @@ GNUSTEP_NETWORK_ROOT!$GNUSTEP_NETWORK_ROOT$ac_delim
GNUSTEP_LOCAL_ROOT!$GNUSTEP_LOCAL_ROOT$ac_delim
GNUSTEP_USER_DIR!$GNUSTEP_USER_DIR$ac_delim
GNUSTEP_MULTI_PLATFORM!$GNUSTEP_MULTI_PLATFORM$ac_delim
GNUSTEP_INSTALL_LD_SO_CONF!$GNUSTEP_INSTALL_LD_SO_CONF$ac_delim
BACKEND_BUNDLE!$BACKEND_BUNDLE$ac_delim
cc_gnuruntime!$cc_gnuruntime$ac_delim
OBJC_LIB_FLAG!$OBJC_LIB_FLAG$ac_delim
@ -7990,7 +8024,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View file

@ -470,6 +470,7 @@ fi
GNUSTEP_PREFIX=`echo "$GNUSTEP_PREFIX" | sed 's%/*$%%'`
AC_MSG_RESULT($GNUSTEP_PREFIX)
AC_SUBST(GNUSTEP_PREFIX)
# Now we apply the prefix (we don't need to apply it to
# GNUSTEP_SYSTEM_USERS_DIR and similar, which are something like
@ -1003,6 +1004,29 @@ else
fi
AC_SUBST(BACKEND_BUNDLE)
#--------------------------------------------------------------------
# Enable installation of ld.so.conf.d/gnustep-make.conf
#--------------------------------------------------------------------
AC_ARG_ENABLE(install-ld-so-conf, [
--enable-install-ld-so-conf
Enable installation of ld.so.conf/gnustep-make.conf. This is useful
if you are installing in a non-standard prefix, and a component of
the build system needs to be able to find libraries even without
GNUstep.sh or equivalent providing environment. Some packaging
systems clear out the environment at certain points during the
packaging build process, hence making LD_LIBRARY_PATH set by
gnustep-make.conf ineffective.
],
ac_cv_install_ld_so_conf=$enableval,
ac_cv_install_ld_so_conf="undefined")
if test "$ac_cv_install_ld_so_conf" = "yes"; then
GNUSTEP_INSTALL_LD_SO_CONF=yes;
else
GNUSTEP_INSTALL_LD_SO_CONF=;
fi
AC_SUBST(GNUSTEP_INSTALL_LD_SO_CONF)
#--------------------------------------------------------------------
# Miscellaneous flags and setup
#--------------------------------------------------------------------
@ -1878,7 +1902,7 @@ AC_CONFIG_FILES([config-noarch.make config.make openapp opentool
executable.template GNUmakefile GNUstep.conf GNUstep-strict-v2.conf
GNUstep.sh GNUstep.csh fixpath.sh
gnustep-make.spec gnustep-config TestFramework/gnustep-tests
filesystem.make filesystem.sh filesystem.csh])
filesystem.make filesystem.sh filesystem.csh gnustep-make-ld.so.conf])
AC_CONFIG_COMMANDS([default],
[[chmod a+x openapp opentool fixpath.sh executable.template]],
[[]])

View file

@ -0,0 +1,7 @@
# This file was installed by gnustep-make @GNUSTEP_MAKE_VERSION@
@GNUSTEP_PREFIX@/lib
@GNUSTEP_SYSTEM_LIBRARIES@
@GNUSTEP_LOCAL_LIBRARIES@
@GNUSTEP_NETWORK_LIBRARIES@