diff --git a/.gitignore b/.gitignore index e69de29..09b85fa 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/minetestmapper-20161218.tar.gz diff --git a/07c371f68ccc10337fbdd60477bc621bf7cd2a7e.patch b/07c371f68ccc10337fbdd60477bc621bf7cd2a7e.patch new file mode 100644 index 0000000..22d8e3c --- /dev/null +++ b/07c371f68ccc10337fbdd60477bc621bf7cd2a7e.patch @@ -0,0 +1,134 @@ +From 07c371f68ccc10337fbdd60477bc621bf7cd2a7e Mon Sep 17 00:00:00 2001 +From: Daniel Moerner +Date: Tue, 17 Jan 2017 11:49:15 -0500 +Subject: [PATCH] Write manpage based on README. + +--- + CMakeLists.txt | 6 +++- + minetestmapper.6 | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 96 insertions(+), 1 deletion(-) + create mode 100644 minetestmapper.6 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 255c82f..4b54d64 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -21,9 +21,10 @@ if(WIN32) + set(BINDIR ".") + set(DOCDIR ".") + else() +- set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/minetest") # an extra dir. for just one file doesn't seem useful ++ set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/minetest") # reuse Minetest share dir + set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin") + set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") ++ set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") + endif() + + set(CUSTOM_SHAREDIR "" CACHE STRING "Directory to install data files into") +@@ -215,6 +216,9 @@ install(FILES "AUTHORS" DESTINATION "${DOCDIR}") + install(FILES "COPYING" DESTINATION "${DOCDIR}") + install(FILES "README.rst" DESTINATION "${DOCDIR}") + install(FILES "colors.txt" DESTINATION "${SHAREDIR}") ++if(UNIX) ++ install(FILES "minetestmapper.6" DESTINATION "${MANDIR}/man6") ++endif() + + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Overview mapper for Minetest") + set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) +diff --git a/minetestmapper.6 b/minetestmapper.6 +new file mode 100644 +index 0000000..5cdd6d9 +--- /dev/null ++++ b/minetestmapper.6 +@@ -0,0 +1,91 @@ ++.TH MINETESTMAPPER 6 ++.SH NAME ++minetestmapper \- generate an overview image of a Minetest map ++.SH SYNOPSIS ++.B minetestmapper ++\fB\-i\fR \fIworld_path\fR ++\fB\-o\fR \fIoutput_image\fR ++.PP ++See additional optional parameters below. ++.SH DESCRIPTION ++.B minetestmapper ++generates an overview image of a minetest map. This is a port of ++the original minetestmapper.py to C++, that is both faster and ++provides more funtionality than the deprecated Python script. ++.SH MANDATORY PARAMETERS ++.TP ++.BR \-i " " \fIworld_path\fR ++Input world path. ++.TP ++.BR \-o " " \fIoutput_image\fR ++Path to output image. (only PNG supported currently) ++.SH OPTIONAL PARAMETERS ++.TP ++.BR \-\-bgcolor " " \fIcolor\fR ++Background color of image, e.g. "--bgcolor #ffffff" ++ ++.TP ++.BR \-\-scalecolor " " \fIcolor\fR ++Color of scale, e.g. "--scalecolor #000000" ++ ++.TP ++.BR \-\-playercolor " " \fIcolor\fR ++Color of player indicators, e.g. "--playercolor #ff0000" ++ ++.TP ++.BR \-\-origincolor " " \fIcolor\fR ++Color of origin indicator, e.g. "--origincolor #ff0000" ++ ++.TP ++.BR \-\-drawscale ++Draw tick marks ++ ++.TP ++.BR \-\-drawplayers ++Draw player indicators ++ ++.TP ++.BR \-\-draworigin ++Draw origin indicator ++ ++.TP ++.BR \-\-drawalpha ++Allow nodes to be drawn with transparency ++ ++.TP ++.BR \-\-noshading ++Don't draw shading on nodes ++ ++.TP ++.BR \-\-min-y " " \fInumber\fR ++Don't draw nodes below this y value, e.g. "--min-y -25" ++ ++.TP ++.BR \-\-max-y " " \fInumber\fR ++Don't draw nodes above this y value, e.g. "--max-y 75" ++ ++.TP ++.BR \-\-backend " " \fIbackend\fR ++Use specific map backend; supported: *sqlite3*, *leveldb*, *redis*, *postgresql*, e.g. "--backend leveldb" ++ ++.TP ++.BR \-\-geometry " " \fIgeometry\fR ++Limit area to specific geometry (*x:y+w+h* where x and y specify the lower left corner), e.g. "--geometry -800:-800+1600+1600" ++ ++.TP ++.BR \-\-zoom " " \fIfactor\fR ++Zoom the image by using more than one pixel per node, e.g. "--zoom 4" ++ ++.TP ++.BR \-\-colors " " \fIpath\fR ++Forcefully set path to colors.txt file (it's autodetected otherwise), e.g. "--colors ../minetest/mycolors.txt" ++ ++.TP ++.BR \-\-scales " " \fIedges\fR ++Draw scales on specified image edges (letters *t b l r* meaning top, bottom, left and right), e.g. "--scales tbr" ++ ++.SH MORE INFORMATION ++Website: https://github.com/minetest/minetestmapper ++ ++.SH MAN PAGE AUTHOR ++Daniel Moerner diff --git a/d490cf0a31b1a64c604082b814cc2c3588a73a08.patch b/d490cf0a31b1a64c604082b814cc2c3588a73a08.patch new file mode 100644 index 0000000..abd5a7a --- /dev/null +++ b/d490cf0a31b1a64c604082b814cc2c3588a73a08.patch @@ -0,0 +1,37 @@ +From d490cf0a31b1a64c604082b814cc2c3588a73a08 Mon Sep 17 00:00:00 2001 +From: sfan5 +Date: Thu, 5 Jan 2017 23:37:21 +0100 +Subject: [PATCH] Fix drawing of transparent nodes without --drawalpha (fixes + #41) + +--- + Image.h | 2 ++ + TileGenerator.cpp | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Image.h b/Image.h +index ae21ce8..1b5a6ba 100644 +--- a/Image.h ++++ b/Image.h +@@ -9,6 +9,8 @@ struct Color { + Color() : r(0), g(0), b(0), a(0) {}; + Color(u8 r, u8 g, u8 b) : r(r), g(g), b(b), a(255) {}; + Color(u8 r, u8 g, u8 b, u8 a) : r(r), g(g), b(b), a(a) {}; ++ inline Color noAlpha() const { return Color(r, g, b); } ++ + u8 r, g, b, a; + }; + +diff --git a/TileGenerator.cpp b/TileGenerator.cpp +index 0416af0..f5d9574 100644 +--- a/TileGenerator.cpp ++++ b/TileGenerator.cpp +@@ -526,7 +526,7 @@ void TileGenerator::renderMapBlock(const ustring &mapBlock, const BlockPos &pos, + continue; + } + } else { +- setZoomed(imageX, imageY, c); ++ setZoomed(imageX, imageY, c.noAlpha()); + m_readPixels[z] |= (1 << x); + } + if(!(m_readInfo[z] & (1 << x))) { diff --git a/minetestmapper.spec b/minetestmapper.spec new file mode 100644 index 0000000..dc3a206 --- /dev/null +++ b/minetestmapper.spec @@ -0,0 +1,63 @@ +Name: minetestmapper +Version: 20161218 +Release: 2%{?dist} +Summary: Generates a overview image of a minetest map + +License: BSD +URL: https://github.com/minetest/minetestmapper +Source0: https://github.com/minetest/minetestmapper/archive/%{version}/minetestmapper-%{version}.tar.gz + +# Patch merged upstream to fix issue with water being transparent. +# https://github.com/minetest/minetestmapper/commit/d490cf0a31b1a64c604082b814cc2c3588a73a08.patch +Patch0: d490cf0a31b1a64c604082b814cc2c3588a73a08.patch + +# Patch sent upstream by dmoerner to install man page. +# https://github.com/minetest/minetestmapper/commit/07c371f68ccc10337fbdd60477bc621bf7cd2a7e.patch +Patch1: 07c371f68ccc10337fbdd60477bc621bf7cd2a7e.patch + +BuildRequires: gcc-c++, cmake, sqlite-devel, gd-devel, leveldb-devel, hiredis-devel + +# Needs minetest for ownership of /usr/share/minetest if nothing else. +Requires: minetest + +%description +Generates a overview image of a minetest map. This is a port of +minetestmapper.py to C++, that is both faster and provides more +details than the deprecated Python script. + +%prep +%autosetup -p1 + +# Remove reference to postgresql in manpage as per dmoerner's comments: +# (https://bugzilla.redhat.com/show_bug.cgi?id=1410651#c1) +# Postgresql backend was added upstream after the release of 20161218. +sed -i 's/\*postgresql\*, //' minetestmapper.6 +%build +%cmake -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 +%make_build + +%install +%make_install + +# Install colors.txt into /usr/share/minetest. +mkdir -p %{buildroot}%{_datadir}/minetest +cp -a colors.txt %{buildroot}%{_datadir}/minetest/ + +# Remove copy of license from docdir. +rm -rf %{buildroot}%{_pkgdocdir}/COPYING + +%files +%{_bindir}/minetestmapper +%{_datadir}/minetest/colors.txt +%{_mandir}/man6/minetestmapper.6* +%license COPYING +%doc AUTHORS README.rst + +%changelog +* Fri Jan 20 2017 Ben Rosser - 20161218-2 +- Add man page for minetestmapper written by dmoerner. +- Reference patches without using a URL. +- Use version macro in Source0 URL. + +* Fri Jan 6 2017 Ben Rosser - 20161218-1 +- Initial package for Fedora. diff --git a/sources b/sources index e69de29..eefe715 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (minetestmapper-20161218.tar.gz) = b8d74d21ff7edf0b1b258fe4d1de602024b2e8ed0cc5bbec131b0475702f1df1de099cb1a44de67a5d554d3a27ffe6863134deb178a9b9cf5bc9588f32a01d29