summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8b4e6a54d14859b28317a410d5700f2a10ff6fd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Maintainer: redfish <redfish at galactica dot pw>
# Co-maintainer: Onishin <onishin at onishin dot org>

pkgbase='monero-git'
pkgname=('monero-git' 'libmonero-wallet-git')
_gitname='monero'
pkgver=0.16.0.0
pkgrel=1
arch=('x86_64' 'i686' 'armv7h' 'aarch64')
url="https://getmonero.org/"
license=('custom:Cryptonote')

depends=('boost-libs>=1.45'  'openssl' 'libunwind' 'readline' 'zeromq' 'pcsclite'
	 'hidapi' 'protobuf')
makedepends=('git' 'cmake' 'boost' 'gtest' 'qt5-tools')
checkdepends=('python-requests')

pkgdesc="Peer-to-peer anonymous digital currency (daemon, CLI wallet, and wallet API library)"
_upstream=https://github.com/monero-project/monero.git
source=("$_gitname::git+$_upstream"
	'cmake-headers.patch')

_builddir=build


pkgver() {
	cd "$srcdir/$_gitname"

	# Release tags might point to commits on a branch different than master,
	# so don't use them.
	#git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
        printf "$(echo $pkgver | sed 's/\.r.*//').r%s.g%s" \
	        "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
       cd "$srcdir/$_gitname"

       patch -p1 < $srcdir/cmake-headers.patch

       git submodule init
       git submodule update

       # To apply PRs
       #git remote add up $_upstream
       #git pull --no-edit up refs/pull/xxxx/head
}

CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=$_buildtype "
CMAKE_FLAGS+=" -DCMAKE_INSTALL_PREFIX=/usr "
CMAKE_FLAGS+=" -DBUILD_GUI_DEPS=ON "
CMAKE_FLAGS+=" -DUSE_DEVICE_TREZOR=ON "
CMAKE_FLAGS+=" -Wno-dev " # silence warnings for devs

build() {
	cd "$srcdir/$_gitname"

	if check_option "debug" "y"
	then
		_buildtype="Debug"
	else
		_buildtype+="Release"
	fi

	# For OpenSSL v1.0
	#CMAKE_FLAGS+=" -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0;/usr/lib/openssl-1.0 "

	mkdir -p $_builddir && cd $_builddir
	cmake $CMAKE_FLAGS -DBUILD_TESTS=OFF ..
	make
}

check() {
	cd "$srcdir/$_gitname"
	cd $_builddir

	cmake $CMAKE_FLAGS -DBUILD_TESTS=ON ..
	make

	# reported by AUR users that this test still fails (on some machines)
	EXCLUDED_UNIT_TESTS+=':AddressFromURL.Failure'
	EXCLUDED_UNIT_TESTS+=':is_hdd.linux_os_root' # fails on SSD (PR#4474)
	tests/unit_tests/unit_tests --gtest_filter="-$EXCLUDED_UNIT_TESTS" \
            --data-dir ../tests/data

	# Temporarily disable some a tests:
	#  * coretests, hash-variant2-int-sqrt take too long (~25000s, 250s)
	#  * libwallet_api_tests fail (Issue #895)
	#  * unit_tests were run separately above
	#  * functional_tests_rpc: take too lon (~1000s on ARM)
	#  * cnv4-jit: take too lon (~1000s on ARM)
	CTEST_ARGS+="-E 'core_tests|hash-variant2-int-sqrt|libwallet_api_tests|unit_tests|functional_tests_rpc|cnv4-jit'"
	echo ">>> NOTE: some tests excluded: $CTEST_ARGS"

	make ARGS="$CTEST_ARGS" test
}

package_monero-git() {

	provides=('monero')
	conflicts=('monero')

	backup=('etc/monerod.conf')
	install=monero.install

        # Uncomment for a debug build
        # options=(!strip debug)

	for b in \
		monero-blockchain-ancestry \
		monero-blockchain-depth \
		monero-blockchain-export \
		monero-blockchain-import \
		monero-blockchain-mark-spent-outputs \
		monero-blockchain-prune \
		monero-blockchain-prune-known-spent-data \
		monero-blockchain-stats \
		monero-blockchain-usage \
		monerod \
		monero-gen-trusted-multisig \
		monero-wallet-cli \
		monero-wallet-rpc
	do
		install -D -m755 "$srcdir/$_gitname/build/bin/$b" "$pkgdir/usr/bin/$b"
	done

	install -Dm644 $srcdir/$_gitname/utils/systemd/monerod.service "${pkgdir}/usr/lib/systemd/system/monerod.service"
	install -Dm644 "$srcdir/$_gitname/utils/conf/monerod.conf" "$pkgdir/etc/monerod.conf"
	install -D -m644 "$srcdir/$_gitname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_libmonero-wallet-git() {

	provides=("libmonero-wallet=$pkgver")
	conflicts=('libmonero-wallet')

        # NOTE: this is crucial, otherwise stripping breaks the .a archive:
        # monero-core (GUI) fails to link against it (it can't find symbols
        # that are clearly in the library).
        options=(!strip)

        cd $srcdir/$_gitname/$_builddir
        _stagedir=stagedir
        mkdir -p $_stagedir
        make DESTDIR=$_stagedir install

        cd $_stagedir
        find usr/{include,lib} -type f -exec install -D -m 755 {} ${pkgdir}/{} \;
}
sha256sums=('SKIP'
            'fe716415b67138cf79357c7db8d684d57f9dae4180e755b8143ff5bc7ce47bfc')