2013-09-20 02:26:44 +00:00
|
|
|
# -*-makefile-*-
|
|
|
|
# deb.make
|
|
|
|
#
|
|
|
|
# Makefile rules to build a Debian package
|
|
|
|
#
|
|
|
|
# Copyright (C) 2013 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# Author: Ivan Vucica <ivan@vucica.net>
|
|
|
|
#
|
|
|
|
# This file is part of the GNUstep Makefile Package.
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 3
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public
|
|
|
|
# License along with this library; see the file COPYING.
|
|
|
|
# If not, write to the Free Software Foundation,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
#
|
|
|
|
# This file provides targets 'deb' and 'debfile'.
|
|
|
|
#
|
|
|
|
# - debfile - produces a 'packagename.debequivs' file, which can be
|
|
|
|
# processed by program 'equivs-build' inside Debian package
|
|
|
|
# 'equivs'. Such processing will produce file named
|
|
|
|
# gomoku_1.1.1_i386.deb (for example).
|
|
|
|
# - deb - runs 'equivs'build.
|
|
|
|
#
|
|
|
|
# Processor architecture is detected from output of $(CC) -dumpmachine.
|
|
|
|
# If $(CC) is not defined, gcc is used.
|
|
|
|
|
|
|
|
# [1] Add - after common.make - the following lines in your GNUmakefile:
|
|
|
|
#
|
|
|
|
# PACKAGE_NAME = Gomoku
|
|
|
|
# PACKAGE_VERSION = 1.1.1
|
|
|
|
#
|
|
|
|
# The other important variable you may want to set in your makefiles is
|
|
|
|
#
|
|
|
|
# GNUSTEP_INSTALLATION_DOMAIN - Installation domain (defaults to LOCAL)
|
|
|
|
#
|
|
|
|
# A special note: if you need `./configure' to be run before
|
|
|
|
# compilation (usually only needed for GNUstep core libraries
|
|
|
|
# themselves), define the following make variable:
|
|
|
|
#
|
|
|
|
# PACKAGE_NEEDS_CONFIGURE = yes
|
|
|
|
#
|
|
|
|
# in your makefile.
|
|
|
|
|
|
|
|
ifeq ($(CC), )
|
2014-04-07 00:42:20 +00:00
|
|
|
CC=cc
|
2013-09-20 02:26:44 +00:00
|
|
|
endif
|
2014-04-07 00:42:20 +00:00
|
|
|
_DEB_ARCH=$(GNUSTEP_TARGET_CPU) # $(shell (/bin/bash -c "$(CC) -dumpmachine | sed -e 's,\\([^-]*\\).*,\\1,g'"))
|
|
|
|
_DEB_LOWERCASE_PACKAGE_NAME=$(shell (echo $(PACKAGE_NAME) | sed -e 's/\(.*\)/\L\1/'))
|
2013-09-20 02:26:44 +00:00
|
|
|
|
2014-05-06 01:29:07 +00:00
|
|
|
_DEB_VERSION=$(TARBALL_VERSION)
|
|
|
|
ifeq ($(_DEB_VERSION), )
|
|
|
|
_DEB_VERSION=$(PACKAGE_VERSION)
|
|
|
|
endif
|
2014-04-07 00:42:20 +00:00
|
|
|
ifeq ($(_DEB_VERSION), )
|
|
|
|
_DEB_VERSION=$(VERSION)
|
|
|
|
endif
|
|
|
|
_DEB_ORIGTARNAME=$(_DEB_LOWERCASE_PACKAGE_NAME)_$(_DEB_VERSION)
|
|
|
|
_DEB_FILE=$(_DEB_TARNAME)_$(_DEB_ARCH).deb
|
2013-09-20 06:13:15 +00:00
|
|
|
|
2014-04-07 00:42:20 +00:00
|
|
|
_ABS_OBJ_DIR=$(shell (cd "$(GNUSTEP_BUILD_DIR)"; pwd))/obj
|
2013-09-20 02:26:44 +00:00
|
|
|
|
2014-05-05 00:47:20 +00:00
|
|
|
# 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
|
|
|
|
|
2014-05-06 01:29:07 +00:00
|
|
|
_DEB_TARBALL = $(shell (test -e $(VERSION_NAME).tar.gz && echo $(VERSION_NAME).tar.gz) || \
|
|
|
|
(test -e ../$(VERSION_NAME).tar.gz && echo ../$(VERSION_NAME).tar.gz))
|
2014-05-05 00:47:20 +00:00
|
|
|
|
|
|
|
###
|
2013-09-20 02:26:44 +00:00
|
|
|
|
2014-04-07 00:42:20 +00:00
|
|
|
ifeq ($(_DEB_SHOULD_EXPORT), )
|
2014-04-07 01:20:27 +00:00
|
|
|
|
2014-05-05 00:47:20 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
_debenv.phony::
|
|
|
|
-rm _debenv
|
|
|
|
_DEB_SHOULD_EXPORT=1 make _debenv
|
|
|
|
|
2014-05-06 01:29:07 +00:00
|
|
|
debclean::
|
|
|
|
-rm _debenv
|
|
|
|
-rm -rf $(_ABS_OBJ_DIR)/debian_dist
|
2014-05-05 00:47:20 +00:00
|
|
|
|
2014-05-06 01:29:07 +00:00
|
|
|
debfiles:: _debenv.phony
|
|
|
|
$(ECHO_NOTHING)(if [ -z "$(_DEB_TARBALL)" ] || [ ! -e "$(_DEB_TARBALL)" ] ; then \
|
|
|
|
echo "No tarball found. Please produce it manually using a target such as dist, svn-dist, " ; \
|
|
|
|
echo "svn-bugfix, svn-snapshot or svn-export." ; \
|
2014-05-11 01:07:59 +00:00
|
|
|
echo "Expecting name $(VERSION_NAME).tar.gz in current or parent directory." ; \
|
2014-05-06 01:29:07 +00:00
|
|
|
exit 1 ; \
|
|
|
|
fi)$(END_ECHO)
|
2014-05-05 00:47:20 +00:00
|
|
|
$(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)
|
2014-04-07 00:42:20 +00:00
|
|
|
-rm -rf $(_ABS_OBJ_DIR)/debian_dist
|
|
|
|
mkdir -p $(_ABS_OBJ_DIR)/debian_dist
|
2014-05-06 01:29:07 +00:00
|
|
|
cp $(_DEB_TARBALL) $(_ABS_OBJ_DIR)/debian_dist/$(_DEB_ORIGTARNAME).orig.tar.gz
|
2014-04-07 00:42:20 +00:00
|
|
|
cd $(_ABS_OBJ_DIR)/debian_dist && tar xfz $(_DEB_ORIGTARNAME).orig.tar.gz
|
2014-05-05 00:47:20 +00:00
|
|
|
|
2014-05-06 01:29:07 +00:00
|
|
|
mkdir -p $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/debian
|
|
|
|
mv $(_ABS_OBJ_DIR)/debian_files/debian/* $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/debian
|
2014-05-05 00:47:20 +00:00
|
|
|
-rm -rf $(_ABS_OBJ_DIR)/debian_files
|
|
|
|
|
2014-05-06 09:32:59 +00:00
|
|
|
deb::
|
2014-05-05 00:47:20 +00:00
|
|
|
$(ECHO_NOTHING)echo "Building Debian package..."$(END_ECHO)
|
2014-05-06 01:29:07 +00:00
|
|
|
cd $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/ && debuild $(DEBUILD_ARGS) -S
|
|
|
|
cd $(_ABS_OBJ_DIR)/debian_dist/$(VERSION_NAME)/ && debuild $(DEBUILD_ARGS) -b
|
2014-05-05 00:47:20 +00:00
|
|
|
|
|
|
|
#
|
2014-04-07 01:20:27 +00:00
|
|
|
else
|
2014-05-05 00:47:20 +00:00
|
|
|
#
|
|
|
|
|
2014-06-07 17:28:25 +00:00
|
|
|
ifeq ($(DEB_BUILD_DEPENDS),)
|
|
|
|
DEB_BUILD_DEPENDS =gnustep-make (>= $(shell dpkg -s gnustep-make | grep 'Version: ' | sed 's/Version: //'))
|
|
|
|
export DEB_BUILD_DEPENDS
|
|
|
|
else
|
|
|
|
DEB_BUILD_DEPENDS +=, gnustep-make (>= $(shell dpkg -s gnustep-make | grep 'Version: ' | sed 's/Version: //'))
|
|
|
|
export DEB_BUILD_DEPENDS
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: _debenv
|
2014-05-05 00:47:20 +00:00
|
|
|
|
2014-04-07 01:20:27 +00:00
|
|
|
# Export all variables, but only if we explicitly are working with bake_debian_files.sh
|
|
|
|
export
|
2014-05-05 00:47:20 +00:00
|
|
|
_debenv:
|
|
|
|
export > _debenv
|
2014-04-07 00:42:20 +00:00
|
|
|
endif
|
2014-05-05 00:47:20 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
|