Skip to content

Commit 2bee31b

Browse files
authored
build: add barebones alternative build system support (GNU Autotools) (#46)
* build: move sole reference to FetchContent to python-bindings * dashbls: avoid macro conflict by renaming conflicting variable * build: add barebones alternative build system support (GNU Autotools) * build: add support for some definition-based build switches * build: add support for gmp detection and backend * ci: add support for building with GNU Autotools * ci: temporarily drop rdrnd support for autotools builds
1 parent 49921f1 commit 2bee31b

18 files changed

+3097
-9
lines changed

.github/workflows/build-test.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ concurrency:
1717

1818
jobs:
1919
build:
20-
name: ${{ matrix.os }}, ${{ matrix.compiler.cc }}, ${{ matrix.backend }} backend
20+
name: ${{ matrix.os }}, ${{ matrix.builder }}, ${{ matrix.compiler.cc }}, ${{ matrix.backend }} backend
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
fail-fast: false
2424
matrix:
2525
os: [ macos-11, ubuntu-20.04 ]
26+
builder: [ cmake, autotools ]
2627
compiler:
2728
- cc: gcc
2829
cxx: g++
@@ -51,12 +52,20 @@ jobs:
5152
brew install autoconf automake gmp
5253
5354
- name: Build library using CMake
55+
if: startsWith(matrix.builder, 'cmake')
5456
run: |
5557
mkdir -p build && cd build
5658
CC=${{ matrix.compiler.cc }} CXX=${{ matrix.compiler.cxx }} cmake .. -DBUILD_BLS_PYTHON_BINDINGS=0 -DARITH=${{ matrix.backend }}
5759
cmake --build . -- -j 6
5860
mv src/runtest ..
5961
62+
- name: Build library using GNU Autotools
63+
if: startsWith(matrix.builder, 'autotools')
64+
run: |
65+
./autogen.sh
66+
CC=${{ matrix.compiler.cc }} CXX=${{ matrix.compiler.cxx }} ./configure --with-backend=${{ matrix.backend }}
67+
make -j8
68+
6069
- name: Run tests
6170
run: ./runtest
6271

.gitignore

+54-4
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ depends/relic/CTestTestfile.cmake
2727
depends/relic/bench/CTestTestfile.cmake
2828
depends/relic/bin
2929
depends/relic/include/relic_conf.h
30+
depends/relic/include/relic_conf.h.in
31+
depends/relic/include/stamp-h1
3032
depends/relic/test/CTestTestfile.cmake
3133
contrib/gmp-6.1.2/
3234

3335
.idea
3436
.vscode
35-
blstest
36-
blstest.*
37-
blsbench
38-
blsbench.*
37+
runtest
38+
runtest.*
39+
runbench
40+
runbench.*
3941

4042
.dirstamp
4143
.libs
@@ -51,6 +53,8 @@ blsbench.*
5153
*.a
5254
*.pb.cc
5355
*.pb.h
56+
*.lo
57+
*.la
5458

5559
**/.DS_Store
5660

@@ -61,3 +65,49 @@ yarn-error.log
6165

6266
.vs/
6367
out/
68+
69+
Makefile.in
70+
/ar-lib
71+
/mdate-sh
72+
/py-compile
73+
/test-driver
74+
/ylwrap
75+
.deps/
76+
.dirstamp
77+
aclocal.m4
78+
autom4te.cache/
79+
build-aux/config.guess
80+
build-aux/config.sub
81+
build-aux/depcomp
82+
build-aux/install-sh
83+
build-aux/ltmain.sh
84+
build-aux/m4/libtool.m4
85+
build-aux/m4/lt~obsolete.m4
86+
build-aux/m4/ltoptions.m4
87+
build-aux/m4/ltsugar.m4
88+
build-aux/m4/ltversion.m4
89+
build-aux/missing
90+
build-aux/compile
91+
build-aux/test-driver
92+
configure
93+
libtool
94+
95+
autom4te.cache
96+
/autoscan.log
97+
/autoscan-*.log
98+
/aclocal.m4
99+
/compile
100+
/config.cache
101+
/config.guess
102+
/config.h.in
103+
/config.log
104+
/config.status
105+
/config.sub
106+
/configure
107+
/configure.scan
108+
/depcomp
109+
/install-sh
110+
/missing
111+
/stamp-h1
112+
/ltmain.sh
113+
/texinfo.tex

CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ set(CMAKE_MODULE_PATH
2828
${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules
2929
)
3030

31-
include(FetchContent)
32-
3331
# Relic related options
3432

3533
set(STBIN "off" CACHE STRING "Relic - Build static binaries")

Makefile.am

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) 2013-2016 The Bitcoin Core developers
2+
# Copyright (c) 2022 The Dash Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php.
5+
6+
print-%: FORCE
7+
@echo '$*'='$($*)'
8+
9+
ACLOCAL_AMFLAGS = -I build-aux/m4
10+
.PHONY: deploy FORCE
11+
12+
AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(CORE_LDFLAGS) $(GMP_LDFLAGS)
13+
AM_CXXFLAGS = $(LIBTOOL_CXXFLAGS) $(HARDENED_CXXFLAGS) $(CORE_CXXFLAGS) $(PIC_FLAGS) $(PIE_FLAGS)
14+
AM_CPPFLAGS = $(LIBTOOL_CPPFLAGS) $(HARDENED_CPPFLAGS) $(CORE_CPPFLAGS) $(PIC_FLAGS) $(GMP_CPPFLAGS)
15+
PTHREAD_FLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
16+
17+
EXTRA_LIBRARIES =
18+
19+
lib_LTLIBRARIES =
20+
noinst_LTLIBRARIES =
21+
22+
bin_PROGRAMS =
23+
noinst_PROGRAMS =
24+
EXTRA_DIST =
25+
26+
CLEANFILES =
27+
28+
include Makefile.bls.include
29+
30+
CLEANFILES += $(LIBRELIC) $(LIBDASHBLS) $(LIBMINIALLOC)
31+
32+
if USE_TESTS
33+
CLEANFILES += $(DASHBLS_RUNTEST)
34+
endif
35+
36+
if USE_BENCH
37+
CLEANFILES += $(DASHBLS_RUNBENCH)
38+
endif

Makefile.bench.include

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2021 The PIVX developers
2+
# Copyright (c) 2022 The Dash Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php.
5+
6+
DASHBLS_RUNBENCH = runbench
7+
8+
runbench_SOURCES = \
9+
src/test-bench.cpp \
10+
src/test-utils.hpp
11+
12+
runbench_SOURCES += \
13+
$(RELIC_H) \
14+
$(DASHBLS_H)
15+
16+
runbench_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_INCLUDES) $(RELIC_INCLUDES)
17+
runbench_CXXFLAGS = $(AM_CXXFLAGS)
18+
runbench_LDFLAGS = -static $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
19+
20+
runbench_LDADD = $(LIBDASHBLS)
21+
22+
noinst_PROGRAMS += $(DASHBLS_RUNBENCH)

Makefile.bls.include

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright (c) 2021 The PIVX developers
2+
# Copyright (c) 2022 The Dash Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php.
5+
6+
LIBDASHBLS = libdashbls.la
7+
8+
DASHBLS_CPPFLAGS = -DBLSALLOC_MINIALLOC=1
9+
10+
DASHBLS_INCLUDES = \
11+
-I$(builddir) \
12+
-I$(builddir)/obj \
13+
-I$(top_srcdir)/src
14+
15+
DASHBLS_H = \
16+
src/bls.hpp \
17+
src/chaincode.hpp \
18+
src/elements.hpp \
19+
src/extendedprivatekey.hpp \
20+
src/extendedpublickey.hpp \
21+
src/hdkeys.hpp \
22+
src/hkdf.hpp \
23+
src/legacy.hpp \
24+
src/privatekey.hpp \
25+
src/schemes.hpp \
26+
src/test-utils.hpp \
27+
src/threshold.hpp \
28+
src/util.hpp
29+
30+
libdashbls_la_SOURCES = \
31+
src/bls.cpp \
32+
src/chaincode.cpp \
33+
src/elements.cpp \
34+
src/extendedprivatekey.cpp \
35+
src/extendedpublickey.cpp \
36+
src/legacy.cpp \
37+
src/privatekey.cpp \
38+
src/schemes.cpp \
39+
src/threshold.cpp
40+
41+
libdashbls_la_SOURCES += \
42+
$(DASHBLS_H) \
43+
$(MINIALLOC_H) \
44+
$(RELIC_H)
45+
46+
libdashbls_la_LIBADD = \
47+
$(LIBMINIALLOC) \
48+
$(LIBRELIC) \
49+
$(GMP_LIBS)
50+
51+
libdashbls_la_CPPFLAGS = $(AM_CPPFLAGS) $(RELIC_INCLUDES) $(MINIALLOC_INCLUDES) $(DASHBLS_INCLUDES) $(DASHBLS_CPPFLAGS)
52+
libdashbls_la_CXXFLAGS = $(AM_CXXFLAGS)
53+
libdashbls_la_LDFLAGS = $(AM_LDFLAGS)
54+
55+
include Makefile.minialloc.include
56+
include Makefile.relic.include
57+
58+
if USE_TESTS
59+
include Makefile.test.include
60+
endif
61+
62+
if USE_BENCH
63+
include Makefile.bench.include
64+
endif
65+
66+
lib_LTLIBRARIES += $(LIBDASHBLS)

Makefile.minialloc.include

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2022 The Dash Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php.
4+
5+
LIBMINIALLOC = libminialloc.la
6+
7+
MINIALLOC_CPPFLAGS = -DLIBRARY_STATIC
8+
9+
MINIALLOC_INCLUDES = \
10+
-I$(top_srcdir)/depends/minialloc/contrib/bitcoin \
11+
-I$(top_srcdir)/depends/minialloc/include \
12+
-I$(top_srcdir)/depends/minialloc/src
13+
14+
MINIALLOC_H = \
15+
depends/minialloc/contrib/bitcoin/support/cleanse.h \
16+
depends/minialloc/contrib/bitcoin/support/lockedpool.h \
17+
depends/minialloc/include/minialloc.h \
18+
depends/minialloc/include/minialloc/export.h \
19+
depends/minialloc/src/loadstor.h
20+
21+
libminialloc_la_SOURCES = \
22+
$(MINIALLOC_H) \
23+
depends/minialloc/contrib/bitcoin/support/lockedpool.cpp \
24+
depends/minialloc/contrib/bitcoin/support/cleanse.cpp \
25+
depends/minialloc/src/minialloc.cpp
26+
27+
libminialloc_la_CPPFLAGS = $(AM_CPPFLAGS) $(MINIALLOC_INCLUDES) $(MINIALLOC_CPPFLAGS)
28+
libminialloc_la_CXXFLAGS = $(AM_CXXFLAGS)
29+
30+
noinst_LTLIBRARIES += $(LIBMINIALLOC)

0 commit comments

Comments
 (0)