Skip to content

Commit

Permalink
Merge branch 'SAPP-develop' of https://github.com/decenomy/DSW
Browse files Browse the repository at this point in the history
  • Loading branch information
zimbora committed Feb 10, 2024
2 parents ace7bee + 78245c5 commit 9656967
Show file tree
Hide file tree
Showing 34 changed files with 3,594 additions and 206 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ if(OPENSSL_FOUND)
endif()
endif()

find_package(CURL REQUIRED)
# Add libcurl include directories
target_include_directories(WALLET_A ${CURL_INCLUDE_DIRS})
# Link against libcurl
target_link_libraries(WALLET_A ${CURL_LIBRARIES})

find_package(LibEvent REQUIRED)

find_package(GMP)
Expand Down
115 changes: 85 additions & 30 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 5)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_BUILD, 2)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2021)
define(_COPYRIGHT_YEAR, 2024)
AC_INIT([Sapphire Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_REVISION, m4_if(_CLIENT_VERSION_BUILD, [0], [], _CLIENT_VERSION_BUILD))m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/decenomy/SAPP/issues],[sapphire],[https://sappcoin.com/])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/pivx-config.h])
Expand All @@ -18,6 +18,8 @@ BITCOIN_GUI_NAME=sapphire-qt
BITCOIN_CLI_NAME=sapphire-cli
BITCOIN_TX_NAME=sapphire-tx

BOOTSTRAP_URL_DEFAULT=https://bootstraps.decenomy.net/

dnl Unless the user specified ARFLAGS, force it to be cr
AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to <cr> if not set])
if test "x${ARFLAGS+set}" != "xset"; then
Expand Down Expand Up @@ -113,13 +115,27 @@ AC_ARG_WITH([params-dir],
],
[params_path=""])

# Allow the user to specify a different value for BOOTSTRAP_URL
AC_ARG_WITH([bootstrap-url],
[AS_HELP_STRING([--with-bootstrap-url=URL],
[URL for bootstrap data])],
[BOOTSTRAP_URL="$withval"],
[BOOTSTRAP_URL="$BOOTSTRAP_URL_DEFAULT"])

# Enable wallet
AC_ARG_ENABLE([wallet],
[AS_HELP_STRING([--disable-wallet],
[disable wallet (enabled by default)])],
[enable_wallet=$enableval],
[enable_wallet=yes])

# Enable bootstrap
AC_ARG_ENABLE([bootstrap],
[AS_HELP_STRING([--disable-bootstrap],
[disable bootstrap (enabled by default)])],
[enable_bootstrap=$enableval],
[enable_bootstrap=yes])

AC_ARG_WITH([miniupnpc],
[AS_HELP_STRING([--with-miniupnpc],
[enable UPNP (default is yes if libminiupnpc is found)])],
Expand Down Expand Up @@ -501,6 +517,12 @@ case $host in
AC_MSG_ERROR("windres not found")
fi

# Check for curl-config
AC_PATH_PROG([CURL_CONFIG], [curl-config], none, [$prefix/bin])
if test x$CURL_CONFIG = xnone; then
AC_MSG_ERROR("curl-config not found")
fi

CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB"
if test "x$CXXFLAGS_overridden" = "xno"; then
CXXFLAGS="$CXXFLAGS -w"
Expand Down Expand Up @@ -1056,6 +1078,8 @@ if test x$use_pkgconfig = xyes; then
PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)])
PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)])
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])])
PKG_CHECK_MODULES([CURL], [libcurl],, [AC_MSG_ERROR(curl not found.)])
PKG_CHECK_MODULES([ZLIB], [zlib],, [AC_MSG_ERROR(zlib not found.)])
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode],,[BITCOIN_QT_FAIL(libqrencode not found)])])
if test x$use_qtcharts != xno; then
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([CHARTS], [Qt5Charts],[have_qtcharts=yes], [have_qtcharts=no])])
Expand All @@ -1077,6 +1101,7 @@ if test x$use_pkgconfig = xyes; then
else
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
fi
]
)
else
Expand Down Expand Up @@ -1119,6 +1144,20 @@ else

BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found)))

AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR(curl headers missing),)
AC_CHECK_LIB([curl] ,[main],[CURL_LIBS=-lcurl], AC_MSG_ERROR(curl not found))

# Use curl-config to get libcurl flags and add -DCURL_STATICLIB to CURL_CFLAGS
if test "x$CURL_CONFIG" != "xnone"; then
CURL_CONFIG_CFLAGS=`$CURL_CONFIG --cflags`
CURL_CFLAGS="$CURL_CFLAGS -DCURL_STATICLIB $CURL_CONFIG_CFLAGS"
CURL_CONFIG_LIBS=`$CURL_CONFIG --libs`
CURL_LIBS="$CURL_LIBS $CURL_CONFIG_LIBS"
fi

AC_CHECK_HEADER([zlib.h],, AC_MSG_ERROR(zlib headers missing),)
AC_CHECK_LIB([z] ,[main],[ZLIB_LIBS=-lz], AC_MSG_ERROR(zlib not found))

BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], BITCOIN_QT_FAIL(libqrencode not found))])
BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, BITCOIN_QT_FAIL(libqrencode not found))])
if test x$use_qtcharts != xno; then
Expand Down Expand Up @@ -1228,6 +1267,16 @@ else
AC_MSG_RESULT(no)
fi

dnl enable bootstrap
AC_MSG_CHECKING([if bootstrap should be enabled])
if test x$enable_bootstrap != xno; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([ENABLE_BOOTSTRAP],[1],[Define to 1 to enable bootstrap functions])

else
AC_MSG_RESULT(no)
fi

dnl enable upnp support
AC_MSG_CHECKING([whether to build with support for UPnP])
if test x$have_miniupnpc = xno; then
Expand Down Expand Up @@ -1322,6 +1371,7 @@ AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin])
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
AM_CONDITIONAL([ENABLE_BOOTSTRAP],[test x$enable_bootstrap = xyes])
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes])
Expand All @@ -1346,6 +1396,7 @@ AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build])
AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release])
AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release])
AC_DEFINE_UNQUOTED(PARAMS_DIR, ["$params_path"], [Path to the zk params dir during unit tests on windows])
AC_DEFINE_UNQUOTED([BOOTSTRAP_URL], ["$BOOTSTRAP_URL"], [URL for bootstrap data])
AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR)
AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR)
AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION)
Expand Down Expand Up @@ -1391,6 +1442,8 @@ AC_SUBST(EVENT_LIBS)
AC_SUBST(EVENT_PTHREADS_LIBS)
AC_SUBST(ZMQ_LIBS)
AC_SUBST(PROTOBUF_LIBS)
AC_SUBST(CURL_LIBS)
AC_SUBST(ZLIB_LIBS)
AC_SUBST(QR_LIBS)
AC_SUBST(USE_NUM_GMP)
AC_SUBST(USE_NUM_OPENSSL)
Expand Down Expand Up @@ -1462,37 +1515,39 @@ esac

echo
echo "Options used to compile and link:"
echo " with wallet = $enable_wallet"
echo " with gui / qt = $bitcoin_enable_qt"
echo " with wallet = $enable_wallet"
echo " with bootstrap = $enable_bootstrap"
echo " bootstrap url = $BOOTSTRAP_URL"
echo " with gui / qt = $bitcoin_enable_qt"
if test x$bitcoin_enable_qt != xno; then
echo " with qtcharts = $use_qtcharts"
fi
echo " with zmq = $use_zmq"
echo " with test = $use_tests"
echo " with bench = $use_bench"
echo " with upnp = $use_upnp"
echo " with params = $params_path"
echo " use asm = $use_asm"
echo " sanitizers = $use_sanitizers"
echo " debug enabled = $enable_debug"
echo " gprof enabled = $enable_gprof"
echo " werror = $enable_werror"
echo " host = $host"
echo " with zmq = $use_zmq"
echo " with test = $use_tests"
echo " with bench = $use_bench"
echo " with upnp = $use_upnp"
echo " with params = $params_path"
echo " use asm = $use_asm"
echo " sanitizers = $use_sanitizers"
echo " debug enabled = $enable_debug"
echo " gprof enabled = $enable_gprof"
echo " werror = $enable_werror"
echo " host = $host"
echo
echo " target os = $TARGET_OS"
echo " build os = $BUILD_OS"
echo " target os = $TARGET_OS"
echo " build os = $BUILD_OS"
echo
echo " CC = $CC"
echo " CFLAGS = $CFLAGS"
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_CFLAGS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo " PIC_FLAGS = $PIC_FLAGS"
echo " QT_PIE_FLAGS = $QT_PIE_FLAGS"
echo " SVG_LIBS = $QT_SVG_LIBS "
echo " SVG_CFLAGS = $QT_SVG_INCLUDES "
echo " CHARTS_LIBS = $CHARTS_LIBS "
echo " CHARTS_CFLAGS = $CHARTS_CFLAGS "
echo " CC = $CC"
echo " CFLAGS = $CFLAGS"
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_CFLAGS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo " PIC_FLAGS = $PIC_FLAGS"
echo " QT_PIE_FLAGS = $QT_PIE_FLAGS"
echo " SVG_LIBS = $QT_SVG_LIBS "
echo " SVG_CFLAGS = $QT_SVG_INCLUDES "
echo " CHARTS_LIBS = $CHARTS_LIBS "
echo " CHARTS_CFLAGS = $CHARTS_CFLAGS "
echo
145 changes: 145 additions & 0 deletions contrib/docker/Dockerfile.dsw-develop-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Use a base image (Ubuntu 18.04)
# FROM ubuntu:18.04
FROM ubuntu@sha256:dca176c9663a7ba4c1f0e710986f5a25e672842963d95b960191e2d9f7185ebe

# Set arguments
ARG CPU_CORES=1
ARG TARGET=develop

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV QT_RCC_TEST=1
ENV QT_RCC_SOURCE_DATE_OVERRIDE=1
ENV ZERO_AR_DATE=1
ENV WRAP_DIR=/wrapped
ENV HOSTS="x86_64-linux-gnu aarch64-linux-gnu x86_64-apple-darwin14 x86_64-w64-mingw32"
ENV FAKETIME_HOST_PROGS="ar ranlib nm windres strip objcopy gcc g++"
ENV FAKETIME_PROGS="ar ranlib nm strip objcopy gcc g++ date zip wine wine64 dmg genisoimage tar"


# Update and install necessary packages
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
curl=7.58.0-2ubuntu3.24 \
git=1:2.17.1-1ubuntu0.18 \
zip=3.0-11build1 \
faketime=0.9.7-2 \
build-essential=12.4ubuntu1 \
libtool=2.4.6-2 \
bsdmainutils=11.1.2ubuntu1 \
autotools-dev=20180224.1 \
autoconf=2.69-11 \
pkg-config=0.29.1-0ubuntu2 \
automake=1:1.15.1-3ubuntu2 \
python3=3.6.7-1~18.04 \
g++-aarch64-linux-gnu=4:7.4.0-1ubuntu2.3 \
g++-8-aarch64-linux-gnu=8.4.0-1ubuntu1~18.04cross2 \
gcc-8-aarch64-linux-gnu=8.4.0-1ubuntu1~18.04cross2 \
binutils-aarch64-linux-gnu=2.30-21ubuntu1~18.04.9 \
g++-8-multilib=8.4.0-1ubuntu1~18.04 \
gcc-8-multilib=8.4.0-1ubuntu1~18.04 \
python3-dev=3.6.7-1~18.04 \
python3-setuptools=39.0.1-2ubuntu0.1 \
fonts-tuffy=20120614-2 \
libcap-dev=1:2.25-1.2 \
libz-dev \
libbz2-dev=1.0.6-8.1ubuntu0.2 \
imagemagick=8:6.9.7.4+dfsg-16ubuntu6.15 \
cmake=3.10.2-1ubuntu2.18.04.2 \
librsvg2-bin=2.40.20-2ubuntu0.2 \
libtiff-tools=4.0.9-5ubuntu0.10 \
mingw-w64=5.0.3-1 \
xvfb=2:1.19.6-1ubuntu4.15 \
wine32=3.0-1ubuntu1 \
wine64=3.0-1ubuntu1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set POSIX for x86_64-w64-mingw32-g++ alternatives config
RUN echo "1" | update-alternatives --config x86_64-w64-mingw32-g++

# use a fixed date
RUN echo -n "2000-01-01 12:00:00" > /git_timestamp
RUN echo -n "200001011200.00" > /git_timestamp_touch

# Compile the depends folder using a deterministic timestamp

RUN mkdir -p ${WRAP_DIR}

RUN for prog in ${FAKETIME_PROGS}; \
do \
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}; \
echo -n "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 " >> ${WRAP_DIR}/${prog}; \
echo -n "FAKETIME=\"\$(cat /git_timestamp)\" " >> ${WRAP_DIR}/${prog}; \
echo "\$(which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -n 1) \"\$@\"" >> ${WRAP_DIR}/${prog}; \
chmod +x ${WRAP_DIR}/${prog}; \
done

RUN for host in $HOSTS; \
do \
for prog in ${FAKETIME_HOST_PROGS}; \
do \
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${host}-${prog}; \
echo -n "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 " >> ${WRAP_DIR}/${host}-${prog}; \
echo -n "FAKETIME=\"\$(cat /git_timestamp)\" " >> ${WRAP_DIR}/${host}-${prog}; \
echo "\$(which -a ${host}-${prog} | grep -v ${WRAP_DIR}/${host}-${prog} | head -n 1) \"\$@\"" >> ${WRAP_DIR}/${host}-${prog}; \
chmod +x ${WRAP_DIR}/${host}-${prog}; \
done \
done

# Clone the repository
RUN git clone https://github.com/decenomy/DSW.git

WORKDIR /DSW

# Check out a specific version if needed
RUN git checkout -B $TARGET
RUN git pull origin $TARGET

# --- macos ---
# Install the MacOS SDK
RUN mkdir -p /DSW/depends/SDKs
WORKDIR /DSW/depends/SDKs

RUN curl -LO https://github.com/decenomy/depends/raw/main/SDKs/MacOSX10.11.sdk.tar.xz
RUN touch -t $(cat /git_timestamp_touch) /DSW/depends/SDKs/MacOSX10.11.sdk.tar.xz
RUN PATH=${WRAP_DIR}:${PATH} tar -C /DSW/depends/SDKs -xf /DSW/depends/SDKs/MacOSX10.11.sdk.tar.xz
RUN rm /DSW/depends/SDKs/MacOSX10.11.sdk.tar.xz
# --- --- ---

# --- windows ---
# Set the Inno Setup compiler
WORKDIR /DSW/contrib/innosetup

ENV DISPLAY=:99
RUN Xvfb :99 -screen 0 1024x768x16 -nolisten tcp &

RUN Xvfb :99 -screen 0 1024x768x16 -nolisten tcp & \
wine innosetup-6.1.2.exe /VERYSILENT /NORESTART /ALLUSERS /SUPPRESSMSGBOXES /SP /LOG=setup.log && \
wine idpsetup-1.5.1.exe /VERYSILENT /NORESTART /ALLUSERS /SUPPRESSMSGBOXES /SP /LOG=setup.log

RUN rm /tmp/.X99-lock
# --- --- ---

# Switch to the repository directory
WORKDIR /DSW/depends

# Builds the dependencies in the depends folder
RUN for host in $HOSTS; \
do \
PATH=${WRAP_DIR}:${PATH} make -j$(echo $CPU_CORES) HOST=${host}; \
done

# Set the work dir to the root folder
WORKDIR /

# Set the entry point if you want to interact within the container
ENTRYPOINT ["bash"]

# Build it with:
# docker build --build-arg CPU_CORES=<num_cores> --build-arg TARGET=<branch> -t decenomy/dsw-develop-builder -f Dockerfile.dsw-develop-builder .
# Publish with:
# docker login
# docker push decenomy/dsw-develop-builder:latest
6 changes: 3 additions & 3 deletions contrib/docker/Dockerfile.dsw-linux-arm64-builder
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ ENV QT_RCC_SOURCE_DATE_OVERRIDE=1
# Update and install necessary packages
RUN apt-get update && \
apt-get install -y \
curl=7.58.0-2ubuntu3.24 \
curl=7.58.0-2ubuntu3.24 \
git=1:2.17.1-1ubuntu0.18 \
zip=3.0-11build1 \
faketime=0.9.7-2 \
build-essential=12.4ubuntu1 \
build-essential=12.4ubuntu1 \
libtool=2.4.6-2 \
bsdmainutils=11.1.2ubuntu1 \
autotools-dev=20180224.1 \
autotools-dev=20180224.1 \
autoconf=2.69-11 \
pkg-config=0.29.1-0ubuntu2 \
automake=1:1.15.1-3ubuntu2 \
Expand Down
Loading

0 comments on commit 9656967

Please sign in to comment.