From: Roy Marples Date: Wed, 28 Aug 2019 21:30:52 +0000 (+0100) Subject: build: Allow DESTDIR to work for import as well. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3817d6db34cd0c5dbcd809f2fb615fecb696f89;p=thirdparty%2Fdhcpcd.git build: Allow DESTDIR to work for import as well. --- diff --git a/BUILDING.md b/BUILDING.md index 95779511..6779ccec 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -134,16 +134,17 @@ You can decide which polling mechanism dhcpcd will select in eloop like so ## Importing into another source control system -To prepare dhcpcd for import into a platform source tree (like NetBSD) -you can use the make import target to create /tmp/dhcpcd-$version and -populate it with all the source files and hooks needed. +To import the full sources, use the import target. +To import only the needed sources and documentation, use the import-src +target. +Both targets support DESTDIR to set the installation directory, +if unset it defaults to `/tmp/dhcpcd-$VERSION` +Example: `make DESTDIR=/usr/src/contrib/dhcpcd import-src` + In this instance, you may wish to disable some configured tests when the binary has to run on older versions which lack support, such as getline. `./configure --without-getline` -There is also the import-src target which installs just the needed source -files in a specific directory (like DragonFly). -`make DESTDIR=/usr/src/contrib/dhcpcd import-src` ## Hooks Not all the hooks in dhcpcd-hooks are installed by default. diff --git a/Makefile b/Makefile index deff77b5..dcd4624c 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,7 @@ SUBDIRS= src hooks VERSION!= sed -n 's/\#define VERSION[[:space:]]*"\(.*\)".*/\1/p' src/defs.h -DIST!= if test -f .fslckout; then echo "dist-fossil"; \ - elif test -d .git; then echo "dist-git"; \ +DIST!= if test -d .git; then echo "dist-git"; \ else echo "dist-inst"; fi FOSSILID?= current GITREF?= HEAD @@ -52,12 +51,6 @@ distclean: clean rm -f config.h config.mk config.log \ ${DISTFILE} ${DISTFILEGZ} ${DISTINFO} ${DISTINFOSIGN} - -dist-fossil: - fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ} - gunzip -c ${DISTFILEGZ} | xz >${DISTFILE} - rm ${DISTFILEGZ} - dist-git: git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} @@ -86,10 +79,17 @@ snapshot: tar cf - -C /tmp ${DISTPREFIX} | xz >${DISTFILE} ls -l ${DISTFILE} -import: dist - rm -rf /tmp/${DISTPREFIX} - ${INSTALL} -d /tmp/${DISTPREFIX} - tar xvJpf ${DISTFILE} -C /tmp +_import: dist + rm -rf ${DESTDIR}/* + ${INSTALL} -d ${DESTDIR} + tar xvpf ${DISTFILE} -C ${DESTDIR} --strip 1 + @${ECHO} + @${ECHO} "=============================================================" + @${ECHO} "dhcpcd-${VERSION} imported to ${DESTDIR}" + +import: + ${MAKE} _import DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` + _import-src: rm -rf ${DESTDIR}/*