Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2001 11:39:02 +0200
From:      Peter Pentchev <roam@orbitel.bg>
To:        freebsd-arch@FreeBSD.org
Subject:   patch for bsd.lib.mk to create include and lib dirs
Message-ID:  <20010124113902.B332@ringworld.oblivion.bg>

next in thread | raw e-mail | index | archive | help
Hi,

I tried to use bsd.lib.mk for a library I'm writing, and stumbled into
a little difficulty: if a library tries to place its include files in
a non-existing directory, bsd.lib.mk does not attempt to create it, but
just tries to install files there.  This might have strange side effects
like installing a file with the name of the desired subdir.

Attached is a little proposed patch to try to create ${DESTDIR}${INCDIR}
and ${DESTDIR}${LIBDIR} if CREATEDESTDIRS is defined.

And yes, I *am* aware of mtree and hierarchy; but until the actual advent
of custom mtree files for ports (and maybe even then), I still think this
might be a better solution than overriding beforeinstall and manually
invoking '${MAKE} _includeinstall' after creating the directories needed.

G'luck,
Peter

-- 
Do you think anybody has ever had *precisely this thought* before?

Index: src/share/mk/bsd.lib.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.93
diff -u -r1.93 bsd.lib.mk
--- src/share/mk/bsd.lib.mk	2000/10/02 08:48:49	1.93
+++ src/share/mk/bsd.lib.mk	2001/01/24 09:30:01
@@ -260,10 +260,16 @@
 .if !target(install)
 .if !target(beforeinstall)
 beforeinstall: _includeinstall
+.if defined(CREATEDESTDIRS)
+	${MKDIR} ${DESTDIR}${LIBDIR}
 .endif
+.endif
 
 _includeinstall:
 .if defined(INCS)
+.if defined(CREATEDESTDIRS)
+	${MKDIR} ${DESTDIR}${INCDIR}
+.endif
 .for header in ${INCS}
 	cd ${.CURDIR} && \
 	${INSTALL} -C -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} \
Index: src/share/mk/sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/sys.mk,v
retrieving revision 1.46
diff -u -r1.46 sys.mk
--- src/share/mk/sys.mk	2000/04/21 23:51:58	1.46
+++ src/share/mk/sys.mk	2001/01/24 09:30:01
@@ -57,6 +57,8 @@
 .endif
 .endif
 
+MKDIR		?=	mkdir -p
+
 .if defined(%POSIX)
 FC		?=	fort77
 FFLAGS		?=	-O 1


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010124113902.B332>