kern/161452: [patch] make PORTS_MODULES compile more sane with proper OSVERSION / SRC_BASE values

Garrett Cooper yanegomi at gmail.com
Sun Oct 9 23:50:10 UTC 2011


>Number:         161452
>Category:       kern
>Synopsis:       [patch] make PORTS_MODULES compile more sane with proper OSVERSION / SRC_BASE values
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 09 23:50:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9-CURRENT
>Organization:
n/a
>Environment:
FreeBSD bayonetta.local 9.0-BETA2 FreeBSD 9.0-BETA2 #0 r225653M: Tue Sep 20 08:36:49 PDT 2011     gcooper at bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA  amd64
>Description:
- Some ports that should be compiled via PORTS_MODULES use OSVERSION to dictate whether or not patches should be applied, etc (x11/nvidia-driver comes to mind).
- Ports also widely uses SRC_BASE to dig up headers and determine values to use in the build.
- Some ports require ports tools in order to build (gmake comes to mind with virtualbox-kmod-ose).

There are several tricky points about this today -- in particular:

sys/conf/kern.post.mk:
1. ports-modules assumes that SYSDIR is in use in ports/Mk ; turns out that SRC_BASE is the preferred variable instead.

ports/Mk/bsd.port.mk:
1. It always assumes that /usr/include/sys/param.h matches what the underlying kernel is running, and thus it's representative of the kernel sources it's linking against; this is false if one's following the proper build and install procedure per the handbook [1].
2. Changing the logic to prefer ${SRC_BASE}/sys/sys/param.h is quite frankly a mistake because SRC_BASE can be different from what's running on the underlying system, and thus compilation will fail.

The solution seems obvious:

PORTSMODULESENV should export...
- A sane value via SRC_BASE.
- OSVERSION should match what's in the src tree.
- PATH must include /usr/local/bin

Issues:

- The attached patch isn't necessarily perfect (having to call realpath on SYSDIR seems it could be improved), but it's necessary because SYSDIR can be /sys and point to a directory != /usr/src, which means that ${SYSDIR:H} would be incorrect ("") and potentially cause the build to fail.
- /usr/ports/Mk/bsd.port.mk should also potentially be fixed, but it would require fixing all stable versions of src, which is tricky because people can update their ports tree and not their src tree, thus causing unnecessary breakage.

1. http://www.freebsd.org/doc/handbook/makeworld.html
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list