Subject: buildlink?.mk files checking for /usr/some/file
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 02/04/2004 16:19:08
Is it okay if buildlink?.mk files that check for /usr/some/file can also
make sure that LOCALBASE is not "/usr" too?

For example, I am building on NetBSD with LOCALBASE as /usr. So some
package needed pthreads. So pth was installed.

Then later openldap needed pthreads, but now the mk/pthread.buildlink3.mk
assumes it is native. And it is not buildlinked:

cc -O2 -I/usr/include/db4
-I/tmp/pkgsrc/databases/openldap/work.bigfour/.buildlink/include -o
apitest apitest.o  ./.libs/libldap_r.a
-L/tmp/pkgsrc/databases/openldap/work.bigfour/openldap-2.1.22/libraries/liblber/.libs
/tmp/pkgsrc/databases/openldap/work.bigfour/openldap-2.1.22/libraries/liblber/.libs/liblber.a
-L/tmp/pkgsrc/databases/openldap/work.bigfour/.buildlink/lib
../../libraries/liblber/.libs/liblber.a
../../libraries/liblutil/liblutil.a -lssl -lcrypto /usr/lib/libpthread.a
cc:
/tmp/pkgsrc/databases/openldap/work.bigfour/.buildlink/lib/libpthread.a:
No such file or directory
*** Error code 1

If LOCALBASE is /usr, pkgsrc should assume that anything in /usr is a
package (even if it is not) at least so buildlinking works.

May I commit this?

--- mk/pthread.buildlink3.mk	2004/01/25 16:17:37	1.2
+++ mk/pthread.buildlink3.mk	2004/02/05 00:07:42
@@ -116,7 +116,8 @@
 #
 .undef PTHREAD_TYPE
 PREFER_NATIVE_PTHREADS?=	YES
-.if exists(/usr/include/pthread.h) && ${PREFER_NATIVE_PTHREADS} == "YES"
+.if (${LOCALBASE} != "/usr") && exists(/usr/include/pthread.h) && \
+	${PREFER_NATIVE_PTHREADS} == "YES"
 PTHREAD_TYPE=	native
 .else
 .  if !empty(PTHREAD_OPTS:Mnative)


Then openldap built and installed fine.

For your information, I have been using pkgsrc with LOCALBASE as /usr on
over ten systems for about 17 months now. This is the first time with
NetBSD as the operating system.

I have several other buildlink?.mk files (like for openssl) with similar
fixes.

   Jeremy C. Reed
   http://bsd.reedmedia.net/