%define bdbv 4.8.30 %global selinux_variants mls strict targeted ## GUI building is somewhat broken currently #%global _no_gui 1 %if 0%{?_no_gui:1} %define _buildqt 0 %define buildargs --with-gui=no %else %define _buildqt 1 %if 0%{?_use_qt4} %define buildargs --with-qrencode --with-gui=qt4 %else %define buildargs --with-qrencode --with-gui=qt5 %endif %endif Name: tokyocoin Version: 1.1 Release: 2%{?dist} Summary: Tokyocoin is a PoS-based cryptocurrency. Group: Applications/System License: MIT URL: https://github.com/%{name}dev Source0: https://github.com/%{name}dev/%{name}src/archive/%{version}.tar.gz #Source1: http://download.oracle.com/berkeley-db/db-%{bdbv}.NC.tar.gz Source10: https://raw.githubusercontent.com/%{name}dev/%{name}src/%{version}/contrib/debian/examples/novacoin.conf #manpages pages Source20: https://raw.githubusercontent.com/%{name}dev/%{name}src/%{version}/contrib/debian/manpages/novacoind.1 Source21: https://raw.githubusercontent.com/%{name}dev/%{name}src/%{version}/contrib/debian/manpages/novacoin.conf.5 ##selinux #Source30: https://raw.githubusercontent.com/%{name}dev/%{name}src/v%{version}/contrib/rpm/novacoin.te ## Source31 - what about %{name}dev-tx and bench_%{name}src ??? #Source31: https://raw.githubusercontent.com/%{name}dev/%{name}src/v%{version}/contrib/rpm/novacoin.fc #Source32: https://raw.githubusercontent.com/%{name}dev/%{name}src/v%{version}/contrib/rpm/novacoin.if #Source100: https://github.com/%{name}dev/%{name}src-logos/raw/master/Logos%20Vector/TokyoCoin%20Symbol.svg BuildRequires: openssl-devel BuildRequires: boost-devel #BuildRequires: miniupnpc-devel #BuildRequires: autoconf automake libtool BuildRequires: libevent-devel BuildRequires: libdb-cxx-devel %description Tokyocoin is a PoS-based cryptocurrency. %if %{_buildqt} %package core Summary: Tokyocoin is a PoS-based cryptocurrency. Group: Applications/System Obsoletes: %{name} < %{version}-%{release} Provides: %{name} = %{version}-%{release} %if 0%{?_use_qt4} BuildRequires: qt-devel %else BuildRequires: qt5-qtbase-devel # for /usr/bin/lrelease-qt5 BuildRequires: qt5-linguist %endif BuildRequires: protobuf-devel BuildRequires: qrencode-devel BuildRequires: %{_bindir}/desktop-file-validate # for icon generation from SVG BuildRequires: %{_bindir}/inkscape BuildRequires: %{_bindir}/convert %description core Tokyocoin is a PoS-based cryptocurrency. This package contains the Qt based graphical client and node. If you are looking to run a TokyoCoin wallet, this is probably the package you want. %endif %package libs Summary: TokyoCoin shared libraries Group: System Environment/Libraries %description libs This package provides the tokyocoinconsensus shared libraries. These libraries may be used by third party software to provide consensus verification functionality. Unless you know need this package, you probably do not. %package devel Summary: Tokyocoin is a PoS-based cryptocurrency. Group: Development/Libraries Requires: %{name}-libs = %{version}-%{release} %description devel This package contains the header files and static library for the tokyocoinconsensus shared library. If you are developing or compiling software that wants to link against that library, then you need this package installed. Most people do not need this package installed. %package server Summary: The tokyocoin daemon Group: System Environment/Daemons #Requires: %{name}-utils = %{version}-%{release} #Requires: selinux-policy policycoreutils-python Requires(pre): shadow-utils Requires(post): %{_sbindir}/semodule %{_sbindir}/restorecon %{_sbindir}/fixfiles %{_sbindir}/sestatus Requires(postun): %{_sbindir}/semodule %{_sbindir}/restorecon %{_sbindir}/fixfiles %{_sbindir}/sestatus BuildRequires: systemd BuildRequires: checkpolicy BuildRequires: %{_datadir}/selinux/devel/Makefile %description server This package provides a stand-alone tokyocoin-core daemon. For most users, this package is only needed if they need a full-node without the graphical client. Some third party wallet software will want this package to provide the actual tokyocoin-core node they use to connect to the network. If you use the graphical tokyocoin-core client then you almost certainly do not need this package. %package utils Summary: TokyoCoin utilities Group: Applications/System %description utils This package provides several command line utilities for interacting with a tokyocoin-core daemon. The tokyocoin-cli utility allows you to communicate and control a tokyocoin daemon over RPC, the tokyocoin-tx utility allows you to create a custom transaction, and the bench_tokyocoin utility can be used to perform some benchmarks. This package contains utilities needed by the tokyocoin-server package. %prep %autosetup -n %{name}src-%{version} cp -p %{SOURCE10} ./%{name}.conf.example #tar -zxf %{SOURCE1} #cp -p db-%{bdbv}.NC/LICENSE ./db-%{bdbv}.NC-LICENSE #mkdir db4 SELinux #cp -p %{SOURCE30} %{SOURCE31} %{SOURCE32} SELinux/ %build #CWD=`pwd` #cd db-%{bdbv}.NC/build_unix/ #../dist/configure --enable-cxx --disable-shared --with-pic --prefix=${CWD}/db4 #make install #cd ../.. #./autogen.sh #configure LDFLAGS="-L${CWD}/db4/lib/" CPPFLAGS="-I${CWD}/db4/include/" --with-miniupnpc --enable-glibc-back-compat %{buildargs} pushd src/ chmod +x leveldb/build_detect_platform #make -f makefile.unix %{?_smp_mflags} BDB_INCLUDE_PATH=%{_includedir}/libdb4 BDB_LIB_PATH=%{_libdir}/libdb4 USE_UPNP= make -f makefile.unix %{?_smp_mflags} USE_UPNP=- popd #pushd SELinux #for selinuxvariant in %{selinux_variants}; do # make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile # mv %{name}.pp %{name}.pp.${selinuxvariant} # make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile clean #done #popd %install install -Dp -m755 src/%{name}d %{buildroot}%{_sbindir}/%{name}d # systemd stuff mkdir -p %{buildroot}%{_tmpfilesdir} cat < %{buildroot}%{_tmpfilesdir}/%{name}.conf d /run/%{name}d 0750 %{name} %{name} - EOF touch -a -m -t 201504280000 %{buildroot}%{_tmpfilesdir}/%{name}.conf mkdir -p %{buildroot}%{_sysconfdir}/sysconfig cat < %{buildroot}%{_sysconfdir}/sysconfig/%{name} # Provide options to the %{name} daemon here, for example # OPTIONS="-testnet -disable-wallet" OPTIONS="" # System service defaults. # Don't change these unless you know what you're doing. CONFIG_FILE="%{_sysconfdir}/%{name}/%{name}.conf" DATA_DIR="%{_localstatedir}/lib/%{name}" PID_FILE="/run/%{name}d/%{name}d.pid" EOF touch -a -m -t 201504280000 %{buildroot}%{_sysconfdir}/sysconfig/%{name} mkdir -p %{buildroot}%{_unitdir} cat < %{buildroot}%{_unitdir}/%{name}d.service [Unit] Description=TokyoCoin daemon After=syslog.target network.target [Service] Type=forking ExecStart=%{_sbindir}/%{name}d -daemon -conf=\${CONFIG_FILE} -datadir=\${DATA_DIR} -pid=\${PID_FILE} \$OPTIONS EnvironmentFile=%{_sysconfdir}/sysconfig/%{name} User=%{name} Group=%{name} Restart=on-failure PrivateTmp=true TimeoutStopSec=120 TimeoutStartSec=60 StartLimitInterval=240 StartLimitBurst=5 [Install] WantedBy=multi-user.target EOF touch -a -m -t 201504280000 %{buildroot}%{_unitdir}/%{name}d.service #end systemd stuff mkdir %{buildroot}%{_sysconfdir}/%{name} mkdir -p %{buildroot}%{_localstatedir}/lib/%{name} ##SELinux #for selinuxvariant in %{selinux_variants}; do # install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} # install -p -m 644 SELinux/%{name}.pp.${selinuxvariant} %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{name}.pp #done %if %{_buildqt} # qt icons install -D -p share/pixmaps/%{name}.ico %{buildroot}%{_datadir}/pixmaps/%{name}.ico install -p share/pixmaps/nsis-header.bmp %{buildroot}%{_datadir}/pixmaps/ install -p share/pixmaps/nsis-wizard.bmp %{buildroot}%{_datadir}/pixmaps/ #install -p %{SOURCE100} %{buildroot}%{_datadir}/pixmaps/%{name}.svg #%{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/%{name}16.png -w16 -h16 #%{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/%{name}32.png -w32 -h32 #%{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/%{name}64.png -w64 -h64 #%{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/%{name}128.png -w128 -h128 #%{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/%{name}256.png -w256 -h256 #%{_bindir}/convert -resize 16x16 %{buildroot}%{_datadir}/pixmaps/%{name}256.png %{buildroot}%{_datadir}/pixmaps/%{name}16.xpm #%{_bindir}/convert -resize 32x32 %{buildroot}%{_datadir}/pixmaps/%{name}256.png %{buildroot}%{_datadir}/pixmaps/%{name}32.xpm #%{_bindir}/convert -resize 64x64 %{buildroot}%{_datadir}/pixmaps/%{name}256.png %{buildroot}%{_datadir}/pixmaps/%{name}64.xpm #%{_bindir}/convert -resize 128x128 %{buildroot}%{_datadir}/pixmaps/%{name}256.png %{buildroot}%{_datadir}/pixmaps/%{name}128.xpm #%{_bindir}/convert %{buildroot}%{_datadir}/pixmaps/%{name}256.png %{buildroot}%{_datadir}/pixmaps/%{name}256.xpm #touch %{buildroot}%{_datadir}/pixmaps/*.png -r %{SOURCE100} #touch %{buildroot}%{_datadir}/pixmaps/*.xpm -r %{SOURCE100} # Desktop File - change the touch timestamp if modifying mkdir -p %{buildroot}%{_datadir}/applications cat < %{buildroot}%{_datadir}/applications/%{name}-core.desktop [Desktop Entry] Encoding=UTF-8 Name=TokyoCoin Comment=TokyoCoin P2P Cryptocurrency Comment[fr]=TokyoCoin, monnaie virtuelle cryptographique pair à pair Comment[tr]=TokyoCoin, eşten eşe kriptografik sanal para birimi Exec=%{name}-qt %u Terminal=false Type=Application Icon=%{name}128 MimeType=x-scheme-handler/%{name}; Categories=Office;Finance; EOF # change touch date when modifying desktop touch -a -m -t 201511100546 %{buildroot}%{_datadir}/applications/%{name}-core.desktop %{_bindir}/desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}-core.desktop # KDE protocol - change the touch timestamp if modifying mkdir -p %{buildroot}%{_datadir}/kde4/services cat < %{buildroot}%{_datadir}/kde4/services/%{name}-core.protocol [Protocol] exec=%{name}-qt '%u' protocol=%{name} input=none output=none helper=true listing= reading=false writing=false makedir=false deleting=false EOF # change touch date when modifying protocol touch -a -m -t 201511100546 %{buildroot}%{_datadir}/kde4/services/%{name}-core.protocol %endif # man pages install -D -p %{SOURCE20} %{buildroot}%{_mandir}/man1/%{name}d.1 install -D -p %{SOURCE21} %{buildroot}%{_mandir}/man5/%{name}.conf.5 %if %{_buildqt} install -D -p %{SOURCE22} %{buildroot}%{_mandir}/man1/%{name}-qt.1 %endif # nuke these, we do extensive testing of binaries in %%check before packaging rm -f %{buildroot}%{_bindir}/test_* # Currently somewhat broken #%check #make check #pushd src #srcdir=. test/%{name}-util-test.py #popd #qa/pull-tester/rpc-tests.py -extended %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig %pre server getent group %{name} >/dev/null || groupadd -r %{name} getent passwd %{name} >/dev/null || useradd -r -g %{name} -d /var/lib/%{name} -s /sbin/nologin \ -c "TokyoCoin wallet server" %{name} exit 0 %post server %systemd_post %{name}d.service # SELinux #if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then #for selinuxvariant in %{selinux_variants}; do # %{_sbindir}/semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/%{name}.pp &> /dev/null || : #done #%{_sbindir}/semanage port -a -t %{name}_port_t -p tcp 8332 #%{_sbindir}/semanage port -a -t %{name}_port_t -p tcp 8333 #%{_sbindir}/semanage port -a -t %{name}_port_t -p tcp 18332 #%{_sbindir}/semanage port -a -t %{name}_port_t -p tcp 18333 #%{_sbindir}/fixfiles -R %{name}-server restore &> /dev/null || : #%{_sbindir}/restorecon -R %{_localstatedir}/lib/%{name} || : #fi %posttrans server %{_bindir}/systemd-tmpfiles --create %preun server %systemd_preun %{name}d.service %postun server %systemd_postun %{name}d.service # SELinux if [ $1 -eq 0 ]; then if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then %{_sbindir}/semanage port -d -p tcp 8332 %{_sbindir}/semanage port -d -p tcp 8333 %{_sbindir}/semanage port -d -p tcp 18332 %{_sbindir}/semanage port -d -p tcp 18333 for selinuxvariant in %{selinux_variants}; do %{_sbindir}/semodule -s ${selinuxvariant} -r %{name} &> /dev/null || : done %{_sbindir}/fixfiles -R %{name}-server restore &> /dev/null || : [ -d %{_localstatedir}/lib/%{name} ] && \ %{_sbindir}/restorecon -R %{_localstatedir}/lib/%{name} &> /dev/null || : fi fi %clean rm -rf %{buildroot} %if %{_buildqt} %files core %defattr(-,root,root,-) %license COPYING db-%{bdbv}.NC-LICENSE %doc COPYING %{name}.conf.example README doc/bips.md doc/files.md doc/multiwallet-qt.md doc/reduce-traffic.md doc/release-notes.md doc/tor.md %attr(0755,root,root) %{_bindir}/%{name}-qt %attr(0644,root,root) %{_datadir}/applications/%{name}-core.desktop %attr(0644,root,root) %{_datadir}/kde4/services/%{name}-core.protocol %attr(0644,root,root) %{_datadir}/pixmaps/*.ico %attr(0644,root,root) %{_datadir}/pixmaps/*.bmp %attr(0644,root,root) %{_datadir}/pixmaps/*.svg %attr(0644,root,root) %{_datadir}/pixmaps/*.png %attr(0644,root,root) %{_datadir}/pixmaps/*.xpm %attr(0644,root,root) %{_mandir}/man1/%{name}-qt.1* %endif %files libs %defattr(-,root,root,-) %license COPYING %doc COPYING README #{_libdir}/lib*.so.* %files devel %defattr(-,root,root,-) %license COPYING %doc COPYING README #%attr(0644,root,root) %{_includedir}/*.h #%{_libdir}/*.so #%{_libdir}/*.a #%{_libdir}/*.la #%attr(0644,root,root) %{_libdir}/pkgconfig/*.pc %files server %defattr(-,root,root,-) %license COPYING %doc COPYING %{name}.conf.example README %attr(0755,root,root) %{_sbindir}/%{name}d %attr(0644,root,root) %{_tmpfilesdir}/%{name}.conf %attr(0644,root,root) %{_unitdir}/%{name}d.service %dir %attr(0750,%{name},%{name}) %{_sysconfdir}/%{name} %dir %attr(0750,%{name},%{name}) %{_localstatedir}/lib/%{name} %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/%{name} #attr(0644,root,root) %{_datadir}/selinux/*/*.pp %attr(0644,root,root) %{_mandir}/man1/%{name}d.1* %attr(0644,root,root) %{_mandir}/man5/%{name}.conf.5* #files utils #defattr(-,root,root,-) #license COPYING #doc COPYING %{name}.conf.example README #attr(0755,root,root) %{_bindir}/%{name}-cli #attr(0755,root,root) %{_bindir}/%{name}-tx #attr(0755,root,root) %{_bindir}/bench_%{name} #attr(0644,root,root) %{_mandir}/man1/%{name}-cli.1* #attr(0644,root,root) %{_mandir}/man1/%{name}-tx.1* %changelog * Fri Jan 05 2018 Vadim Raskhozhev - 1.1-2 _ Changed unit file name to tokyocoind.service * Thu Jan 04 2018 Vadim Raskhozhev - 1.1-1 - Initial RPM