NetBSD Problem Report #42850

From obata@lins.jp  Sat Feb 20 06:58:35 2010
Return-Path: <obata@lins.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id AF62063B11D
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 20 Feb 2010 06:58:35 +0000 (UTC)
Message-Id: <20100220065832.9EAB06B5C17@mail.lins.jp>
Date: Sat, 20 Feb 2010 15:58:32 +0900 (JST)
From: obata@lins.jp
Reply-To: obata@lins.jp
To: gnats-bugs@gnats.NetBSD.org
Subject: Haiku OS support for devel/bmake
X-Send-Pr-Version: 3.95

>Number:         42850
>Category:       pkg
>Synopsis:       Haiku OS support for devel/bmake
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    sjg
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 20 07:00:00 +0000 2010
>Closed-Date:    Sat Apr 24 15:47:04 +0000 2010
>Last-Modified:  Sun Apr 25 22:30:02 +0000 2010
>Originator:     OBATA Akio
>Release:        Haiku R1/alpha1
>Organization:
>Environment:
System: Haiku shredder 1 r33109 Sep 12 2009 17:45:45 BePC Haiku
Architecture: x86-32
Machine: BePC
>Description:
	Failed to build devel/bmake on Haiku R1/alpha1.
	This issue is the last stopper of bootstrap pkgsrc on Haiku OS.

	1) arch.c
	   Haiku does not have "ar.h", so need to define struct ar_hdr, ARMAG
	   and SARMAG with standard values if not exists.
	   (for struct ar_hdr, maybe better to detect in configure).

	2) os.h
	   Need to detect MACHINE_ARCH for Haiku
	   (neither uname -m nor -p return suitable variables).

	3) unit-tests
	   In unit-tests/modmisc, it is expected that /usr/bin and /usr/sbin
	   exists, but Haiku OS does not have those directories. 
	   So function correctly, but not as expected, then failed to unit test.

>How-To-Repeat:
	bootstrap pkgsrc on Haiku OS.
>Fix:
	Following patch fixes 1 and 2.
	for 3, need to change test patterns, or disable unit-tests on Haiku.
	(I already sent to sjg@ about a month ago, but no response)

Unit test now tweaked accordingly.

Index: arch.c
===================================================================
RCS file: /cvsroot/pkgsrc/devel/bmake/files/arch.c,v
retrieving revision 1.4
diff -u -r1.4 arch.c
--- arch.c	18 Sep 2009 21:27:25 -0000	1.4
+++ arch.c	22 Jan 2010 13:02:26 -0000
@@ -139,6 +139,19 @@
 #include    <ctype.h>
 #ifdef HAVE_AR_H
 #include    <ar.h>
+#else
+struct ar_hdr {
+        char ar_name[16];               /* name */
+        char ar_date[12];               /* modification time */
+        char ar_uid[6];                 /* user id */
+        char ar_gid[6];                 /* group id */
+        char ar_mode[8];                /* octal file permissions */
+        char ar_size[10];               /* size in bytes */
+#ifndef ARFMAG
+#define ARFMAG  "`\n"
+#endif
+        char ar_fmag[2];                /* consistency check */
+};
 #endif
 #if defined(HAVE_RANLIB_H) && !(defined(__ELF__) || defined(NO_RANLIB))
 #include    <ranlib.h>
@@ -204,6 +217,12 @@
 #ifndef  AR_FMAG
 # define AR_FMAG ar_fmag
 #endif
+#ifndef ARMAG
+# define ARMAG	"!<arch>\n"
+#endif
+#ifndef SARMAG
+# define SARMAG	8
+#endif

 #define AR_MAX_NAME_LEN	    (sizeof(arh.AR_NAME)-1)

Index: os.sh
===================================================================
RCS file: /cvsroot/pkgsrc/devel/bmake/files/os.sh,v
retrieving revision 1.3
diff -u -r1.3 os.sh
--- os.sh	9 Mar 2008 19:54:29 -0000	1.3
+++ os.sh	22 Jan 2010 13:02:26 -0000
@@ -177,6 +177,13 @@
 	x86pc)	MACHINE_ARCH=i386;;
 	esac
 	;;
+Haiku)
+	case $MACHINE in
+	BeBox)	MACHINE_ARCH=powerpc;;
+	BeMac)	MACHINE_ARCH=powerpc;;
+	BePC)	MACHINE_ARCH=i386;;
+	esac
+	;;
 esac

 HOSTNAME=${HOSTNAME:-`( hostname ) 2>/dev/null`}

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Sun, 21 Feb 2010 15:41:22 +0000
Responsible-Changed-Why:
Over to maintainer.


From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake)
Date: Wed, 21 Apr 2010 22:42:06 +0900

 devel/bmake has been updated to 20100414, it contains Haiku OS support.

 But another issues are introduced.

 In boot-strap, before self test, MAKESYSPATH is set:
 MAKESYSPATH="$share_dir/mk:/usr/share/mk"

 ${share_dir} is set as:
 share_dir=${share_dir:-`ShareDir $prefix`}"

 On bootstrap, ${prefix} is not set, so:
 share_dir=/share
 MAKESYSPATH="share/mk:/usr/share/mk"

 Then self test will be failed with:
 bmake: no system rules (sys.mk).

 This issue will be happened on all platforms without /usr/share/mk,
 and maybe on some platforms that has /usr/share/mk but incompatible with bmake.

From: Tobias Nygren <tnn@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake)
Date: Wed, 21 Apr 2010 18:06:03 +0200

 On Wed, 21 Apr 2010 13:45:02 +0000 (UTC)
 "OBATA Akio" <obache@netbsd.org> wrote:

 >  Then self test will be failed with:
 >  bmake: no system rules (sys.mk).

 Confirming this issue on Linux. Removing the MAKESYSPATH export is a
 solution.

Responsible-Changed-From-To: joerg->sjg
Responsible-Changed-By: joerg@NetBSD.org
Responsible-Changed-When: Wed, 21 Apr 2010 18:07:07 +0000
Responsible-Changed-Why:
sjg: The remaining issue is about the default search path in
the portable bmake. Care to take a look at it?


From: "Simon J. Gerraty" <sjg@juniper.net>
To: <gnats-bugs@NetBSD.org>
Cc: joerg@NetBSD.org, pkgsrc-bugs@NetBSD.org, gnats-admin@NetBSD.org,
   obata@lins.jp
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Wed, 21 Apr 2010 16:28:59 -0700

 >sjg: The remaining issue is about the default search path in
 >the portable bmake. Care to take a look at it?

 Sure I can see the test causing this.
 We just need to ensure the result is consistent.

From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake)
Date: Thu, 22 Apr 2010 12:58:40 +0100

 On Wed, Apr 21, 2010 at 01:45:02PM +0000, OBATA Akio wrote:
 >  devel/bmake has been updated to 20100414, it contains Haiku OS support.
 >  
 >  But another issues are introduced.
 >  
 >  In boot-strap, before self test, MAKESYSPATH is set:
 >  MAKESYSPATH="$share_dir/mk:/usr/share/mk"
 >  
 >  ${share_dir} is set as:
 >  share_dir=${share_dir:-`ShareDir $prefix`}"
 >  
 >  On bootstrap, ${prefix} is not set, so:
 >  share_dir=/share
 >  MAKESYSPATH="share/mk:/usr/share/mk"
 >  
 >  Then self test will be failed with:
 >  bmake: no system rules (sys.mk).

 The build under Mac OS X (Darwin) fails with a different error.
 While Mac OS X provides "/usr/share/mk" it is clearly not good
 enough to make the unit tests work.

 	Kind regards

 -- 
 Matthias Scheler                                  http://zhadum.org.uk/

From: "Simon J. Gerraty" <sjg@juniper.net>
To: <gnats-bugs@NetBSD.org>
Cc: gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org, obata@lins.jp
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Thu, 22 Apr 2010 07:45:13 -0700

 > >  On bootstrap, ${prefix} is not set, so:
 > >  share_dir=/share
 > >  MAKESYSPATH="share/mk:/usr/share/mk"
 > >  
 > >  Then self test will be failed with:
 > >  bmake: no system rules (sys.mk).

 So bootstrap should provide mksrc.  
 The latest version of bmake adds support for FindHereOrAbove
 so you can run boot-strap -m .../mk
 I've fixed ShareDir so it won't return /share (unless it exists),
 so if neither share_dir nor /usr/share contain a mk dir, we
 can use FindHereOrAbove to look for one, but it would be better to be
 told where.

 > The build under Mac OS X (Darwin) fails with a different error.
 > While Mac OS X provides "/usr/share/mk" it is clearly not good
 > enough to make the unit tests work.

 /usr/share/mk shouldn't be used on anything but NetBSD, so using
 .../mk might be best in this case too?

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake)
Date: Thu, 22 Apr 2010 17:27:30 +0200

 On Thu, Apr 22, 2010 at 03:00:08PM +0000, Simon J. Gerraty wrote:
 >  /usr/share/mk shouldn't be used on anything but NetBSD, so using
 >  .../mk might be best in this case too?

 /usr/share/mk should never be picked up for the pkgsrc usage. What I
 don't understand is why it fails at that point. The temporary prefix is
 already supposed to be populated at that point.

 Joerg

From: "Simon J. Gerraty" <sjg@juniper.net>
To: <gnats-bugs@NetBSD.org>
Cc: gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org, obata@lins.jp
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Thu, 22 Apr 2010 10:36:42 -0700

 FWIW I just confirmed that with a minor teak, we can run the unit-tests
 without any *.mk.  This is my current patch for this PR:

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/Makefile,v
 retrieving revision 1.49
 diff -u -p -r1.49 Makefile
 --- Makefile	14 Apr 2009 22:15:23 -0000	1.49
 +++ Makefile	22 Apr 2010 16:46:09 -0000
 @@ -37,4 +37,4 @@ DPADD+=${LIBUTIL}

  # A simple unit-test driver to help catch regressions
  accept test:
 -	cd ${.CURDIR}/unit-tests && ${.MAKE:S,^./,${.CURDIR}/,} TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
 +	cd ${.CURDIR}/unit-tests && ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
 Index: unit-tests/Makefile
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/unit-tests/Makefile,v
 retrieving revision 1.26
 diff -u -p -r1.26 Makefile
 --- unit-tests/Makefile	8 Apr 2010 17:41:29 -0000	1.26
 +++ unit-tests/Makefile	22 Apr 2010 16:46:09 -0000
 @@ -53,9 +53,10 @@ ${SUBFILES}:
  clean:
  	rm -f *.out *.fail *.core

 -.include <bsd.obj.mk>
 +.-include <bsd.obj.mk>

  TEST_MAKE?= ${.MAKE}
 +TOOL_SED?= sed

  # The driver.
  # We always pretend .MAKE was called 'make' 
 Index: unit-tests/modmisc
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/unit-tests/modmisc,v
 retrieving revision 1.4
 diff -u -p -r1.4 modmisc
 --- unit-tests/modmisc	11 May 2006 15:37:07 -0000	1.4
 +++ unit-tests/modmisc	22 Apr 2010 16:46:09 -0000
 @@ -2,7 +2,7 @@
  #
  # miscellaneous modifier tests

 -path=:/bin:/usr/bin::/sbin:/usr/sbin:.:/home/user/bin:.
 +path=:/bin:/usr/bin::/:.:/user/bin:.
  # strip cwd from path.
  MOD_NODOT=S/:/ /g:N.:ts:
  # and decorate, note that $'s need to be doubled. Also note that 
 Index: unit-tests/test.exp
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/unit-tests/test.exp,v
 retrieving revision 1.32
 diff -u -p -r1.32 test.exp
 --- unit-tests/test.exp	21 Apr 2010 04:25:28 -0000	1.32
 +++ unit-tests/test.exp	22 Apr 2010 16:46:09 -0000
 @@ -112,14 +112,14 @@ LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/l
  LIB=e X_LIBS:M*/lib${LIB}.a is "/tmp/libe.a"
  LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A"
  Mscanner=OK
 -path=':/bin:/usr/bin::/sbin:/usr/sbin:.:/home/user/bin:.'
 -path='/bin:/usr/bin:/sbin:/usr/sbin:/home/user/bin'
 -path='/bin:/usr/bin:/sbin:/usr/sbin:/homes/user/bin'
 -path='/bin':'/usr/bin':'/sbin':'/usr/sbin':'/home/user/bin'
 -path='/bin':'/usr/bin':'/sbin':'/usr/sbin':'/homes/user/bin'
 +path=':/bin:/usr/bin::/:.:/user/bin:.'
 +path='/bin:/usr/bin:/:/user/bin'
 +path='/bin:/usr/bin:/:/user/bin'
 +path='/bin':'/usr/bin':'/':'/user/bin'
 +path='/bin':'/usr/bin':'/':'/user/bin'
  path_/usr/xbin=/opt/xbin/
 -paths=/bin /usr/bin /sbin /usr/sbin /homes/user/bin /opt/xbin
 -PATHS=/BIN /USR/BIN /SBIN /USR/SBIN /HOMES/USER/BIN /OPT/XBIN
 +paths=/bin /usr/bin / /user/bin /opt/xbin
 +PATHS=/BIN /USR/BIN / /USER/BIN /OPT/XBIN
  LIST      = one two three four five six seven eight nine ten
  LIST:O    = eight five four nine one seven six ten three two
  LIST:Ox   = Ok


From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake)
Date: Fri, 23 Apr 2010 15:00:55 +0200

 On Thu, Apr 22, 2010 at 05:55:02PM +0000, Simon J. Gerraty wrote:
 >  FWIW I just confirmed that with a minor teak, we can run the unit-tests
 >  without any *.mk.  This is my current patch for this PR:

 I'd use -m /dev/null for this purpose.

 Joerg

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Fri, 23 Apr 2010 22:15:33 +0900

 On Fri, 23 Apr 2010 02:55:02 +0900, Simon J. Gerraty <sjg@juniper.net> wrote:

 >  FWIW I just confirmed that with a minor teak, we can run the unit-tests
 >  without any *.mk.  This is my current patch for this PR:

 Even if no *.mk is included from Makefile, bmake will try to include sys.mk first,
 so result in same error.

From: "Simon J. Gerraty" <sjg@juniper.net>
To: <gnats-bugs@NetBSD.org>
Cc: gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org, obata@lins.jp
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Fri, 23 Apr 2010 12:52:26 -0700

 > Even if no *.mk is included from Makefile, bmake will try to include sys.mk f
 >irst,
 > so result in same error.

 No, that's what -r is for.

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Sat, 24 Apr 2010 21:11:05 +0900

 On Sat, 24 Apr 2010 19:10:08 +0900, Simon J. Gerraty <sjg@juniper.net> wrote:

 >  > Even if no *.mk is included from Makefile, bmake will try to include sys.mk f
 >  >irst,
 >  > so result in same error.
 > No, that's what -r is for.

  from boot-strap script, just do "./bmake test || exit 1", no -r.

 -- 
 OBATA Akio / obache@NetBSD.org

State-Changed-From-To: open->closed
State-Changed-By: sjg@NetBSD.org
State-Changed-When: Sat, 24 Apr 2010 15:47:04 +0000
State-Changed-Why:
Sumbitter confirms unit-tests pass


From: "Simon J. Gerraty" <sjg@juniper.net>
To: <gnats-bugs@NetBSD.org>
Cc: gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org, obata@lins.jp
Subject: Re: pkg/42850 (Haiku OS support for devel/bmake) 
Date: Sun, 25 Apr 2010 15:25:00 -0700

 Ah sorry I was thinking within unit-tests.
 Using -r -m /dev/null works from boot-strap provided we 
 use .-include for bsd.prog.mk etc.



>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.