Bug 271214 - net-mgmt/net-snmp: several build-related ports bugs
Summary: net-mgmt/net-snmp: several build-related ports bugs
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Ryan Steinmetz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-02 22:46 UTC by Enji Cooper
Modified: 2023-05-03 00:01 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (zi)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2023-05-02 22:46:37 UTC
As part of getting OpenSSL from ports and base to play well with one another, I moved OpenSSL from ports to /usr/local/lib/openssl . This has exposed the fact that LDFLAGS from USES+=ssl isn't honored/passed through to configure properly.

Moreover, the port uses PKG_PREFIX, a non-existent variable, instead of PREFIX or LOCALBASE.

```
$ (cd ../freebsd-ports/net-mgmt/net-snmp; make -VPKG_PREFIX)

$
```

The patch below addresses both of those issues:
```
diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile
index 0af9bccd05ee..e2e91ff73eac 100644
--- a/net-mgmt/net-snmp/Makefile
+++ b/net-mgmt/net-snmp/Makefile
@@ -50,7 +50,7 @@ CPE_PRODUCT=  net-snmp
 USE_PERL5=     build run
 USE_CSTD=      c99
 
-CFLAGS+=       -I${LOCALBASE}/include -I${PKG_PREFIX}/include
+CFLAGS+=       -I${LOCALBASE}/include -I${PREFIX}/include
 LDFLAGS+=      -L${LOCALBASE}/lib
 CONFIGURE_ENV+=        PERLPROG="${PERL}" PSPROG="${PS_CMD}" SED="${SED}"
 CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \
@@ -60,7 +60,7 @@ CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \
                --with-logfile="${NET_SNMP_LOGFILE}" \
                --with-persistent-directory="${NET_SNMP_PERSISTENTDIR}" \
                --with-gnu-ld --without-libwrap \
-               --with-ldflags="-lm -lkvm -ldevstat -L${PKG_PREFIX}/lib -L${LOCALBASE}/lib ${LCRYPTO}"
+               --with-ldflags="-lm -lkvm -ldevstat -L${PREFIX}/lib ${LDFLAGS}"
 SUB_FILES=     pkg-message
 
 .if !defined(WITHOUT_SSP)
```
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2023-05-02 22:48:19 UTC
Oh, interesting... those libraries shouldn't be defined there to begin with either.
Comment 2 Enji Cooper freebsd_committer freebsd_triage 2023-05-02 22:50:44 UTC
FWIW though... they really shouldn't be defined on the command-line using LIBS or --with-libs -- that would cause a boatload of overlinking with programs that shouldn't be done to begin with. autoconf should be adjusted to detect and pass through the libraries instead.
Comment 3 Enji Cooper freebsd_committer freebsd_triage 2023-05-03 00:01:09 UTC
Here's a complete patch from my gist (test in progress): https://gist.github.com/ngie-eign/a7be390d21989e343bc4979cfe6f6c07 .