I have my source tree setup so that I have 3 branches checked out under /usr/src. I then have /sys linked to /usr/src/5x/sys on the 5-STABLE system as shown below: #ls -l / /usr/src /: total 67 : lrwxr-xr-x 1 root wheel 14 Jan 9 13:53 sys -> usr/src/5x/sys : /usr/src: total 97416 drwxrwxr-x 2 root operator 512 Jan 15 15:35 .snap drwxr-xr-x 23 root wheel 1024 Jan 15 16:52 4x drwxr-xr-x 22 root wheel 1024 Jan 15 16:49 5x drwxr-xr-x 22 root wheel 1024 Jan 15 16:49 6x lrwxrwxrwx 1 root wheel 4 Dec 5 01:52 sys -> /sys The problem is that when I perform a make installkernel in /usr/src/5x, the /sys link is reset to /usr/src/sys. I then have to remove this link and change it back to /usr/src/5x/sys, otherwise when I try to build a port that requires the kernel sources, it will fail. Fix: Apply the following patch to -CURRENT, and then MFC to 5-STABLE and 4-STABLE after a few days. How-To-Repeat: Set up your /usr/src as shown above, then do a make installkernel
One optimization change: SYSDIR= ${.CURDIR:S/^\///:S/etc//}sys to SYSDIR= ${.CURDIR:S/^\///:S/etc/sys/} Scot
I would recommend to always make it such that /usr/src are the sources corresponding to what this machine is running. That means either a directory (if you use just one branch) or a symlink to the actual location. The /sys symlink can then be left unchanged, and this patch is not needed. -- Jilles Tjoelker
This is slightly better, potentially: $ svn diff . Index: Makefile =================================================================== --- Makefile (revision 290640) +++ Makefile (working copy) @@ -392,7 +392,7 @@ ${METALOG.add} ; \ done; true .endif - ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys + ${INSTALL_SYMLINK} ${SRCTOP}/sys ${DESTDIR}/sys .if ${MK_MAN} != "no" cd ${DESTDIR}${SHAREDIR}/man; \ for mandir in man*; do \
(In reply to NGie Cooper from comment #3) This works with relative symlinks, i.e. DESTDIR != /: $ svn diff etc/ Index: etc/Makefile =================================================================== --- etc/Makefile (revision 290831) +++ etc/Makefile (working copy) @@ -408,7 +408,7 @@ ${METALOG.add} ; \ done; true .endif - ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys + ${INSTALL_SYMLINK} ${SRCTOP:C/^\///}/sys ${DESTDIR}/sys .if ${MK_MAN} != "no" cd ${DESTDIR}${SHAREDIR}/man; \ for mandir in man*; do \
A commit references this bug: Author: ngie Date: Sun Nov 15 03:04:39 UTC 2015 New revision: 290840 URL: https://svnweb.freebsd.org/changeset/base/290840 Log: Setup the symlink to /sys to mirror one's current source, e.g. if my source tree was /usr/src/svn, /sys would point to usr/src/svn This fixes the assumption that the source tree will always exist at ${DESTDIR}/usr/src MFC after: 1 week PR: 76362 Reported by: Scot Hetzel <swhetzel@gmail.com> Sponsored by: EMC / Isilon Storage Division Changes: head/etc/Makefile
A commit references this bug: Author: ngie Date: Tue Dec 1 06:22:28 UTC 2015 New revision: 291568 URL: https://svnweb.freebsd.org/changeset/base/291568 Log: Revert r290840 This request by the submitter was valid, but unfortunately there is a good deal of concern over breakage when DESTDIR != / or "", i.e. with release media. Making this change correct for all cases would make it markedly more complex than need be Requested by: bdrewery, ian, imp PR: 76362 Changes: head/etc/Makefile
I'm closing the bug because (as noted in r291568), committing this change has definite consequences when DESTDIR != "" and "/". It's best just to deal with explicit brokenness when implicit brokenness in those cases, and as I said elsewhere, I can script the correct behavior if needed.