commit 715c20bbb6f7f075281ced73808d8b4dd54d2cda
Author: Miro Hrončok <miro(a)hroncok.cz>
Date: Sun Mar 11 21:53:59 2018 +0100
Initial package (#4815)
.gitignore | 2 +
sources | 2 +
vcmi-boost-1.66.patch | 280 ++++++++++++++++++++++++++++++++++++++++++++++++++
vcmi-mods.patch | 13 +++
vcmi.spec | 136 ++++++++++++++++++++++++
5 files changed, 433 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index e69de29..5350a59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/vcmi-0.99.tar.gz
+/vcmi.zip
diff --git a/sources b/sources
index e69de29..f176b98 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,2 @@
+686c2a0283184add785d50b447db806f vcmi-0.99.tar.gz
+2464d5e6200e95c8699c0c0ce38f1d47 vcmi.zip
diff --git a/vcmi-boost-1.66.patch b/vcmi-boost-1.66.patch
new file mode 100644
index 0000000..bf11504
--- /dev/null
+++ b/vcmi-boost-1.66.patch
@@ -0,0 +1,280 @@
+diff -up vcmi-0.99/lib/serializer/Connection.cpp.boost_compatibility
vcmi-0.99/lib/serializer/Connection.cpp
+--- vcmi-0.99/lib/serializer/Connection.cpp.boost_compatibility 2016-11-01
19:26:09.000000000 +0100
++++ vcmi-0.99/lib/serializer/Connection.cpp 2018-03-05 02:29:04.878950274 +0100
+@@ -62,12 +62,21 @@ void CConnection::init()
+ }
+
+ CConnection::CConnection(std::string host, std::string port, std::string Name)
++#if BOOST_VERSION < 106600
+ :iser(this), oser(this), io_service(new asio::io_service), name(Name)
++#else
++:iser(this), oser(this), io_context(new asio::io_context), name(Name)
++#endif
+ {
+ int i;
+ boost::system::error_code error = asio::error::host_not_found;
++#if BOOST_VERSION < 106600
+ socket = new tcp::socket(*io_service);
+ tcp::resolver resolver(*io_service);
++#else
++ socket = new tcp::socket(*io_context);
++ tcp::resolver resolver(*io_context);
++#endif
+ tcp::resolver::iterator end, pom, endpoint_iterator =
resolver.resolve(tcp::resolver::query(host,port),error);
+ if(error)
+ {
+@@ -112,20 +121,37 @@ connerror1:
+ logNetwork->errorStream() << error;
+ else
+ logNetwork->errorStream() << "No error info. ";
++#if BOOST_VERSION < 106600
+ delete io_service;
++#else
++ delete io_context;
++#endif
+ //delete socket;
+ throw std::runtime_error("Can't establish connection :(");
+ }
+ CConnection::CConnection(TSocket * Socket, std::string Name )
++#if BOOST_VERSION < 106600
+ :iser(this), oser(this), socket(Socket),io_service(&Socket->get_io_service()),
name(Name)//, send(this), rec(this)
++#else
++ :iser(this), oser(this), socket(Socket),io_context(&Socket->get_io_context()),
name(Name)//, send(this), rec(this)
++#endif
+ {
+ init();
+ }
++#if BOOST_VERSION < 106600
+ CConnection::CConnection(TAcceptor * acceptor, boost::asio::io_service *Io_service,
std::string Name)
+ : iser(this), oser(this), name(Name)//, send(this), rec(this)
++#else
++CConnection::CConnection(TAcceptor * acceptor, boost::asio::io_context *Io_context,
std::string Name)
++: iser(this), oser(this), name(Name)//, send(this), rec(this)
++#endif
+ {
+ boost::system::error_code error = asio::error::host_not_found;
++#if BOOST_VERSION < 106600
+ socket = new tcp::socket(*io_service);
++#else
++ socket = new tcp::socket(*io_context);
++#endif
+ acceptor->accept(*socket,error);
+ if (error)
+ {
+@@ -172,7 +198,11 @@ CConnection::~CConnection(void)
+ delete handler;
+
+ close();
++#if BOOST_VERSION < 106600
+ delete io_service;
++#else
++ delete io_context;
++#endif
+ delete wmx;
+ delete rmx;
+ }
+diff -up vcmi-0.99/lib/serializer/Connection.h.boost_compatibility
vcmi-0.99/lib/serializer/Connection.h
+--- vcmi-0.99/lib/serializer/Connection.h.boost_compatibility 2016-11-01
19:26:09.000000000 +0100
++++ vcmi-0.99/lib/serializer/Connection.h 2018-03-05 02:17:57.824585179 +0100
+@@ -24,6 +24,7 @@ namespace boost
+ {
+ class tcp;
+ }
++#if BOOST_VERSION < 106600
+ class io_service;
+
+ template <typename Protocol> class stream_socket_service;
+@@ -33,12 +34,26 @@ namespace boost
+ template <typename Protocol> class socket_acceptor_service;
+ template <typename Protocol,typename SocketAcceptorService>
+ class basic_socket_acceptor;
++#else
++ class io_context;
++
++ template <typename Protocol>
++ class basic_stream_socket;
++
++ template <typename Protocol>
++ class basic_socket_acceptor;
++#endif
+ }
+ class mutex;
+ }
+
++#if BOOST_VERSION < 106600
+ typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp ,
boost::asio::stream_socket_service<boost::asio::ip::tcp> > TSocket;
+ typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp,
boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
++#else
++typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp > TSocket;
++typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp > TAcceptor;
++#endif
+
+ /// Main class for network communication
+ /// Allows establishing connection and bidirectional read-write
+@@ -61,7 +76,11 @@ public:
+ bool logging;
+ bool connected;
+ bool myEndianess, contactEndianess; //true if little endian, if endianness is different
we'll have to revert received multi-byte vars
++#if BOOST_VERSION < 106600
+ boost::asio::io_service *io_service;
++#else
++ boost::asio::io_context *io_context;
++#endif
+ std::string name; //who uses this connection
+
+ int connectionID;
+@@ -70,7 +89,11 @@ public:
+ bool receivedStop, sendStop;
+
+ CConnection(std::string host, std::string port, std::string Name);
++#if BOOST_VERSION < 106600
+ CConnection(TAcceptor * acceptor, boost::asio::io_service *Io_service, std::string
Name);
++#else
++ CConnection(TAcceptor * acceptor, boost::asio::io_context *Io_context, std::string
Name);
++#endif
+ CConnection(TSocket * Socket, std::string Name); //use immediately after accepting
connection into socket
+
+ void close();
+diff -up vcmi-0.99/server/CVCMIServer.cpp.boost_compatibility
vcmi-0.99/server/CVCMIServer.cpp
+--- vcmi-0.99/server/CVCMIServer.cpp.boost_compatibility 2016-11-01 19:26:09.000000000
+0100
++++ vcmi-0.99/server/CVCMIServer.cpp 2018-03-05 18:00:05.822295516 +0100
+@@ -165,8 +165,13 @@ void CPregameServer::run()
+
+ if(acceptor)
+ {
++#if BOOST_VERSION < 106600
+ acceptor->get_io_service().reset();
+ acceptor->get_io_service().poll();
++#else
++ acceptor->get_io_context().reset();
++ acceptor->get_io_context().poll();
++#endif
+ }
+ } //frees lock
+
+@@ -227,7 +232,11 @@ void CPregameServer::start_async_accept(
+ assert(!upcomingConnection);
+ assert(acceptor);
+
++#if BOOST_VERSION < 106600
+ upcomingConnection = new TSocket(acceptor->get_io_service());
++#else
++ upcomingConnection = new TSocket(acceptor->get_io_context());
++#endif
+ acceptor->async_accept(*upcomingConnection,
std::bind(&CPregameServer::connectionAccepted, this, _1));
+ }
+
+@@ -312,7 +321,12 @@ void CPregameServer::startListeningThrea
+ }
+
+ CVCMIServer::CVCMIServer()
+-: io(new boost::asio::io_service()), acceptor(new TAcceptor(*io,
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port))),
firstConnection(nullptr)
++#if BOOST_VERSION < 106600
++: io(new boost::asio::io_service()), acceptor(new TAcceptor(*io,
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port))),
++#else
++: io(new boost::asio::io_context()), acceptor(new TAcceptor(*io,
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port))),
++#endif
++ firstConnection(nullptr)
+ {
+ logNetwork->trace("CVCMIServer created!");
+ }
+@@ -412,7 +426,11 @@ void CVCMIServer::start()
+
+ boost::system::error_code error;
+ logNetwork->info("Listening for connections at port %d",
acceptor->local_endpoint().port());
++#if BOOST_VERSION < 106600
+ auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_service());
++#else
++ auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_context());
++#endif
+ boost::thread acc(std::bind(vaccept,acceptor,s,&error));
+ #ifndef VCMI_ANDROID
+ sr->setToTrueAndNotify();
+@@ -480,7 +498,11 @@ void CVCMIServer::loadGame()
+ }
+ else
+ {
++#if BOOST_VERSION < 106600
+ auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_service());
++#else
++ auto s = new boost::asio::ip::tcp::socket(acceptor->get_io_context());
++#endif
+ acceptor->accept(*s,error);
+ if(error) //retry
+ {
+@@ -593,7 +615,11 @@ int main(int argc, char** argv)
+ srand ( (ui32)time(nullptr) );
+ try
+ {
++#if BOOST_VERSION < 106600
+ boost::asio::io_service io_service;
++#else
++ boost::asio::io_context io_context;
++#endif
+ CVCMIServer server;
+
+ try
+@@ -602,7 +628,11 @@ int main(int argc, char** argv)
+ {
+ server.start();
+ }
++#if BOOST_VERSION < 106600
+ io_service.run();
++#else
++ io_context.run();
++#endif
+ }
+ catch(boost::system::system_error &e) //for boost errors just log, not crash -
probably client shut down connection
+ {
+diff -up vcmi-0.99/server/CVCMIServer.h.boost_compatibility
vcmi-0.99/server/CVCMIServer.h
+--- vcmi-0.99/server/CVCMIServer.h.boost_compatibility 2016-11-01 19:26:09.000000000
+0100
++++ vcmi-0.99/server/CVCMIServer.h 2018-03-05 17:55:15.294119498 +0100
+@@ -26,6 +26,7 @@ namespace boost
+ {
+ class tcp;
+ }
++#if BOOST_VERSION < 106600
+ class io_service;
+
+ template <typename Protocol> class stream_socket_service;
+@@ -35,15 +36,33 @@ namespace boost
+ template <typename Protocol> class socket_acceptor_service;
+ template <typename Protocol,typename SocketAcceptorService>
+ class basic_socket_acceptor;
++#else
++ class io_context;
++
++ template <typename Protocol>
++ class basic_stream_socket;
++
++ template <typename Protocol>
++ class basic_socket_acceptor;
++#endif
+ }
+ };
+
+-typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp,
boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
++#if BOOST_VERSION < 106600
+ typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp ,
boost::asio::stream_socket_service<boost::asio::ip::tcp> > TSocket;
++typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp,
boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
++#else
++typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp > TSocket;
++typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp > TAcceptor;
++#endif
+
+ class CVCMIServer
+ {
++#if BOOST_VERSION < 106600
+ boost::asio::io_service *io;
++#else
++ boost::asio::io_context *io;
++#endif
+ TAcceptor * acceptor;
+
+ CConnection *firstConnection;
+@@ -97,4 +116,4 @@ public:
+ void startListeningThread(CConnection * pc);
+ };
+
+-extern boost::program_options::variables_map cmdLineOptions;
++extern boost::program_options::variables_map cmdLineOptions;
diff --git a/vcmi-mods.patch b/vcmi-mods.patch
new file mode 100644
index 0000000..c11792b
--- /dev/null
+++ b/vcmi-mods.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4751f8d..bd17c0e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -241,6 +241,8 @@ if (NOT APPLE)
+ install(DIRECTORY config DESTINATION ${DATA_DIR} PATTERN ".svn" EXCLUDE)
+ # copy vcmi mod along with all its content
+ install(DIRECTORY Mods/vcmi DESTINATION ${DATA_DIR}/Mods PATTERN ".svn"
EXCLUDE)
++ install(DIRECTORY Mods/bonusIcons DESTINATION ${DATA_DIR}/Mods PATTERN ".svn"
EXCLUDE)
++ install(DIRECTORY Mods/extraResolutions DESTINATION ${DATA_DIR}/Mods PATTERN
".svn" EXCLUDE)
+
+ install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
+ OWNER_WRITE OWNER_READ OWNER_EXECUTE
diff --git a/vcmi.spec b/vcmi.spec
new file mode 100644
index 0000000..0277bac
--- /dev/null
+++ b/vcmi.spec
@@ -0,0 +1,136 @@
+Name: vcmi
+Summary: Heroes of Might and Magic 3 game engine
+Version: 0.99
+Release: 2%{?dist}
+License: GPLv2+
+URL:
https://vcmi.eu/
+
+Source:
https://github.com/%{name}/%{name}/archive/%{version}/%{name}-%{version}....
+
+# Absolutely disgusting and untested patch for compatibility with Boost 1.66
+# Courtesy of Robert-André Mauchin during the review
+# Sent upstream via
https://github.com/vcmi/vcmi/pull/285#issuecomment-370504722
+Patch1: %{name}-boost-1.66.patch
+
+# Enable extra resolutions
+#
https://forum.vcmi.eu/t/where-is-the-mod-for-resolutions-other-than-800x6...
+#
https://www.dropbox.com/sh/fwor43x5xrgzx6q/AABpTFqGK7Q9almbyr3hp9jma/mods... (not
directly downloadable)
+Source2: %{name}.zip
+Patch2: %{name}-mods.patch
+
+BuildRequires: %{_bindir}/desktop-file-validate
+BuildRequires: %{_bindir}/dos2unix
+BuildRequires: cmake
+BuildRequires: gcc-c++ >= 4.7.2
+BuildRequires: SDL2-devel
+BuildRequires: SDL2_image-devel
+BuildRequires: SDL2_ttf-devel
+BuildRequires: SDL2_mixer-devel
+BuildRequires: boost >= 1.51
+BuildRequires: boost-devel >= 1.51
+BuildRequires: boost-filesystem >= 1.51
+BuildRequires: boost-iostreams >= 1.51
+BuildRequires: boost-system >= 1.51
+BuildRequires: boost-thread >= 1.51
+BuildRequires: boost-program-options >= 1.51
+BuildRequires: boost-locale >= 1.51
+BuildRequires: zlib-devel
+BuildRequires: ffmpeg-devel
+BuildRequires: ffmpeg-libs
+BuildRequires: qt5-qtbase-devel
+
+Requires: hicolor-icon-theme
+Requires: %{name}-data = %{version}-%{release}
+
+
+%description
+The purpose of VCMI project is to rewrite entire Heroes 3.5: WoG engine from
+scratch, giving it new and extended possibilities. It will help to support
+mods and new towns already made by fans but abandoned because of game code
+limitations.
+
+In its current state it already supports maps of any sizes, higher
+resolutions and extended engine limits.
+
+
+%package data
+Summary: Data files for %{name}
+BuildArch: noarch
+Requires: %{name} = %{version}-%{release}
+
+%description data
+Data files for the VCMI project, a %{summary}.
+
+
+%prep
+%setup -q -a2
+
+%patch1 -p1
+
+# mods from Source2:
+mv vcmi/Mods/* Mods && rm -rf vcmi
+%patch2 -p1
+
+dos2unix README.md README.linux license.txt AUTHORS ChangeLog
+
+
+%build
+%cmake -DENABLE_TEST=0 -UCMAKE_INSTALL_LIBDIR
+
+%ifarch %{ix86} x86_64
+%make_build
+%else
+# not enough memory in Koji for parallel build
+make
+%endif
+
+
+%install
+%make_install
+
+
+%check
+desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
+
+
+%ldconfig_scriptlets
+
+
+%files
+%doc README.md README.linux AUTHORS ChangeLog
+%license license.txt
+%{_bindir}/vcmiclient
+%{_bindir}/vcmiserver
+%{_bindir}/vcmibuilder
+%{_bindir}/vcmilauncher
+%{_libdir}/%{name}/
+
+# keep this in the main package, because GNOME Software etc.
+%{_datadir}/applications/*.desktop
+%{_datadir}/icons/hicolor/*/apps/vcmiclient.png
+
+# don't need devel and static packages until requested
+%exclude %{_includedir}/fl
+%exclude %{_libdir}/*.a
+
+
+%files data
+%{_datadir}/%{name}/
+
+
+
+%changelog
+* Sun Mar 04 2018 Miro Hrončok <mhroncok(a)redhat.com> - 0.99-2
+- Add mods for extra resolutions
+- Add %%check with desktop file checking
+- Require hicolor-icon-theme and don't own the hicolor dirs
+- Fix dos line ends
+- Change description and summary
+- Use cmake and make macros
+- Exclude files instead of not terminating build on unpackaged files
+- Add Patch1 for Boost 1.66 compatibility
+- Split noarch data into a subpackage
+- Own /usr/share/vcmi/ and /usr/lib64/vcmi/
+
+* Tue Nov 01 2016 VCMI - 0.99-1
+- New upstream release