Skip to content

Commit e876d96

Browse files
authored
Merge pull request #138 from italiangrid/137-installing-voms-on-macos
Make the build more robust against non-standard installations of some dependencies
2 parents e74583c + a17e328 commit e876d96

File tree

14 files changed

+89
-102
lines changed

14 files changed

+89
-102
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
push:
66

77
jobs:
8-
9-
centos7:
8+
9+
el9:
1010
runs-on: ubuntu-latest
11-
container: centos:centos7
11+
container: almalinux:9
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- name: Install packages
1616
run: |
@@ -23,35 +23,35 @@ jobs:
2323
./configure
2424
make
2525
26-
el9:
27-
runs-on: ubuntu-latest
28-
container: almalinux:9
26+
ubuntu2004:
27+
runs-on: ubuntu-20.04
2928
steps:
3029
- uses: actions/checkout@v4
3130

3231
- name: Install packages
3332
run: |
34-
yum install -y epel-release
35-
yum install -y make file automake libtool gcc-c++ openssl-devel gsoap-devel gsoap expat-devel bison
33+
sudo apt update
34+
sudo apt install -y make automake libtool pkg-config g++ libssl-dev libgsoap-dev gsoap libexpat-dev
3635
3736
- name: Build
3837
run: |
3938
./autogen.sh
4039
./configure
4140
make
4241
43-
ubuntu2004:
44-
runs-on: ubuntu-20.04
42+
ubuntu2404:
43+
runs-on: ubuntu-24.04
4544
steps:
4645
- uses: actions/checkout@v4
4746

4847
- name: Install packages
4948
run: |
5049
sudo apt update
51-
sudo apt install make automake libtool pkg-config g++ libssl-dev libgsoap-dev gsoap libexpat-dev
50+
sudo apt install -y make automake libtool pkg-config g++ libssl-dev libgsoap-dev gsoap libexpat-dev
5251
5352
- name: Build
5453
run: |
5554
./autogen.sh
5655
./configure
5756
make
57+

configure.ac

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,7 @@ AC_COMPILER
3434
AX_PTHREAD
3535

3636
PKG_CHECK_MODULES([OPENSSL], [openssl], [AC_DEFINE([OPENSSL_API_COMPAT], [10100], [Build against OpenSSL 1.1 API])])
37-
38-
AC_CHECK_HEADER([expat.h],
39-
[],
40-
[AC_MSG_ERROR("Could not find expat.h. Please install the expat development package.")],
41-
[])
42-
43-
AC_CHECK_LIB([expat],
44-
[XML_ParserCreate],
45-
[EXPAT_LIBS=-lexpat],
46-
[AC_MSG_ERROR("Error checking libexpat. Please install the expat development package.")]
47-
)
48-
49-
AC_SUBST(EXPAT_LIBS)
37+
PKG_CHECK_MODULES([EXPAT],[expat])
5038

5139
AC_ENABLE_DOCS
5240

m4/wsdl2h.m4

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ AC_DEFUN([AC_WSDL2H],
2020
[with_gsoap_wsdl2h="$withval"],
2121
[with_gsoap_wsdl2h="/usr/bin/wsdl2h"])
2222
23-
dnl SOAPCPP flags in addition to what is already set by gsoap
24-
SOAPCPP2="/usr/bin/soapcpp2"
25-
AC_SUBST(SOAPCPP2)
26-
2723
dnl wsdl2h macros. we try to udnerstand which flags need to be used depending
2824
dnl on wsdl2h version
2925
AC_MSG_CHECKING([wsdl2h version])
@@ -65,4 +61,17 @@ AC_DEFUN([AC_WSDL2H],
6561
AC_MSG_RESULT([yes. wsdl2h version $wsdl2h_version detected.])
6662
AC_SUBST(WSDL2H)
6763
AC_SUBST(WSDL2H_FLAGS)
64+
65+
WSDL2H_DIR=$(AS_DIRNAME([$WSDL2H]))
66+
SOAPCPP2=$WSDL2H_DIR/soapcpp2
67+
68+
if ! test -e "$SOAPCPP2"; then
69+
AC_MSG_ERROR("soapcpp2 executable: $SOAPCPP2 does not exist.")
70+
fi
71+
72+
if ! test -x "$SOAPCPP2"; then
73+
AC_MSG_ERROR("soapcpp2 executable: $SOAPCPP2 cannot be executed.")
74+
fi
75+
76+
AC_SUBST([SOAPCPP2])
6877
])

src/ac/Makefile.am

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
AM_CPPFLAGS= \
2+
-I $(top_srcdir)/src/include \
3+
-I $(top_srcdir)/src/sslutils \
4+
$(OPENSSL_CFLAGS)
15

26
noinst_LTLIBRARIES = \
37
libattributes_nog.la
@@ -17,21 +21,13 @@ libattributes_nog_la_SOURCES = $(AC_C_SOURCES) $(AC_CC_SOURCES)
1721

1822
libattributes_nog_la_CFLAGS = \
1923
$(NO_GLOBUS_FLAGS) \
20-
-DNOGLOBUS \
21-
-I $(top_srcdir)/src/include \
22-
-I $(top_builddir)/src/sslutils
24+
-DNOGLOBUS
2325

2426
libattributes_nog_la_CXXFLAGS = \
2527
$(NO_GLOBUS_FLAGS) \
26-
-DNOGLOBUS \
27-
-I $(top_srcdir)/src/include \
28-
-I $(top_builddir)/src/sslutils
28+
-DNOGLOBUS
2929

3030
libattributes_nog_la_LIBADD = \
3131
$(OPENSSL_LIBS)
3232

33-
AM_CPPFLAGS= \
34-
-I $(top_srcdir)/src/include \
35-
-I $(top_srcdir)/src/sslutils
36-
3733
###

src/api/ccapi/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ libvomsapi_la_CXXFLAGS = \
1919
$(PTHREAD_CFLAGS) \
2020
$(NO_GLOBUS_FLAGS) \
2121
-DNOGLOBUS \
22-
-I$(top_srcdir)/src/include
22+
-I$(top_srcdir)/src/include \
23+
$(OPENSSL_CFLAGS)
2324

2425
libvomsapi_la_LDFLAGS = \
2526
-rpath $(libdir) \

src/client/Makefile.am

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
AM_CPPFLAGS = \
2+
-I$(top_srcdir)/src/api/ccapi \
3+
-I$(top_srcdir)/src/include \
4+
-I$(top_srcdir)/src/sslutils \
5+
$(NO_GLOBUS_FLAGS) \
6+
$(EXPAT_CFLAGS) \
7+
$(OPENSSL_CFLAGS)
8+
19
if BUILD_CLIENTS
210
bin_PROGRAMS = voms-proxy-init
311

@@ -14,12 +22,6 @@ voms_proxy_init_LDADD = \
1422
$(top_builddir)/src/common/libutilc_nog.la \
1523
$(EXPAT_LIBS)
1624

17-
AM_CPPFLAGS = -I$(top_srcdir)/src/api/ccapi \
18-
-I$(top_srcdir)/src/include \
19-
-I$(top_srcdir)/src/sslutils \
20-
$(NO_GLOBUS_FLAGS) \
21-
$(EXPAT_CFLAGS)
22-
2325
install-exec-hook:
2426
-ln -s voms-proxy-init $(DESTDIR)$(bindir)/voms-proxy-list
2527
endif

src/client/vomsclient.cc

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extern "C" {
5353
#include <sstream>
5454
#include <algorithm>
5555
#include <string>
56+
#include <random>
5657

5758
#include "options.h"
5859
#include "vomsxml.h"
@@ -138,24 +139,6 @@ extern int proxy_verify_cert_chain(X509 * ucert, STACK_OF(X509) * cert_chain, pr
138139
extern void proxy_verify_ctx_init(proxy_verify_ctx_desc * pvxd);
139140
}
140141

141-
142-
class rand_wrapper
143-
{
144-
145-
public:
146-
147-
rand_wrapper(unsigned int seed)
148-
{
149-
srand(seed);
150-
}
151-
152-
UNUSED(ptrdiff_t operator() (ptrdiff_t max))
153-
{
154-
return static_cast<ptrdiff_t>(rand() % max);
155-
}
156-
157-
};
158-
159142
Client::Client(int argc, char ** argv) :
160143
ignorewarn(false),
161144
failonwarn(false),
@@ -649,10 +632,8 @@ int Client::Run()
649632
/* find servers for that vo */
650633
std::vector<contactdata> servers;
651634
servers = v->FindByAlias(contact.nick());
652-
rand_wrapper rd(time(0));
653-
random_shuffle(servers.begin(),
654-
servers.end(),
655-
rd);
635+
std::default_random_engine rd{std::random_device{}()};
636+
std::shuffle(servers.begin(), servers.end(), rd);
656637

657638
std::string vo = (contact.vo().empty() ? servers[0].vo : contact.vo());
658639

src/common/Makefile.am

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11

2+
AM_CPPFLAGS = \
3+
-I $(top_srcdir)/src/include \
4+
-I $(top_srcdir)/src/sslutils \
5+
$(EXPAT_CFLAGS) \
6+
$(OPENSSL_CFLAGS)
7+
8+
AM_LDFLAGS = \
9+
$(EXPAT_LIBS) \
10+
$(OPENSSL_LIBS)
11+
212
noinst_LTLIBRARIES = \
313
libutilities_nog.la \
414
libutilc_nog.la
@@ -12,23 +22,11 @@ libutilities_nog_la_SOURCES = \
1222

1323
libutilities_nog_la_CFLAGS = \
1424
-DNOGLOBUS \
15-
$(NO_GLOBUS_FLAGS) \
16-
-I $(top_srcdir)/src/include
17-
18-
AM_CPPFLAGS = \
19-
-I $(top_srcdir)/src/include \
20-
-I $(top_srcdir)/src/sslutils \
21-
$(EXPAT_CFLAGS)
22-
23-
AM_LDFLAGS = \
24-
$(EXPAT_LIBS)
25+
$(NO_GLOBUS_FLAGS)
2526

26-
libutilc_nog_la_CPPFLAGS = \
27+
libutilc_nog_la_CFLAGS = \
2728
$(NO_GLOBUS_FLAGS) \
28-
-DNOGLOBUS \
29-
-I $(top_srcdir)/src/include \
30-
-I $(top_srcdir)/src/sslutils \
31-
$(EXPAT_CFLAGS)
29+
-DNOGLOBUS
3230

3331
libutilc_nog_la_SOURCES = \
3432
list.c \

src/server/Makefile.am

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ voms_LDADD = \
4040
$(GSOAP_SSL_PP_LIBS) \
4141
$(OPENSSL_LIBS) \
4242
$(EXPAT_LIBS) \
43-
-ldl
43+
-ldl
4444

45-
voms_CFLAGS = $(GSOAP_SSL_PP_CFLAGS) -DHAVE_OPENSSL_SSL_H
46-
47-
AM_CPPFLAGS = \
45+
voms_CPPFLAGS = \
46+
$(GSOAP_PP_CFLAGS) \
47+
-DHAVE_OPENSSL_SSL_H \
4848
-I$(top_srcdir)/src/include \
4949
-I$(top_srcdir)/src/api/ccapi \
50-
$(NO_GLOBUS_FLAGS)
50+
$(NO_GLOBUS_FLAGS) \
51+
$(OPENSSL_CFLAGS)
52+
5153

5254
endif

src/server/vomsd.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,9 @@ bool VOMSServer::makeAC(vomsresult& vr, EVP_PKEY *key, X509 *issuer,
11371137
if (!existing.empty())
11381138
{
11391139
LOGM(VARP, logh, LEV_DEBUG, T_PRE, "User comes with valid fqans for this VO. Computing fqans intersection.");
1140-
if (fqans.erase(remove_if(fqans.begin(),
1141-
fqans.end(),
1142-
bind2nd(std::ptr_fun(not_in), existing)),
1140+
if (fqans.erase(std::remove_if(fqans.begin(),
1141+
fqans.end(),
1142+
[&](std::string const& s) { return not_in(s, existing); }),
11431143
fqans.end()) != fend)
11441144
{
11451145
LOGM(VARP, logh, LEV_DEBUG, T_PRE, "Only a subset of the requested attributes will be returned.");
@@ -1151,8 +1151,8 @@ bool VOMSServer::makeAC(vomsresult& vr, EVP_PKEY *key, X509 *issuer,
11511151
{
11521152

11531153
LOGM(VARP, logh, LEV_DEBUG, T_PRE, "Dropping generic attributes for fqans which cannot be issued for current request.");
1154-
attribs.erase(remove_if(attribs.begin(), attribs.end(),
1155-
bind2nd(std::ptr_fun(checkinside), fqans)),
1154+
attribs.erase(std::remove_if(attribs.begin(), attribs.end(),
1155+
[&](gattrib const& a) { return checkinside(a, fqans); }),
11561156
attribs.end());
11571157
}
11581158

src/socklib/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ libsock_nog_la_SOURCES = Client.cpp Server.cpp ipv6sock.cc io.cc
1414
libsock_nog_la_CXXFLAGS = \
1515
$(NO_GLOBUS_FLAGS) \
1616
-I $(top_srcdir)/src/include \
17-
-I $(top_srcdir)/src/sslutils
17+
-I $(top_srcdir)/src/sslutils \
18+
$(OPENSSL_CFLAGS)
1819

1920
libsock_nog_la_LIBADD = \
2021
-lcrypto -lssl

src/socklib/ipv6sock.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
# define _POSIX_SOURCE 1
3030
#endif
3131

32+
#ifndef NI_MAXHOST
33+
# define NI_MAXHOST 1025
34+
#endif
35+
#ifndef NI_MAXSERV
36+
# define NI_MAXSERV 32
37+
#endif
38+
3239
#include <sys/types.h>
3340
#include <netdb.h>
3441
#include <sys/socket.h>

src/sslutils/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ endif
4545
libssl_utils_nog_la_SOURCES= $(SOURCES)
4646

4747
libssl_utils_la_CFLAGS = \
48-
-I $(top_srcdir)/src/include
48+
-I $(top_srcdir)/src/include \
49+
$(OPENSSL_CFLAGS)
4950

5051
libssl_utils_nog_la_CFLAGS = \
5152
$(NO_GLOBUS_FLAGS) \
52-
-I $(top_srcdir)/src/include
53+
-I $(top_srcdir)/src/include \
54+
$(OPENSSL_CFLAGS)
5355

5456
###

src/utils/Makefile.am

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ bin_PROGRAMS = \
55
voms-proxy-fake \
66
voms-verify
77

8+
AM_CPPFLAGS = \
9+
-I$(top_srcdir)/src/api/ccapi \
10+
-I$(top_srcdir)/src/include \
11+
-I$(top_srcdir)/src/sslutils \
12+
$(NO_GLOBUS_FLAGS) \
13+
$(OPENSSL_CFLAGS)
814

915
voms_proxy_info_SOURCES = \
1016
voms_proxy_info.cc
@@ -62,10 +68,4 @@ voms_proxy_fake_LDADD = \
6268
$(top_builddir)/src/sslutils/libssl_utils_nog.la \
6369
$(OPENSSL_LIBS)
6470

65-
AM_CPPFLAGS = \
66-
-I$(top_srcdir)/src/api/ccapi \
67-
-I$(top_srcdir)/src/include \
68-
-I$(top_srcdir)/src/sslutils \
69-
$(NO_GLOBUS_FLAGS)
70-
7171
endif

0 commit comments

Comments
 (0)