You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bitcoin.spec 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. %define bdbv 4.8.30
  2. %global selinux_variants mls strict targeted
  3. %if 0%{?_no_gui:1}
  4. %define _buildqt 0
  5. %define buildargs --with-gui=no
  6. %else
  7. %define _buildqt 1
  8. %if 0%{?_use_qt4}
  9. %define buildargs --with-qrencode --with-gui=qt4
  10. %else
  11. %define buildargs --with-qrencode --with-gui=qt5
  12. %endif
  13. %endif
  14. Name: bitcoin
  15. Version: 0.12.0
  16. Release: 2%{?dist}
  17. Summary: Peer to Peer Cryptographic Currency
  18. Group: Applications/System
  19. License: MIT
  20. URL: https://bitcoin.org/
  21. Source0: https://bitcoin.org/bin/bitcoin-core-%{version}/bitcoin-%{version}.tar.gz
  22. Source1: http://download.oracle.com/berkeley-db/db-%{bdbv}.NC.tar.gz
  23. Source10: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/debian/examples/bitcoin.conf
  24. #man pages
  25. Source20: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/doc/man/bitcoind.1
  26. Source21: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/doc/man/bitcoin-cli.1
  27. Source22: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/doc/man/bitcoin-qt.1
  28. #selinux
  29. Source30: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/rpm/bitcoin.te
  30. # Source31 - what about bitcoin-tx and bench_bitcoin ???
  31. Source31: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/rpm/bitcoin.fc
  32. Source32: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/rpm/bitcoin.if
  33. Source100: https://upload.wikimedia.org/wikipedia/commons/4/46/Bitcoin.svg
  34. %if 0%{?_use_libressl:1}
  35. BuildRequires: libressl-devel
  36. %else
  37. BuildRequires: openssl-devel
  38. %endif
  39. BuildRequires: boost-devel
  40. BuildRequires: miniupnpc-devel
  41. BuildRequires: autoconf automake libtool
  42. BuildRequires: libevent-devel
  43. Patch0: bitcoin-0.12.0-libressl.patch
  44. %description
  45. Bitcoin is a digital cryptographic currency that uses peer-to-peer technology to
  46. operate with no central authority or banks; managing transactions and the
  47. issuing of bitcoins is carried out collectively by the network.
  48. %if %{_buildqt}
  49. %package core
  50. Summary: Peer to Peer Cryptographic Currency
  51. Group: Applications/System
  52. Obsoletes: %{name} < %{version}-%{release}
  53. Provides: %{name} = %{version}-%{release}
  54. %if 0%{?_use_qt4}
  55. BuildRequires: qt-devel
  56. %else
  57. BuildRequires: qt5-qtbase-devel
  58. # for /usr/bin/lrelease-qt5
  59. BuildRequires: qt5-linguist
  60. %endif
  61. BuildRequires: protobuf-devel
  62. BuildRequires: qrencode-devel
  63. BuildRequires: %{_bindir}/desktop-file-validate
  64. # for icon generation from SVG
  65. BuildRequires: %{_bindir}/inkscape
  66. BuildRequires: %{_bindir}/convert
  67. %description core
  68. Bitcoin is a digital cryptographic currency that uses peer-to-peer technology to
  69. operate with no central authority or banks; managing transactions and the
  70. issuing of bitcoins is carried out collectively by the network.
  71. This package contains the Qt based graphical client and node. If you are looking
  72. to run a Bitcoin wallet, this is probably the package you want.
  73. %endif
  74. %package libs
  75. Summary: Bitcoin shared libraries
  76. Group: System Environment/Libraries
  77. %description libs
  78. This package provides the bitcoinconsensus shared libraries. These libraries
  79. may be used by third party software to provide consensus verification
  80. functionality.
  81. Unless you know need this package, you probably do not.
  82. %package devel
  83. Summary: Development files for bitcoin
  84. Group: Development/Libraries
  85. Requires: %{name}-libs = %{version}-%{release}
  86. %description devel
  87. This package contains the header files and static library for the
  88. bitcoinconsensus shared library. If you are developing or compiling software
  89. that wants to link against that library, then you need this package installed.
  90. Most people do not need this package installed.
  91. %package server
  92. Summary: The bitcoin daemon
  93. Group: System Environment/Daemons
  94. Requires: bitcoin-utils = %{version}-%{release}
  95. Requires: selinux-policy policycoreutils-python
  96. Requires(pre): shadow-utils
  97. Requires(post): %{_sbindir}/semodule %{_sbindir}/restorecon %{_sbindir}/fixfiles %{_sbindir}/sestatus
  98. Requires(postun): %{_sbindir}/semodule %{_sbindir}/restorecon %{_sbindir}/fixfiles %{_sbindir}/sestatus
  99. BuildRequires: systemd
  100. BuildRequires: checkpolicy
  101. BuildRequires: %{_datadir}/selinux/devel/Makefile
  102. %description server
  103. This package provides a stand-alone bitcoin-core daemon. For most users, this
  104. package is only needed if they need a full-node without the graphical client.
  105. Some third party wallet software will want this package to provide the actual
  106. bitcoin-core node they use to connect to the network.
  107. If you use the graphical bitcoin-core client then you almost certainly do not
  108. need this package.
  109. %package utils
  110. Summary: Bitcoin utilities
  111. Group: Applications/System
  112. %description utils
  113. This package provides several command line utilities for interacting with a
  114. bitcoin-core daemon.
  115. The bitcoin-cli utility allows you to communicate and control a bitcoin daemon
  116. over RPC, the bitcoin-tx utility allows you to create a custom transaction, and
  117. the bench_bitcoin utility can be used to perform some benchmarks.
  118. This package contains utilities needed by the bitcoin-server package.
  119. %prep
  120. %setup -q
  121. %patch0 -p1 -b .libressl
  122. cp -p %{SOURCE10} ./bitcoin.conf.example
  123. tar -zxf %{SOURCE1}
  124. cp -p db-%{bdbv}.NC/LICENSE ./db-%{bdbv}.NC-LICENSE
  125. mkdir db4 SELinux
  126. cp -p %{SOURCE30} %{SOURCE31} %{SOURCE32} SELinux/
  127. %build
  128. CWD=`pwd`
  129. cd db-%{bdbv}.NC/build_unix/
  130. ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=${CWD}/db4
  131. make install
  132. cd ../..
  133. ./autogen.sh
  134. %configure LDFLAGS="-L${CWD}/db4/lib/" CPPFLAGS="-I${CWD}/db4/include/" --with-miniupnpc --enable-glibc-back-compat %{buildargs}
  135. make %{?_smp_mflags}
  136. pushd SELinux
  137. for selinuxvariant in %{selinux_variants}; do
  138. make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile
  139. mv bitcoin.pp bitcoin.pp.${selinuxvariant}
  140. make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile clean
  141. done
  142. popd
  143. %install
  144. make install DESTDIR=%{buildroot}
  145. mkdir -p -m755 %{buildroot}%{_sbindir}
  146. mv %{buildroot}%{_bindir}/bitcoind %{buildroot}%{_sbindir}/bitcoind
  147. # systemd stuff
  148. mkdir -p %{buildroot}%{_tmpfilesdir}
  149. cat <<EOF > %{buildroot}%{_tmpfilesdir}/bitcoin.conf
  150. d /run/bitcoind 0750 bitcoin bitcoin -
  151. EOF
  152. touch -a -m -t 201504280000 %{buildroot}%{_tmpfilesdir}/bitcoin.conf
  153. mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
  154. cat <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/bitcoin
  155. # Provide options to the bitcoin daemon here, for example
  156. # OPTIONS="-testnet -disable-wallet"
  157. OPTIONS=""
  158. # System service defaults.
  159. # Don't change these unless you know what you're doing.
  160. CONFIG_FILE="%{_sysconfdir}/bitcoin/bitcoin.conf"
  161. DATA_DIR="%{_localstatedir}/lib/bitcoin"
  162. PID_FILE="/run/bitcoind/bitcoind.pid"
  163. EOF
  164. touch -a -m -t 201504280000 %{buildroot}%{_sysconfdir}/sysconfig/bitcoin
  165. mkdir -p %{buildroot}%{_unitdir}
  166. cat <<EOF > %{buildroot}%{_unitdir}/bitcoin.service
  167. [Unit]
  168. Description=Bitcoin daemon
  169. After=syslog.target network.target
  170. [Service]
  171. Type=forking
  172. ExecStart=%{_sbindir}/bitcoind -daemon -conf=\${CONFIG_FILE} -datadir=\${DATA_DIR} -pid=\${PID_FILE} \$OPTIONS
  173. EnvironmentFile=%{_sysconfdir}/sysconfig/bitcoin
  174. User=bitcoin
  175. Group=bitcoin
  176. Restart=on-failure
  177. PrivateTmp=true
  178. TimeoutStopSec=120
  179. TimeoutStartSec=60
  180. StartLimitInterval=240
  181. StartLimitBurst=5
  182. [Install]
  183. WantedBy=multi-user.target
  184. EOF
  185. touch -a -m -t 201504280000 %{buildroot}%{_unitdir}/bitcoin.service
  186. #end systemd stuff
  187. mkdir %{buildroot}%{_sysconfdir}/bitcoin
  188. mkdir -p %{buildroot}%{_localstatedir}/lib/bitcoin
  189. #SELinux
  190. for selinuxvariant in %{selinux_variants}; do
  191. install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
  192. install -p -m 644 SELinux/bitcoin.pp.${selinuxvariant} %{buildroot}%{_datadir}/selinux/${selinuxvariant}/bitcoin.pp
  193. done
  194. %if %{_buildqt}
  195. # qt icons
  196. install -D -p share/pixmaps/bitcoin.ico %{buildroot}%{_datadir}/pixmaps/bitcoin.ico
  197. install -p share/pixmaps/nsis-header.bmp %{buildroot}%{_datadir}/pixmaps/
  198. install -p share/pixmaps/nsis-wizard.bmp %{buildroot}%{_datadir}/pixmaps/
  199. install -p %{SOURCE100} %{buildroot}%{_datadir}/pixmaps/bitcoin.svg
  200. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin16.png -w16 -h16
  201. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin32.png -w32 -h32
  202. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin64.png -w64 -h64
  203. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin128.png -w128 -h128
  204. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin256.png -w256 -h256
  205. %{_bindir}/convert -resize 16x16 %{buildroot}%{_datadir}/pixmaps/bitcoin256.png %{buildroot}%{_datadir}/pixmaps/bitcoin16.xpm
  206. %{_bindir}/convert -resize 32x32 %{buildroot}%{_datadir}/pixmaps/bitcoin256.png %{buildroot}%{_datadir}/pixmaps/bitcoin32.xpm
  207. %{_bindir}/convert -resize 64x64 %{buildroot}%{_datadir}/pixmaps/bitcoin256.png %{buildroot}%{_datadir}/pixmaps/bitcoin64.xpm
  208. %{_bindir}/convert -resize 128x128 %{buildroot}%{_datadir}/pixmaps/bitcoin256.png %{buildroot}%{_datadir}/pixmaps/bitcoin128.xpm
  209. %{_bindir}/convert %{buildroot}%{_datadir}/pixmaps/bitcoin256.png %{buildroot}%{_datadir}/pixmaps/bitcoin256.xpm
  210. touch %{buildroot}%{_datadir}/pixmaps/*.png -r %{SOURCE100}
  211. touch %{buildroot}%{_datadir}/pixmaps/*.xpm -r %{SOURCE100}
  212. # Desktop File - change the touch timestamp if modifying
  213. mkdir -p %{buildroot}%{_datadir}/applications
  214. cat <<EOF > %{buildroot}%{_datadir}/applications/bitcoin-core.desktop
  215. [Desktop Entry]
  216. Encoding=UTF-8
  217. Name=Bitcoin
  218. Comment=Bitcoin P2P Cryptocurrency
  219. Comment[fr]=Bitcoin, monnaie virtuelle cryptographique pair à pair
  220. Comment[tr]=Bitcoin, eşten eşe kriptografik sanal para birimi
  221. Exec=bitcoin-qt %u
  222. Terminal=false
  223. Type=Application
  224. Icon=bitcoin128
  225. MimeType=x-scheme-handler/bitcoin;
  226. Categories=Office;Finance;
  227. EOF
  228. # change touch date when modifying desktop
  229. touch -a -m -t 201511100546 %{buildroot}%{_datadir}/applications/bitcoin-core.desktop
  230. %{_bindir}/desktop-file-validate %{buildroot}%{_datadir}/applications/bitcoin-core.desktop
  231. # KDE protocol - change the touch timestamp if modifying
  232. mkdir -p %{buildroot}%{_datadir}/kde4/services
  233. cat <<EOF > %{buildroot}%{_datadir}/kde4/services/bitcoin-core.protocol
  234. [Protocol]
  235. exec=bitcoin-qt '%u'
  236. protocol=bitcoin
  237. input=none
  238. output=none
  239. helper=true
  240. listing=
  241. reading=false
  242. writing=false
  243. makedir=false
  244. deleting=false
  245. EOF
  246. # change touch date when modifying protocol
  247. touch -a -m -t 201511100546 %{buildroot}%{_datadir}/kde4/services/bitcoin-core.protocol
  248. %endif
  249. # man pages
  250. install -D -p %{SOURCE20} %{buildroot}%{_mandir}/man1/bitcoind.1
  251. install -p %{SOURCE21} %{buildroot}%{_mandir}/man1/bitcoin-cli.1
  252. %if %{_buildqt}
  253. install -p %{SOURCE22} %{buildroot}%{_mandir}/man1/bitcoin-qt.1
  254. %endif
  255. # nuke these, we do extensive testing of binaries in %%check before packaging
  256. rm -f %{buildroot}%{_bindir}/test_*
  257. %check
  258. make check
  259. pushd src
  260. srcdir=. test/bitcoin-util-test.py
  261. popd
  262. test/functional/test_runner.py --extended
  263. %post libs -p /sbin/ldconfig
  264. %postun libs -p /sbin/ldconfig
  265. %pre server
  266. getent group bitcoin >/dev/null || groupadd -r bitcoin
  267. getent passwd bitcoin >/dev/null ||
  268. useradd -r -g bitcoin -d /var/lib/bitcoin -s /sbin/nologin \
  269. -c "Bitcoin wallet server" bitcoin
  270. exit 0
  271. %post server
  272. %systemd_post bitcoin.service
  273. # SELinux
  274. if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then
  275. for selinuxvariant in %{selinux_variants}; do
  276. %{_sbindir}/semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/bitcoin.pp &> /dev/null || :
  277. done
  278. %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 8332
  279. %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 8333
  280. %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18332
  281. %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18333
  282. %{_sbindir}/fixfiles -R bitcoin-server restore &> /dev/null || :
  283. %{_sbindir}/restorecon -R %{_localstatedir}/lib/bitcoin || :
  284. fi
  285. %posttrans server
  286. %{_bindir}/systemd-tmpfiles --create
  287. %preun server
  288. %systemd_preun bitcoin.service
  289. %postun server
  290. %systemd_postun bitcoin.service
  291. # SELinux
  292. if [ $1 -eq 0 ]; then
  293. if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then
  294. %{_sbindir}/semanage port -d -p tcp 8332
  295. %{_sbindir}/semanage port -d -p tcp 8333
  296. %{_sbindir}/semanage port -d -p tcp 18332
  297. %{_sbindir}/semanage port -d -p tcp 18333
  298. for selinuxvariant in %{selinux_variants}; do
  299. %{_sbindir}/semodule -s ${selinuxvariant} -r bitcoin &> /dev/null || :
  300. done
  301. %{_sbindir}/fixfiles -R bitcoin-server restore &> /dev/null || :
  302. [ -d %{_localstatedir}/lib/bitcoin ] && \
  303. %{_sbindir}/restorecon -R %{_localstatedir}/lib/bitcoin &> /dev/null || :
  304. fi
  305. fi
  306. %clean
  307. rm -rf %{buildroot}
  308. %if %{_buildqt}
  309. %files core
  310. %defattr(-,root,root,-)
  311. %license COPYING db-%{bdbv}.NC-LICENSE
  312. %doc COPYING bitcoin.conf.example doc/README.md doc/bips.md doc/files.md doc/multiwallet-qt.md doc/reduce-traffic.md doc/release-notes.md doc/tor.md
  313. %attr(0755,root,root) %{_bindir}/bitcoin-qt
  314. %attr(0644,root,root) %{_datadir}/applications/bitcoin-core.desktop
  315. %attr(0644,root,root) %{_datadir}/kde4/services/bitcoin-core.protocol
  316. %attr(0644,root,root) %{_datadir}/pixmaps/*.ico
  317. %attr(0644,root,root) %{_datadir}/pixmaps/*.bmp
  318. %attr(0644,root,root) %{_datadir}/pixmaps/*.svg
  319. %attr(0644,root,root) %{_datadir}/pixmaps/*.png
  320. %attr(0644,root,root) %{_datadir}/pixmaps/*.xpm
  321. %attr(0644,root,root) %{_mandir}/man1/bitcoin-qt.1*
  322. %endif
  323. %files libs
  324. %defattr(-,root,root,-)
  325. %license COPYING
  326. %doc COPYING doc/README.md doc/shared-libraries.md
  327. %{_libdir}/lib*.so.*
  328. %files devel
  329. %defattr(-,root,root,-)
  330. %license COPYING
  331. %doc COPYING doc/README.md doc/developer-notes.md doc/shared-libraries.md
  332. %attr(0644,root,root) %{_includedir}/*.h
  333. %{_libdir}/*.so
  334. %{_libdir}/*.a
  335. %{_libdir}/*.la
  336. %attr(0644,root,root) %{_libdir}/pkgconfig/*.pc
  337. %files server
  338. %defattr(-,root,root,-)
  339. %license COPYING db-%{bdbv}.NC-LICENSE
  340. %doc COPYING bitcoin.conf.example doc/README.md doc/REST-interface.md doc/bips.md doc/dnsseed-policy.md doc/files.md doc/reduce-traffic.md doc/release-notes.md doc/tor.md
  341. %attr(0755,root,root) %{_sbindir}/bitcoind
  342. %attr(0644,root,root) %{_tmpfilesdir}/bitcoin.conf
  343. %attr(0644,root,root) %{_unitdir}/bitcoin.service
  344. %dir %attr(0750,bitcoin,bitcoin) %{_sysconfdir}/bitcoin
  345. %dir %attr(0750,bitcoin,bitcoin) %{_localstatedir}/lib/bitcoin
  346. %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/bitcoin
  347. %attr(0644,root,root) %{_datadir}/selinux/*/*.pp
  348. %attr(0644,root,root) %{_mandir}/man1/bitcoind.1*
  349. %files utils
  350. %defattr(-,root,root,-)
  351. %license COPYING
  352. %doc COPYING bitcoin.conf.example doc/README.md
  353. %attr(0755,root,root) %{_bindir}/bitcoin-cli
  354. %attr(0755,root,root) %{_bindir}/bitcoin-tx
  355. %attr(0755,root,root) %{_bindir}/bench_bitcoin
  356. %attr(0644,root,root) %{_mandir}/man1/bitcoin-cli.1*
  357. %changelog
  358. * Fri Feb 26 2016 Alice Wonder <buildmaster@librelamp.com> - 0.12.0-2
  359. - Rename Qt package from bitcoin to bitcoin-core
  360. - Make building of the Qt package optional
  361. - When building the Qt package, default to Qt5 but allow building
  362. - against Qt4
  363. - Only run SELinux stuff in post scripts if it is not set to disabled
  364. * Wed Feb 24 2016 Alice Wonder <buildmaster@librelamp.com> - 0.12.0-1
  365. - Initial spec file for 0.12.0 release
  366. # This spec file is written from scratch but a lot of the packaging decisions are directly
  367. # based upon the 0.11.2 package spec file from https://www.ringingliberty.com/bitcoin/