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.

starwels.spec 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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: starwels
  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://github.com/starwels/
  21. Source0: https://github.com/starwels/starwels/releases
  22. Source1: http://download.oracle.com/berkeley-db/db-%{bdbv}.NC.tar.gz
  23. Source10: https://raw.githubusercontent.com/starwels/starwels/v%{version}/contrib/debian/examples/starwels.conf
  24. #man pages
  25. Source20: https://raw.githubusercontent.com/starwels/starwels/v%{version}/doc/man/starwelsd.1
  26. Source21: https://raw.githubusercontent.com/starwels/starwels/v%{version}/doc/man/starwels-cli.1
  27. Source22: https://raw.githubusercontent.com/starwels/starwels/v%{version}/doc/man/starwels-qt.1
  28. #selinux
  29. Source30: https://raw.githubusercontent.com/starwels/starwels/v%{version}/contrib/rpm/starwels.te
  30. # Source31 - what about starwels-tx and bench_starwels ???
  31. Source31: https://raw.githubusercontent.com/starwels/starwels/v%{version}/contrib/rpm/starwels.fc
  32. Source32: https://raw.githubusercontent.com/starwels/starwels/v%{version}/contrib/rpm/starwels.if
  33. Source100: https://upload.wikimedia.org/wikipedia/commons/4/46/Starwels.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: starwels-0.12.0-libressl.patch
  44. %description
  45. Starwels 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 starwelss 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. Starwels 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 starwelss 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 Starwels wallet, this is probably the package you want.
  73. %endif
  74. %package libs
  75. Summary: Starwels shared libraries
  76. Group: System Environment/Libraries
  77. %description libs
  78. This package provides the starwelsconsensus 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 starwels
  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. starwelsconsensus 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 starwels daemon
  93. Group: System Environment/Daemons
  94. Requires: starwels-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 starwels 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. starwels node they use to connect to the network.
  107. If you use the graphical starwels client then you almost certainly do not
  108. need this package.
  109. %package utils
  110. Summary: Starwels utilities
  111. Group: Applications/System
  112. %description utils
  113. This package provides several command line utilities for interacting with a
  114. starwels daemon.
  115. The starwels-cli utility allows you to communicate and control a starwels daemon
  116. over RPC, the starwels-tx utility allows you to create a custom transaction, and
  117. the bench_starwels utility can be used to perform some benchmarks.
  118. This package contains utilities needed by the starwels-server package.
  119. %prep
  120. %setup -q
  121. %patch0 -p1 -b .libressl
  122. cp -p %{SOURCE10} ./starwels.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 starwels.pp starwels.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}/starwelsd %{buildroot}%{_sbindir}/starwelsd
  147. # systemd stuff
  148. mkdir -p %{buildroot}%{_tmpfilesdir}
  149. cat <<EOF > %{buildroot}%{_tmpfilesdir}/starwels.conf
  150. d /run/starwelsd 0750 starwels starwels -
  151. EOF
  152. touch -a -m -t 201504280000 %{buildroot}%{_tmpfilesdir}/starwels.conf
  153. mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
  154. cat <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/starwels
  155. # Provide options to the starwels daemon here, for example
  156. # OPTIONS="-ai -disable-wallet"
  157. OPTIONS=""
  158. # System service defaults.
  159. # Don't change these unless you know what you're doing.
  160. CONFIG_FILE="%{_sysconfdir}/starwels/starwels.conf"
  161. DATA_DIR="%{_localstatedir}/lib/starwels"
  162. PID_FILE="/run/starwelsd/starwelsd.pid"
  163. EOF
  164. touch -a -m -t 201504280000 %{buildroot}%{_sysconfdir}/sysconfig/starwels
  165. mkdir -p %{buildroot}%{_unitdir}
  166. cat <<EOF > %{buildroot}%{_unitdir}/starwels.service
  167. [Unit]
  168. Description=Starwels daemon
  169. After=syslog.target network.target
  170. [Service]
  171. Type=forking
  172. ExecStart=%{_sbindir}/starwelsd -daemon -conf=\${CONFIG_FILE} -datadir=\${DATA_DIR} -pid=\${PID_FILE} \$OPTIONS
  173. EnvironmentFile=%{_sysconfdir}/sysconfig/starwels
  174. User=starwels
  175. Group=starwels
  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}/starwels.service
  186. #end systemd stuff
  187. mkdir %{buildroot}%{_sysconfdir}/starwels
  188. mkdir -p %{buildroot}%{_localstatedir}/lib/starwels
  189. #SELinux
  190. for selinuxvariant in %{selinux_variants}; do
  191. install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
  192. install -p -m 644 SELinux/starwels.pp.${selinuxvariant} %{buildroot}%{_datadir}/selinux/${selinuxvariant}/starwels.pp
  193. done
  194. %if %{_buildqt}
  195. # qt icons
  196. install -D -p share/pixmaps/starwels.ico %{buildroot}%{_datadir}/pixmaps/starwels.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/starwels.svg
  200. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/starwels16.png -w16 -h16
  201. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/starwels32.png -w32 -h32
  202. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/starwels64.png -w64 -h64
  203. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/starwels128.png -w128 -h128
  204. %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/starwels256.png -w256 -h256
  205. %{_bindir}/convert -resize 16x16 %{buildroot}%{_datadir}/pixmaps/starwels256.png %{buildroot}%{_datadir}/pixmaps/starwels16.xpm
  206. %{_bindir}/convert -resize 32x32 %{buildroot}%{_datadir}/pixmaps/starwels256.png %{buildroot}%{_datadir}/pixmaps/starwels32.xpm
  207. %{_bindir}/convert -resize 64x64 %{buildroot}%{_datadir}/pixmaps/starwels256.png %{buildroot}%{_datadir}/pixmaps/starwels64.xpm
  208. %{_bindir}/convert -resize 128x128 %{buildroot}%{_datadir}/pixmaps/starwels256.png %{buildroot}%{_datadir}/pixmaps/starwels128.xpm
  209. %{_bindir}/convert %{buildroot}%{_datadir}/pixmaps/starwels256.png %{buildroot}%{_datadir}/pixmaps/starwels256.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/starwels.desktop
  215. [Desktop Entry]
  216. Encoding=UTF-8
  217. Name=Starwels
  218. Comment=Starwels P2P Cryptocurrency
  219. Comment[fr]=Starwels, monnaie virtuelle cryptographique pair à pair
  220. Comment[tr]=Starwels, eşten eşe kriptografik sanal para birimi
  221. Exec=starwels-qt %u
  222. Terminal=false
  223. Type=Application
  224. Icon=starwels128
  225. MimeType=x-scheme-handler/starwels;
  226. Categories=Office;Finance;
  227. EOF
  228. # change touch date when modifying desktop
  229. touch -a -m -t 201511100546 %{buildroot}%{_datadir}/applications/starwels.desktop
  230. %{_bindir}/desktop-file-validate %{buildroot}%{_datadir}/applications/starwels.desktop
  231. # KDE protocol - change the touch timestamp if modifying
  232. mkdir -p %{buildroot}%{_datadir}/kde4/services
  233. cat <<EOF > %{buildroot}%{_datadir}/kde4/services/starwels.protocol
  234. [Protocol]
  235. exec=starwels-qt '%u'
  236. protocol=starwels
  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/starwels.protocol
  248. %endif
  249. # man pages
  250. install -D -p %{SOURCE20} %{buildroot}%{_mandir}/man1/starwelsd.1
  251. install -p %{SOURCE21} %{buildroot}%{_mandir}/man1/starwels-cli.1
  252. %if %{_buildqt}
  253. install -p %{SOURCE22} %{buildroot}%{_mandir}/man1/starwels-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. srcdir=src test/starwels-util-test.py
  260. test/functional/test_runner.py --extended
  261. %post libs -p /sbin/ldconfig
  262. %postun libs -p /sbin/ldconfig
  263. %pre server
  264. getent group starwels >/dev/null || groupadd -r starwels
  265. getent passwd starwels >/dev/null ||
  266. useradd -r -g starwels -d /var/lib/starwels -s /sbin/nologin \
  267. -c "Starwels wallet server" starwels
  268. exit 0
  269. %post server
  270. %systemd_post starwels.service
  271. # SELinux
  272. if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then
  273. for selinuxvariant in %{selinux_variants}; do
  274. %{_sbindir}/semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/starwels.pp &> /dev/null || :
  275. done
  276. %{_sbindir}/semanage port -a -t starwels_port_t -p tcp 8342
  277. %{_sbindir}/semanage port -a -t starwels_port_t -p tcp 8343
  278. %{_sbindir}/semanage port -a -t starwels_port_t -p tcp 8332
  279. %{_sbindir}/semanage port -a -t starwels_port_t -p tcp 8333
  280. %{_sbindir}/semanage port -a -t starwels_port_t -p tcp 18443
  281. %{_sbindir}/semanage port -a -t starwels_port_t -p tcp 18444
  282. %{_sbindir}/fixfiles -R starwels-server restore &> /dev/null || :
  283. %{_sbindir}/restorecon -R %{_localstatedir}/lib/starwels || :
  284. fi
  285. %posttrans server
  286. %{_bindir}/systemd-tmpfiles --create
  287. %preun server
  288. %systemd_preun starwels.service
  289. %postun server
  290. %systemd_postun starwels.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 8342
  295. %{_sbindir}/semanage port -d -p tcp 8343
  296. %{_sbindir}/semanage port -d -p tcp 8332
  297. %{_sbindir}/semanage port -d -p tcp 8333
  298. %{_sbindir}/semanage port -d -p tcp 18443
  299. %{_sbindir}/semanage port -d -p tcp 18444
  300. for selinuxvariant in %{selinux_variants}; do
  301. %{_sbindir}/semodule -s ${selinuxvariant} -r starwels &> /dev/null || :
  302. done
  303. %{_sbindir}/fixfiles -R starwels-server restore &> /dev/null || :
  304. [ -d %{_localstatedir}/lib/starwels ] && \
  305. %{_sbindir}/restorecon -R %{_localstatedir}/lib/starwels &> /dev/null || :
  306. fi
  307. fi
  308. %clean
  309. rm -rf %{buildroot}
  310. %if %{_buildqt}
  311. %files core
  312. %defattr(-,root,root,-)
  313. %license COPYING db-%{bdbv}.NC-LICENSE
  314. %doc COPYING starwels.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
  315. %attr(0755,root,root) %{_bindir}/starwels-qt
  316. %attr(0644,root,root) %{_datadir}/applications/starwels.desktop
  317. %attr(0644,root,root) %{_datadir}/kde4/services/starwels.protocol
  318. %attr(0644,root,root) %{_datadir}/pixmaps/*.ico
  319. %attr(0644,root,root) %{_datadir}/pixmaps/*.bmp
  320. %attr(0644,root,root) %{_datadir}/pixmaps/*.svg
  321. %attr(0644,root,root) %{_datadir}/pixmaps/*.png
  322. %attr(0644,root,root) %{_datadir}/pixmaps/*.xpm
  323. %attr(0644,root,root) %{_mandir}/man1/starwels-qt.1*
  324. %endif
  325. %files libs
  326. %defattr(-,root,root,-)
  327. %license COPYING
  328. %doc COPYING doc/README.md doc/shared-libraries.md
  329. %{_libdir}/lib*.so.*
  330. %files devel
  331. %defattr(-,root,root,-)
  332. %license COPYING
  333. %doc COPYING doc/README.md doc/developer-notes.md doc/shared-libraries.md
  334. %attr(0644,root,root) %{_includedir}/*.h
  335. %{_libdir}/*.so
  336. %{_libdir}/*.a
  337. %{_libdir}/*.la
  338. %attr(0644,root,root) %{_libdir}/pkgconfig/*.pc
  339. %files server
  340. %defattr(-,root,root,-)
  341. %license COPYING db-%{bdbv}.NC-LICENSE
  342. %doc COPYING starwels.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
  343. %attr(0755,root,root) %{_sbindir}/starwelsd
  344. %attr(0644,root,root) %{_tmpfilesdir}/starwels.conf
  345. %attr(0644,root,root) %{_unitdir}/starwels.service
  346. %dir %attr(0750,starwels,starwels) %{_sysconfdir}/starwels
  347. %dir %attr(0750,starwels,starwels) %{_localstatedir}/lib/starwels
  348. %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/starwels
  349. %attr(0644,root,root) %{_datadir}/selinux/*/*.pp
  350. %attr(0644,root,root) %{_mandir}/man1/starwelsd.1*
  351. %files utils
  352. %defattr(-,root,root,-)
  353. %license COPYING
  354. %doc COPYING starwels.conf.example doc/README.md
  355. %attr(0755,root,root) %{_bindir}/starwels-cli
  356. %attr(0755,root,root) %{_bindir}/starwels-tx
  357. %attr(0755,root,root) %{_bindir}/bench_starwels
  358. %attr(0644,root,root) %{_mandir}/man1/starwels-cli.1*
  359. %changelog
  360. * Fri Feb 26 2016 Alice Wonder <buildmaster@librelamp.com> - 0.12.0-2
  361. - Rename Qt package from starwels to starwels
  362. - Make building of the Qt package optional
  363. - When building the Qt package, default to Qt5 but allow building
  364. - against Qt4
  365. - Only run SELinux stuff in post scripts if it is not set to disabled
  366. * Wed Feb 24 2016 Alice Wonder <buildmaster@librelamp.com> - 0.12.0-1
  367. - Initial spec file for 0.12.0 release
  368. # This spec file is written from scratch but a lot of the packaging decisions are directly
  369. # based upon the 0.11.2 package spec file from https://www.ringingliberty.com/bitcoin/