To:	mirror176@@@cox.net
cc: jhs@@@berklix.com
Date: Thu, 19 Sep 2013 14:28:54 +0200
Subject:	sysutils/fusefs-kmod
From:		"Julian H. Stacey" <jhs@@@berklix.com>
Organization: http://berklix.com BSD Linux Unix Consultancy, Munich Germany
Fcc:		sent
User-agent:	EXMH on FreeBSD http://www.berklix.com/free/
X-URL:		http://www.berklix.com/~jhs/cv/

Hi mirror176@@@cox.net
Re. FreeBSD ports/sysutils/fusefs-kmod 

This builds OK on my 8.1 & 9.1 but I saw a problem on 
6.4-RELEASE (yes EOL'd but using it as last rel. that had isdn built in)
It did not find opt_global.h : a problem with obj & /sys.

I looked at
 /FreeBSD/branches/amd64/-current/ports/sysutils/fusefs-kmod/Makefile

I dont see anything difference there that would affect things below,
so maybe the improvement is in the ports/Mk ?
or maybe my 6.4-RELEASE host might have caught an obj problem from a different
combination of paths that might still recur elsewhere ?

Maybe it's a question of how well populated an obj one has, 
& if testing existence of {SRC_BASE}/sys/Makefile is a sufficient test ?

On my 9.1-RELEASE src & current ports:
 cd /usr/src/sys ; find . -name opt_global.h
  ./amd64/compile/LAPR.small/opt_global.h
  ./amd64/compile/LAPR.small/modules/usr/src/sys/modules/lmc/opt_global.h
  ./amd64/compile/LAPR.small/modules/usr/src/sys/modules/pf/opt_global.h
 cd /usr/obj; find . -name opt_global.h	# nothing

On my 6.4 src/ & 6.4 ports/
 cd /usr/obj/`cd /usr/src;/bin/pwd`		# /usr/obj/usr1/src
 find . -type f -print | sort | grep /sys/ 	# only shows ./sys/boot/
						# No ./sys/my_kernel_name
 I had to manually:
	cd /usr/obj/usr1/src/sys; ln -s /usr1/src/sys/i386/compile/MART.small
 To avoid this failure:
  cd /usr/ports/sysutils/fusefs-kmod ; make
  	===>  Building for fusefs-kmod-0.3.9.p1.20080208_2
  	===> fuse_module (all)
  	Warning: Object directory not changed from original /usr1/ports/sysutils/fusefs-kmod/work/fuse4bsd-498acaef33b0/fuse_module
  	cc -O2 -fno-strict-aliasing -march=i586 -pipe -march=i586 -pipe -DKERNCONFDIR="\"/usr/obj/usr1/src/sys/MART.small\"" -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I-  -I../include -I/usr/obj/usr1/src/sys/MART.small -I. -I@ -I@/contrib/altq -I@/../include -finline-limit=8000 -fno-common  -mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -std=c99 -c fuse_main.c
  	In file included from fuse_main.c:5:
  	./config.h:2:24: opt_global.h: No such file or directory
  	*** Error code 1
  	
  	Stop in /usr1/ports/sysutils/fusefs-kmod/work/fuse4bsd-498acaef33b0/fuse_module.

I have written a patch that's not quite right, but will help at least me
next time I get stuck, FYI appended.

http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/ports/gen/sysutils/fusefs-kmod/Makefile.REL=6.4-RELEASE.diff

*** 6.4-RELEASE/ports/sysutils/fusefs-kmod/Makefile	Wed Sep 18 15:24:38 2013
--- new-generic/ports/sysutils/fusefs-kmod/Makefile	Wed Sep 18 15:47:01 2013
***************
*** 19,24 ****
--- 19,32 ----
  
  BUILD_DEPENDS=	fusefs-libs>2.4.1:${PORTSDIR}/sysutils/fusefs-libs
  
+ BUILD_DEPENDS+=/usr/src/sys/${KERNCONF}/
+ # For /sys/${MACHTYPE}/compile/${KERNCONF}/opt_global.h
+ # Produced by :
+ #		grep KERNCONF /etc/make.conf
+ #		cd /usr/src/sys/${MACHTYPE}/conf; config ${KERNCONF}
+ #		cd ../compile/${KERNCONF} ; make cleandepend; make depend
+ # Note can not use ${SRC_BASE} as not defined in 6.4-RELEASE /usr/ports/Mk/* or /usr/share/mk/*
+ 
  .if !defined(NOPORTDOCS)
  BUILD_DEPENDS+=	deplate:${PORTSDIR}/textproc/ruby-deplate
  .endif
***************
*** 64,69 ****
--- 71,80 ----
  .if !exists(${SRC_BASE}/sys/Makefile)
  IGNORE=		requires the Kernel source to be installed. Set SRC_BASE if it is not in /usr/src
  .endif
+ .if !exists(${SRC_BASE}/sys/${MACHTYPE}/compile/${KERNCONF}/opt_global.h)
+ IGNORE=		requires the Kernel source to be installed. Set SRC_BASE if it is not in /usr/src
+ IGNORE+=		Also do : cd /usr/obj/usr/src/sys; ln -s /usr1/src/sys/i386/compile/${KERNCONF}
+ .endif
  .if !exists(${SRC_BASE}/sbin/mount)
  IGNORE=		requires the userland sources to be installed. Set SRC_BASE if it is not in /usr/src
  .endif

Cheers,
Julian
------------

After sending the above mail I tried this:
	cd /usr/src/sys/i386/compile/MART.small ; make
	cd ..
	make clean
	cd ..
	cd ..
	make clean ; make cleandir ; make clean ; make obj ; make
	cd /usr/src
	find . -name \*.o -print
with result:
	./sys/i386/compile/MART.small/542_files.o
	./sys/i386/compile/MART.small/modules/usr1/src/sys/modules/various_subdir_637_files.o
