1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

Fix build with -no-common

While here make the substitution of %%PREFIX%% operational (again?).

It has probably been lost due to make makepatch generating patch files
after the substitution by the actual prefix has been performed in the
post-patch target.

To prevent this issue in the future, the substitution of %%PREFIX%%
by the actual prefix is moved in to the post-configure phase, since the
configure command does not rely on the substitution having been performed.
This commit is contained in:
Stefan Eßer 2020-09-04 10:53:01 +00:00
parent 22aed26cec
commit e067ed47e5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=547529
6 changed files with 207 additions and 8 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= relayd
PORTVERSION= 5.5.20140810
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= net
MAINTAINER= koue@chaosophia.net
@ -25,13 +25,6 @@ MAKE_ARGS+= BINDIR=${PREFIX}/sbin \
USERS= _relayd
GROUPS= _relayd
post-patch:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
${WRKSRC}/relayd/relay.c \
${WRKSRC}/relayd/relayd.h \
${WRKSRC}/relayd/relayd.conf.5 \
${WRKSRC}/relayd/relayd.8
post-install:
@${INSTALL_DATA} ${WRKSRC}/../etc/relayd.conf \
${STAGEDIR}${PREFIX}/etc/relayd.conf.sample
@ -48,6 +41,11 @@ BUILD_DEPENDS+= ${NONEXISTENT}:security/libressl:stage
CFLAGS+= -I${STAGEDIR_libressl}${LOCALBASE}/include
post-configure:
${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
${WRKSRC}/relayd/relay.c \
${WRKSRC}/relayd/relayd.h \
${WRKSRC}/relayd/relayd.conf.5 \
${WRKSRC}/relayd/relayd.8
${REINPLACE_CMD} 's|-lssl|${STAGEDIR_libressl}${LOCALBASE}/lib/libssl.a|g' \
${WRKSRC}/relayd/Makefile
${REINPLACE_CMD} 's|-lcrypto|${STAGEDIR_libressl}${LOCALBASE}/lib/libcrypto.a|g' \

View File

@ -0,0 +1,11 @@
--- relayd/parse.y.orig 2014-08-10 20:08:47 UTC
+++ relayd/parse.y
@@ -55,6 +55,8 @@
#include <openssl/ssl.h>
+#define IN_MAIN
+
#include "relayd.h"
#include "http.h"
// FreeBSD #include "snmp.h"

View File

@ -0,0 +1,31 @@
--- relayd/relay.c.orig 2014-08-10 20:08:47 UTC
+++ relayd/relay.c
@@ -2716,12 +2716,12 @@ relay_load_certfiles(struct relay *rlay)
return (-1);
if (snprintf(certfile, sizeof(certfile),
- "/usr/local/etc/ssl/%s:%u.crt", hbuf, useport) == -1)
+ "%%PREFIX%%/etc/ssl/%s:%u.crt", hbuf, useport) == -1)
return (-1);
if ((rlay->rl_ssl_cert = relay_load_file(certfile,
&rlay->rl_conf.ssl_cert_len)) == NULL) {
if (snprintf(certfile, sizeof(certfile),
- "/usr/local/etc/ssl/%s.crt", hbuf) == -1)
+ "%%PREFIX%%/etc/ssl/%s.crt", hbuf) == -1)
return (-1);
if ((rlay->rl_ssl_cert = relay_load_file(certfile,
&rlay->rl_conf.ssl_cert_len)) == NULL)
@@ -2732,11 +2732,11 @@ relay_load_certfiles(struct relay *rlay)
if (useport) {
if (snprintf(certfile, sizeof(certfile),
- "/usr/local/etc/ssl/private/%s:%u.key", hbuf, useport) == -1)
+ "%%PREFIX%%/etc/ssl/private/%s:%u.key", hbuf, useport) == -1)
return -1;
} else {
if (snprintf(certfile, sizeof(certfile),
- "/usr/local/etc/ssl/private/%s.key", hbuf) == -1)
+ "%%PREFIX%%/etc/ssl/private/%s.key", hbuf) == -1)
return -1;
}
if ((rlay->rl_ssl_key = ssl_load_key(env, certfile,

View File

@ -0,0 +1,20 @@
--- relayd/relayd.8.orig 2014-08-10 20:08:47 UTC
+++ relayd/relayd.8
@@ -114,7 +114,7 @@ will run in the foreground and log to
.It Fl f Ar file
Specify an alternative configuration file.
The default is
-.Pa /usr/local/etc/relayd.conf .
+.Pa %%PREFIX%%/etc/relayd.conf .
.It Fl n
Configtest mode.
Only check the configuration file for validity.
@@ -123,7 +123,7 @@ Produce more verbose output.
.El
.Sh FILES
.Bl -tag -width "/var/run/relayd.sockXX" -compact
-.It /usr/local/etc/relayd.conf
+.It %%PREFIX%%/etc/relayd.conf
Default configuration file.
.It /var/run/relayd.sock
.Ux Ns -domain

View File

@ -0,0 +1,88 @@
--- relayd/relayd.conf.5.orig 2014-08-10 20:08:47 UTC
+++ relayd/relayd.conf.5
@@ -90,7 +90,7 @@ Additional configuration files can be included with th
.Ic include
keyword, for example:
.Bd -literal -offset indent
-include "/usr/local/etc/relayd.conf.local"
+include "%%PREFIX%%/etc/relayd.conf.local"
.Ed
.Sh MACROS
Macros can be defined that will later be expanded in context.
@@ -304,7 +304,7 @@ Execute an external program to check the host state.
The program will be executed for each host by specifying the hostname
on the command line:
.Bd -literal -offset indent
-/usr/local/bin/checkload.pl front-www1.private.example.com
+%%PREFIX%%/bin/checkload.pl front-www1.private.example.com
.Ed
.Pp
.Xr relayd 8
@@ -624,18 +624,18 @@ If the
keyword is present, the relay will accept connections using the
encrypted SSL protocol.
The relay will attempt to look up a private key in
-.Pa /usr/local/etc/ssl/private/address:port.key
+.Pa %%PREFIX%%/etc/ssl/private/address:port.key
and a public certificate in
-.Pa /usr/local/etc/ssl/address:port.crt ,
+.Pa %%PREFIX%%/etc/ssl/address:port.crt ,
where
.Ar address
is the specified IP address and
.Ar port
is the specified port that the relay listens on.
If these files are not present, the relay will continue to look in
-.Pa /usr/local/etc/ssl/private/address.key
+.Pa %%PREFIX%%/etc/ssl/private/address.key
and
-.Pa /usr/local/etc/ssl/address.crt .
+.Pa %%PREFIX%%/etc/ssl/address.crt .
See
.Xr ssl 8
for details about SSL server certificates.
@@ -1256,18 +1256,18 @@ as detailed for the
directive above.
.El
.Sh FILES
-.Bl -tag -width "/usr/local/etc/ssl/private/address.keyXX" -compact
-.It Pa /usr/local/etc/relayd.conf
+.Bl -tag -width "%%PREFIX%%/etc/ssl/private/address.keyXX" -compact
+.It Pa %%PREFIX%%/etc/relayd.conf
.Xr relayd 8
configuration file.
.Pp
.It Pa /etc/services
Service name database.
.Pp
-.It Pa /usr/local/etc/ssl/address.crt
-.It Pa /usr/local/etc/ssl/address:port.crt
-.It Pa /usr/local/etc/ssl/private/address.key
-.It Pa /usr/local/etc/ssl/private/address:port.key
+.It Pa %%PREFIX%%/etc/ssl/address.crt
+.It Pa %%PREFIX%%/etc/ssl/address:port.crt
+.It Pa %%PREFIX%%/etc/ssl/private/address.key
+.It Pa %%PREFIX%%/etc/ssl/private/address:port.key
Location of the relay SSL server certificates, where
.Ar address
is the configured IP address
@@ -1275,7 +1275,7 @@ and
.Ar port
is the configured port number of the relay.
.Pp
-.It Pa /usr/local/etc/ssl/cert.pem
+.It Pa %%PREFIX%%/etc/ssl/cert.pem
Default location of the CA bundle that can be used with
.Xr relayd 8 .
.El
@@ -1383,8 +1383,8 @@ section.
To start, first generate a new local CA key and certificate:
.Bd -literal -offset indent
# openssl req -x509 -days 365 -newkey rsa:2048 \e
- -keyout /usr/local/etc/ssl/private/ca.key \e
- -out /usr/local/etc/etc/ssl/ca.crt
+ -keyout %%PREFIX%%/etc/ssl/private/ca.key \e
+ -out %%PREFIX%%/etc/etc/ssl/ca.crt
.Ed
.Pp
An SSL server key and self-signed cert for 127.0.0.1 are also required;

View File

@ -0,0 +1,51 @@
--- relayd/relayd.h.orig 2014-08-10 20:08:47 UTC
+++ relayd/relayd.h
@@ -21,6 +21,12 @@
#ifndef _RELAYD_H
#define _RELAYD_H
+#ifdef IN_MAIN
+#define EXTERN
+#else
+#define EXTERN extern
+#endif
+
#include <sys/tree.h>
#include <sys/param.h> /* MAXHOSTNAMELEN */
@@ -34,7 +40,7 @@
#include <imsg.h>
#ifdef __FreeBSD__
-#define CONF_FILE "/usr/local/etc/relayd.conf"
+#define CONF_FILE "%%PREFIX%%/etc/relayd.conf"
#else
#define CONF_FILE "/etc/relayd.conf"
#endif
@@ -867,11 +873,13 @@ struct control_sock {
};
TAILQ_HEAD(control_socks, control_sock);
-struct {
+struct control_state {
struct event ev;
int fd;
-} control_state;
+};
+EXTERN struct control_state control_state;
+
enum blockmodes {
BM_NORMAL,
BM_NONBLOCK
@@ -978,7 +986,9 @@ enum privsep_procid {
PROC_PFE,
PROC_CA,
PROC_MAX
-} privsep_process;
+};
+
+EXTERN enum privsep_procid privsep_process;
/* Attach the control socket to the following process */
#define PROC_CONTROL PROC_PFE