Bug 232293

Summary: pkgbase uses (global) ports environment variables in src Makefiles -> conflict
Product: Base System Reporter: Bjoern A. Zeeb <bz>
Component: miscAssignee: freebsd-pkgbase (Nobody) <pkgbase>
Status: Open ---    
Severity: Affects Some People CC: bz, emaste, pi, sak
Priority: --- Keywords: pkgbase
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Bjoern A. Zeeb freebsd_committer freebsd_triage 2018-10-15 16:00:51 UTC
pkgbase uses DISTDIR in Makefile.inc1 as an optional environment variable.

This conflicts with the global ports environment variable;  if someone has DISTDIR set in her environment make packages fails in funny ways.

An initial attempt to fix parts of this problem was done in https://svnweb.freebsd.org/base?view=revision&revision=337991 .
This change was
(a) not enough to fix the entire problem
(b) does not fix the underlying problem of the conflict

It would be advisable to rename the variable in Makefile.inc1 and also fix the "packages" target to work if a DISTDIR (replacement) variable is set.
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-10-20 16:20:06 UTC
A commit references this bug:

Author: tcberner
Date: Sat Oct 20 16:19:12 UTC 2018
New revision: 482589
URL: https://svnweb.freebsd.org/changeset/ports/482589

Log:
  databases/kdb: fix build with GCC-based architectures

  PR:		232293
  Submitted by:	Piotr Kubaj <pkubaj@anongoth.pl>

Changes:
  head/databases/kdb/Makefile
Comment 2 Ed Maste freebsd_committer freebsd_triage 2020-01-18 20:04:26 UTC
Also `DISTDIR` is not set when running plain `make packages`. Log shows paths like /usr/obj/tmp/cirrus-ci-build/amd64.amd64/worldstage//METALOG (.../${DISTDIR}/METALOG)
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2024-03-20 16:02:21 UTC
is this still a valid issue ?
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-03-20 19:42:29 UTC
(In reply to Baptiste Daroussin from comment #3)

Honestly, I cannot say but it's easy to test;  set DISTDIR to /home/bapt/distfiles1234 and see if the build works.

I have since worked around with a symlink in /usr/ports/distfiles to point elsewhere or use a nullfs mount so I don't have to set DISTDIR anymore in the environment.  It's not nice as DISTDIR really was for that in the ports tree and is documented as such in ports(7).

Looking at Makefile.inc1 I do see a lot of DISTDIR still but I cannot say if it used consistently these days so that you at least get any (working) result.