Browse Source

new packages: bitcoin and lnd (#4290)

emacs-27
stefanwouldgo 5 years ago
committed by Leonid Plyushch
parent
commit
cc3b26314e
No known key found for this signature in database GPG Key ID: 45F2964132545795
  1. 51
      packages/bitcoin/0001-android-patches.patch
  2. 36
      packages/bitcoin/build.sh
  3. 60
      packages/lnd/build.sh

51
packages/bitcoin/0001-android-patches.patch

@ -0,0 +1,51 @@
diff --git i/depends/hosts/default.mk w/depends/hosts/default.mk
index 144e5f88b..4d3c527de 100644
--- i/depends/hosts/default.mk
+++ w/depends/hosts/default.mk
@@ -2,8 +2,8 @@ ifneq ($(host),$(build))
host_toolchain:=$(host)-
endif
-default_host_CC = $(host_toolchain)gcc
-default_host_CXX = $(host_toolchain)g++
+default_host_CC = $(CC)
+default_host_CXX = $(CXX)
default_host_AR = $(host_toolchain)ar
default_host_RANLIB = $(host_toolchain)ranlib
default_host_STRIP = $(host_toolchain)strip
diff --git i/depends/hosts/linux.mk w/depends/hosts/linux.mk
index b13a0f1ad..838db8537 100644
--- i/depends/hosts/linux.mk
+++ w/depends/hosts/linux.mk
@@ -10,19 +10,19 @@ linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
ifeq (86,$(findstring 86,$(build_arch)))
-i686_linux_CC=gcc -m32
-i686_linux_CXX=g++ -m32
-i686_linux_AR=ar
-i686_linux_RANLIB=ranlib
-i686_linux_NM=nm
-i686_linux_STRIP=strip
+i686_linux_CC=$(default_host_CC) -m32
+i686_linux_CXX=$(default_host_CXX) -m32
+i686_linux_AR=$(default_host_AR)
+i686_linux_RANLIB=$(default_host_RANLIB)
+i686_linux_NM=$(default_host_NM)
+i686_linux_STRIP=$(default_host_STRIP)
-x86_64_linux_CC=gcc -m64
-x86_64_linux_CXX=g++ -m64
-x86_64_linux_AR=ar
-x86_64_linux_RANLIB=ranlib
-x86_64_linux_NM=nm
-x86_64_linux_STRIP=strip
+x86_64_linux_CC=$(default_host_CC) -m64
+x86_64_linux_CXX=$(default_host_CXX) -m64
+x86_64_linux_AR=$(default_host_AR)
+x86_64_linux_RANLIB=$(default_host_RANLIB)
+x86_64_linux_NM=$(default_host_NM)
+x86_64_linux_STRIP=$(default_host_STRIP)
else
i686_linux_CC=$(default_host_CC) -m32
i686_linux_CXX=$(default_host_CXX) -m32

36
packages/bitcoin/build.sh

@ -0,0 +1,36 @@
TERMUX_PKG_HOMEPAGE=https://bitcoincore.org/
TERMUX_PKG_DESCRIPTION="Bitcoin Core"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_VERSION=0.18.1
TERMUX_PKG_SRCURL=https://github.com/bitcoin/bitcoin/archive/v$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=db3c76ac913adfd67e3c7ff243b443c9706f81dd382d1212875fefc2de1ea5ff
TERMUX_PKG_DEPENDS="boost, libdb, libevent, libzmq, termux-services"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--disable-tests
--with-daemon
--with-boost-chrono=boost_chrono
--with-boost-filesystem=boost_filesystem
--with-boost-system=boost_system
--with-boost-thread=boost_thread
--with-gui=no
--with-incompatible-bdb
--without-libs
"
termux_step_pre_configure() {
./autogen.sh
}
termux_step_post_make_install() {
mkdir -p $TERMUX_PREFIX/var/service
cd $TERMUX_PREFIX/var/service
mkdir -p bitcoind/log
echo "#!$TERMUX_PREFIX/bin/sh" > bitcoind/run
echo 'exec bitcoind 2>&1' >> bitcoind/run
chmod +x bitcoind/run
touch bitcoind/down
ln -sf $TERMUX_PREFIX/share/termux-services/svlogger bitcoind/log/run
}

60
packages/lnd/build.sh

@ -0,0 +1,60 @@
TERMUX_PKG_HOMEPAGE=https://github.com/lightningnetwork/lnd
TERMUX_PKG_DESCRIPTION="Lightning Network Daemon"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_VERSION=0.7.1-beta
TERMUX_PKG_SRCURL=(https://github.com/lightningnetwork/lnd/releases/download/v$TERMUX_PKG_VERSION/lnd-source-v$TERMUX_PKG_VERSION.tar.gz
https://github.com/lightningnetwork/lnd/releases/download/v$TERMUX_PKG_VERSION/vendor.tar.gz)
TERMUX_PKG_SHA256=(ae8cb77eb7567ed9f8041a17eb6f65280cf81f4fbc3bf10eb671a423f62fc948
3bbfa000e2b4c7702f92d24235b5a098f37fd7b5830ca42586678f03d7cf9da3)
TERMUX_PKG_DEPENDS="bitcoin"
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_extract_package() { #modded without stripping
if [ -z "${TERMUX_PKG_SRCURL:=""}" ] || [ -n "${TERMUX_PKG_SKIP_SRC_EXTRACT:=""}" ]; then
mkdir -p "$TERMUX_PKG_SRCDIR"
return
fi
cd "$TERMUX_PKG_TMPDIR"
local PKG_SRCURL=(${TERMUX_PKG_SRCURL[@]})
local PKG_SHA256=(${TERMUX_PKG_SHA256[@]})
if [ ! ${#PKG_SRCURL[@]} == ${#PKG_SHA256[@]} ] && [ ! ${#PKG_SHA256[@]} == 0 ]; then
termux_error_exit "Error: length of TERMUX_PKG_SRCURL isn't equal to length of TERMUX_PKG_SHA256."
fi
# STRIP=1 extracts archives straight into TERMUX_PKG_SRCDIR while STRIP=0 puts them in subfolders. zip has same behaviour per default
# If this isn't desired then this can be fixed in termux_step_post_extract_package.
local STRIP=0
for i in $(seq 0 $(( ${#PKG_SRCURL[@]}-1 ))); do
test "$i" -gt 0 && STRIP=0
local filename
filename=$(basename "${PKG_SRCURL[$i]}")
local file="$TERMUX_PKG_CACHEDIR/$filename"
# Allow TERMUX_PKG_SHA256 to be empty:
set +u
termux_download "${PKG_SRCURL[$i]}" "$file" "${PKG_SHA256[$i]}"
set -u
local folder
set +o pipefail
if [ "${file##*.}" = zip ]; then
folder=$(unzip -qql "$file" | head -n1 | tr -s ' ' | cut -d' ' -f5-)
rm -Rf $folder
unzip -q "$file"
mv $folder "$TERMUX_PKG_SRCDIR"
else
mkdir -p "$TERMUX_PKG_SRCDIR"
tar xf "$file" -C "$TERMUX_PKG_SRCDIR" --strip-components=$STRIP
fi
set -o pipefail
done
}
termux_step_make() {
termux_setup_golang
GO111MODULE=on go build -tags linux -v -mod=vendor -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v$TERMUX_PKG_VERSION" ./cmd/lnd
GO111MODULE=on go build -tags linux -v -mod=vendor -ldflags "-X github.com/lightningnetwork/lnd/build.Commit=v$TERMUX_PKG_VERSION" ./cmd/lncli
}
termux_step_make_install() {
install -Dm700 lnd lncli "$TERMUX_PREFIX"/bin/
}
Loading…
Cancel
Save