From 355a0a3cf58f970cc03b9d6a22902ae5f363612f Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 7 Jun 2018 00:37:22 +0100 Subject: [PATCH] build, debian/: Add a `configure' script to make things easier. Amazingly, this is good enough to work with Debhelper, so throw out the earlier fiddling. --- .gitignore | 2 ++ Makefile => Make.rules | 13 ++++---- configure | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ debian/.gitignore | 1 + debian/rules | 12 ++++---- 5 files changed, 96 insertions(+), 13 deletions(-) rename Makefile => Make.rules (95%) create mode 100755 configure diff --git a/.gitignore b/.gitignore index aa06ea3..5263fce 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ *.o *.d /COPYING +/Makefile /auto-version +/config.mk /noip /uopen diff --git a/Makefile b/Make.rules similarity index 95% rename from Makefile rename to Make.rules index b77af1d..4129928 100644 --- a/Makefile +++ b/Make.rules @@ -23,7 +23,7 @@ ### with preload-hacks; if not, write to the Free Software Foundation, Inc., ### 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -srcdir = . +srcdir ?= . PACKAGE = preload-hacks VERSION := $(shell cd $(srcdir) && ./auto-version) @@ -114,7 +114,8 @@ distdir = $(PACKAGE)-$(VERSION) DISTTAR = $(distdir).tar.gz ## Distribute the build utilities. -DISTFILES += Makefile +DISTFILES += Make.rules +DISTFILES += configure DISTFILES += auto-version ## Documentation. @@ -205,10 +206,10 @@ distcheck: dist +cd _distcheck && \ tar xvfz ../$(DISTTAR) && \ mkdir _build && cd _build && \ - make -f../$(distdir)/Makefile srcdir=../$(distdir) && \ - make -f../$(distdir)/Makefile srcdir=../$(distdir) \ - install DESTDIR=../_install && \ - make -f../$(distdir)/Makefile srcdir=../$(distdir) dist + ../$(distdir)/configure && \ + make && \ + make install DESTDIR=../_install && \ + make dist rm -rf _distcheck ###----- That's all, folks -------------------------------------------------- diff --git a/configure b/configure new file mode 100755 index 0000000..635c9c0 --- /dev/null +++ b/configure @@ -0,0 +1,81 @@ +#! /bin/sh -e +### +### Cheesy configuration script. +### +### (c) 2018 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of the preload-hacks package. +### +### Preload-hacks are free software; you can redistribute it and/or modify +### them under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2 of the License, or (at +### your option) any later version. +### +### Preload-hacks are distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +### Public License for more details. +### +### You should have received a copy of the GNU General Public License along +### with preload-hacks; if not, write to the Free Software Foundation, Inc., +### 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +## Check for a `help' option. +case $1,$# in + ,0) ;; + -h,* | --help,*) + echo "usage: $0 [--VAR=VAL ...] -- [VAR=VAL ...]" + exit 0 + ;; +esac + +## Find a relative path to the source directory. +case $0 in */*) ;; *) echo >&2 "$0: invoke as PATH/configure"; exit 2 ;; esac +srcdir=${0%/*} + +## Build the actual makefile. +rm -f Makefile.new +cat >Makefile.new <config.mk.new +cat >&3 <&3 "$k = $v" ;; + --*,*) k=${1#--}; echo >&3 "$k = t" ;; + *) break ;; + esac + shift +done + +## Parse any remaining assignments. +while :; do + case $1,$# in + ,0) break ;; + *=*) k=${1%%=*} v=${1#*=}; echo >&3 "$k = $v" ;; + *) echo >&2 "$0: unexpected argument $1"; exit 2 ;; + esac + shift +done + +## All over. +exec 3>&- +mv config.mk.new config.mk +mv Makefile.new Makefile diff --git a/debian/.gitignore b/debian/.gitignore index 327f87d..c4af182 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -1,4 +1,5 @@ files +build tmp substvars *.substvars diff --git a/debian/rules b/debian/rules index 81d3e4b..22e825d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,11 +1,9 @@ #! /usr/bin/make -f -arch = $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH) +DH_OPTIONS = --parallel -Bdebian/build -%:; dh $@ --parallel +%:; dh $@ $(DH_OPTIONS) -override_dh_auto_install: - dh_auto_install --parallel -- \ - prefix=/usr mandir=/usr/share/man \ - libdir=/usr/lib/$(arch) \ - DESTDIR=debian/tmp +override_dh_auto_configure: + dh_auto_configure $(DH_OPTIONS) -- \ + $(shell dpkg-buildflags --export=cmdline) -- 2.11.0