Bug 277455 - bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV
Summary: bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tijl Coosemans
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2024-03-03 15:34 UTC by Tijl Coosemans
Modified: 2024-03-23 13:47 UTC (History)
2 users (show)

See Also:
antoine: exp-run+


Attachments
patch (13.99 KB, patch)
2024-03-03 15:34 UTC, Tijl Coosemans
no flags Details | Diff
patch2 (23.51 KB, patch)
2024-03-14 20:25 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tijl Coosemans freebsd_committer freebsd_triage 2024-03-03 15:34:55 UTC
Created attachment 248899 [details]
patch

bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV

And remove it from individual ports.  Use WRK_ENV in custom build commands where necessary.

FreeBSD make(1) includes /usr/share/mk/sys.mk and that includes /etc/make.conf if it exists.  This patch disables make.conf when running the upstream build system.  Users can define variables like CFLAGS in make.conf that override ports framework variables.  This can cause problems that are difficult to diagnose.  See for example http://wiki.freebsd.org/MatthiasAndree/LuaLessonsLearnt.

If there are any build customisations made through make.conf that stop working because of this patch then they should be made available by the ports tree through some mechanism, e.g. an option in a port.  The idea is that the ports tree controls the upstream build system and the user then controls the ports tree, possibly using make.conf.
Comment 1 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2024-03-03 15:58:27 UTC
I can confirm this corner case to be true. I have had been utilizing a workaround similar to what is mentioned here.
Comment 3 Tijl Coosemans freebsd_committer freebsd_triage 2024-03-14 20:25:55 UTC
Created attachment 249169 [details]
patch2

Fix failures.  These ports were picking up variables from Poudriere make.conf.
Comment 4 Antoine Brodin freebsd_committer freebsd_triage 2024-03-23 09:06:16 UTC
Exp-run seems fine
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-03-23 11:30:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d7511b9d00742c3e2d57c6c03718c4a6f4cd3e72

commit d7511b9d00742c3e2d57c6c03718c4a6f4cd3e72
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2024-02-29 21:11:00 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2024-03-23 11:19:32 +0000

    Mk/bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV

    And remove it from individual ports.  Use WRK_ENV in custom build
    commands where necessary.

    FreeBSD make(1) includes /usr/share/mk/sys.mk and that includes
    /etc/make.conf if it exists.  This happens when you run make in a port
    directory but it also happens when the upstream build system uses make.
    This commit disables make.conf inclusion in the latter case because
    users can define variables like CFLAGS in make.conf that override ports
    framework variables and this can cause problems that are difficult to
    diagnose.

    If there are any build customisations made through make.conf that stop
    working because of this commit then they should be made available by the
    ports tree through some mechanism, e.g. an option in a port.

    Some ports were picking up variables from Poudriere make.conf and
    required fixes:

    - astro/wmspaceweather x11-clocks/wmcalclock: Add OPSYS to MAKE_ENV.
    - games/zhlt: Add ARCH to MAKE_ENV.
    - graphics/tachyon: Upstream ARCH is not ports tree ARCH.
      Set ALL_TARGET=bsd so upstream ARCH is defined correctly.
      Enable multi-threading support while here.

    PR:             277455
    Exp-run by:     antoine

 Mk/bsd.port.mk                                    |  3 ++-
 archivers/libcabinet/Makefile                     |  2 +-
 astro/wmspaceweather/Makefile                     |  1 +
 devel/libpdel/Makefile                            |  2 +-
 devel/libshhmsg/Makefile                          |  2 +-
 devel/libxalloc/Makefile                          |  2 +-
 devel/linux_libusb/Makefile                       | 14 +++++++-------
 emulators/vmw/Makefile                            |  2 +-
 finance/libstocks/Makefile                        |  6 +++---
 games/libshhcards/Makefile                        |  2 +-
 games/zhlt/Makefile                               |  1 +
 graphics/tachyon/Makefile                         | 10 ++++++----
 graphics/tachyon/files/patch-Makefile (gone)      | 11 -----------
 graphics/tachyon/files/patch-src_threads.c (new)  | 11 +++++++++++
 graphics/tachyon/files/patch-src_threads.h (new)  | 11 +++++++++++
 graphics/tachyon/files/patch-src_trace.c (new)    | 11 +++++++++++
 graphics/tachyon/files/patch-unix_Make-arch (new) | 18 ++++++++++++++++++
 lang/lua51/Makefile                               |  8 --------
 lang/lua52/Makefile                               |  8 --------
 lang/lua53/Makefile                               |  8 --------
 lang/lua54/Makefile                               |  8 --------
 mail/dma/Makefile                                 |  3 +--
 mail/spamilter/Makefile                           |  1 -
 math/libmissing/Makefile                          |  9 +++++----
 math/linpack/Makefile                             |  2 +-
 ports-mgmt/dialog4ports/Makefile                  |  2 +-
 sysutils/dirdiff/Makefile                         |  5 -----
 sysutils/pfstat/Makefile                          |  1 -
 sysutils/pftop/Makefile                           |  1 -
 x11-clocks/wmcalclock/Makefile                    |  1 +
 30 files changed, 86 insertions(+), 80 deletions(-)