aboutsummaryrefslogtreecommitdiff
blob: cfd29f8fab4049e27e242c64dc2854273d1d1231 (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
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
WANT_AUTOCONF="2.5"
inherit autotools desktop xdg-utils flag-o-matic git-r3
DESCRIPTION="Dogecoin Core Qt for desktop. Downloaded blockchain is under 2.2GB. Much secure."
HOMEPAGE="https://github.com/dogecoin"
EGIT_REPO_URI="https://github.com/dogecoin/dogecoin.git"

WORKDIR_="${WORKDIR}/${P}"
S="${WORKDIR_}"

LICENSE="MIT"
SLOT="0"
DB_VER="5.3"
IUSE="cpu_flags_x86_avx2 cpu_flags_x86_sse2 intel-avx2 dogecoind experimental +gui +pie +prune scrypt-sse2 +ssp tests utils +wallet zmq"
REQUIRED_USE="!gui? ( dogecoind utils  ) dogecoind? ( utils ) intel-avx2?  ( experimental ) scrypt-sse2? ( experimental )  experimental? ( || ( intel-avx2 scrypt-sse2 ) )"
DOGEDIR="/opt/${PN}"
DEPEND="
	dev-libs/libevent:=
	dev-libs/protobuf
	dev-libs/openssl
	dev-build/libtool
	dev-build/automake:=
	gui? ( dev-qt/qtcore dev-qt/qtgui dev-qt/qtwidgets dev-qt/qtdbus dev-qt/qtnetwork dev-qt/qtprintsupport dev-qt/linguist-tools:= )
	>=dev-libs/boost-1.84.0
	wallet? ( sys-libs/db:"${DB_VER}"=[cxx]
		gui? ( media-gfx/qrencode )
	)
	zmq? ( net-libs/cppzmq )
"

RDEPEND="${DEPEND}
	dev-vcs/git
	dev-cpp/abseil-cpp
	cpu_flags_x86_avx2? (
		intel-avx2? ( ~app-crypt/intel-ipsec-mb-1.3 )
	)
"

BDEPEND="
	dev-build/autoconf
	dev-build/automake
"

pkg_pretend() {

		if use intel-avx2 && [[ ! -e "${ROOT}"/etc/portage/patches/app-crypt/intel-ipsec-mb/remove_digest_init.patch ]]; then
			eerror "${ROOT}/etc/portage/patches/app-crypt/intel-ipsec-mb/remove_digest_init.patch does not exist!"
			eerror "To build with avx2 intel support, please create ${ROOT}/etc/portage/patches/app-crypt/intel-ipsec-mb directory"
			eerror "and copy patch from package net-p2p/dogecoin-qt/files/intel-ipsec-mb/remove_digest_init.patch into that directory"
			die
		fi
}

src_prepare() {
	if use pie && use ssp ; then
		PATCHES+=( "${FILESDIR}"/hardened-all.patch )
	elif use pie && ! use ssp ; then
		PATCHES+=( "${FILESDIR}"/hardened-no-ssp.patch )
	elif use ssp && ! use pie ; then
		PATCHES+=( "${FILESDIR}"/hardened-no-pie.patch )
	else
		PATCHES+=( "${FILESDIR}"/hardened-minimal.patch )
	fi

	default

	einfo "Generating autotools files..."
	eaclocal -I "${WORKDIR_}"
	eautoreconf
}

src_configure() {
	local my_econf=(
		--bindir="${DOGEDIR}/bin"
		--disable-bench
		--enable-c++14
		$(use_with gui qt5)
		$(use_with intel-avx2 intel-avx2)
		$(use_with dogecoind daemon)
		$(use_with utils utils)
		$(use_enable wallet)
		$(use_enable zmq)
		$(use_enable tests tests)
		$(use_enable scrypt-sse2 scrypt-sse2)
		$(use_enable experimental experimental)
	)

	econf "${my_econf[@]}"
}

src_install() {
	emake DESTDIR="${D}" install
	insinto "${DOGEDIR}/bin"

	if use gui ; then
        insinto /usr/share/pixmaps
        doins src/qt/res/icons/dogecoin.png
        dosym "${DOGEDIR}/bin/${PN}" "/usr/bin/${PN}"

        if use prune ; then
            domenu "${FILESDIR}"/"${PN}-prune.desktop"
        else
            domenu "${FILESDIR}"/"${PN}.desktop"
        fi
	fi

	if use dogecoind ; then
		dosym "${DOGEDIR}/bin/dogecoind" "/usr/bin/dogecoind"
		dosym "${DOGEDIR}/bin/dogecoin-cli" "/usr/bin/dogecoin-cli"
	fi

	find "${ED}" -type f -name '*.la' -delete || die
}

pkg_postinst() {
	xdg_desktop_database_update
	xdg_mimeinfo_database_update

	if use gui ; then
		elog "Dogecoin Core (Qt) ${PV} has been installed."
		elog "Dogecoin Core (Qt) binaries have been placed in ${DOGEDIR}/bin."
		elog "${PN} has been symlinked with /usr/bin/${PN}."
	else
		elog "Dogecoin Core ${PV} has been installed."
		elog "Dogecoin Core binaries have been placed in ${DOGEDIR}/bin."
	fi

	if use dogecoind ; then
		elog "dogecoin daemon has been symlinked with /usr/bin/dogecoind."
		elog "dogecoin client utils have been symlinked with /usr/bin/dogecoin-cli."
	fi

	if ( ( use cpu_flags_x86_avx2 &&  ! use intel-avx2 ) && ( use cpu_flags_x86_sse2 && ! use scrypt-sse2 ) ); then
		einfo "NOTE: Experimental avx2 and sse2 CPU support in ${PV} can be"
		einfo "activated using 'intel-avx2' and/or 'scrypt-sse2' USE flags, "
		einfo "together with 'experimental' USE flag for this version."
	fi
}

pkg_postrm() {
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}