File mapnik.spec of Package mapnik

# spec file for package mapnik
# Copyright (c) 2020 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           mapnik
%define sover    3
%define sominver 1
Version:        %{sover}.%{sominver}.0
Release:        0
Summary:        C++ toolkit for developing GIS applications
License:        LGPL-2.1-or-later
Group:          Productivity/Graphics/Other
Source2:        %{name}_fonts.cpp
BuildRequires:  cairomm-devel
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  giflib-devel
BuildRequires:  glibc-devel
BuildRequires:  harfbuzz-devel >= 0.9.34
BuildRequires:  libboost_filesystem-devel >= 1.47
BuildRequires:  libboost_program_options-devel >= 1.47
BuildRequires:  libboost_regex-devel >= 1.47
BuildRequires:  libboost_system-devel >= 1.47
BuildRequires:  libgdal-devel
BuildRequires:  libicu-devel >= 4.2
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libpqxx-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  libwebp-devel
BuildRequires:  libxml2-devel
BuildRequires:  openmpi-devel
BuildRequires:  postgis
BuildRequires:  postgresql-devel
BuildRequires:  postgresql-server-devel
BuildRequires:  proj
BuildRequires:  proj-devel
BuildRequires:  python-cairo-devel
BuildRequires:  python-devel
BuildRequires:  scons
BuildRequires:  sqlite-devel
Requires:       proj
# for the upgrade script
Requires:       python-xml
Recommends:     python-lxml

%define libname lib%{name}%{sover}_%{sominver}

Mapnik is a Free Toolkit for developing mapping applications. It's written in
C++. It can comfortably be used for both desktop and web development.

Essentially a collection of geographic objects (map, layer, datasource,
feature, geometry), the library doesn't rely on "windowing systems" and
can be deployed in any server environment. It is intended to play fair in a
multi-threaded environment and is aimed primarily, but not exclusively, at
web-based development.

%package -n %{libname}
Summary:        Link library for %{name}
Group:          System/Libraries

%description -n %{libname}
Link libraries for the mapnik software.

%package devel
Summary:        Development Libraries for the mapnik library
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}
Requires:       boost-devel >= 1.47
Requires:       cairomm-devel
Requires:       harfbuzz-devel
Requires:       libicu-devel >= 4.2
Requires:       libjpeg-devel
Requires:       libtiff-devel
Requires:       libtool
Requires:       libwebp-devel
Requires:       libxml2-devel
Requires:       proj-devel

%description devel
mapnik development libraries for developing mapping applications.

%package notofonts
Summary:        Noto fonts for mapnik
Group:          Productivity/Graphics/Other
Requires:       mapnik
Requires:       noto-emojiregular-fonts
Requires:       noto-naskharabic-ui-fonts
Requires:       noto-sans-adlam-fonts
Requires:       noto-sans-adlamunjoined-fonts
Requires:       noto-sans-arabic-ui-fonts
Requires:       noto-sans-armenian-fonts
Requires:       noto-sans-balinese-fonts
Requires:       noto-sans-bamum-fonts
Requires:       noto-sans-batak-fonts
Requires:       noto-sans-bengali-ui-fonts
Requires:       noto-sans-buginese-fonts
Requires:       noto-sans-buhid-fonts
Requires:       noto-sans-canadianaboriginal-fonts
Requires:       noto-sans-chakma-fonts
Requires:       noto-sans-cham-fonts
Requires:       noto-sans-cherokee-fonts
Requires:       noto-sans-cjk-fonts
Requires:       noto-sans-coptic-fonts
Requires:       noto-sans-devanagari-fonts
Requires:       noto-sans-devanagari-ui-fonts
Requires:       noto-sans-ethiopic-fonts
Requires:       noto-sans-fonts
Requires:       noto-sans-georgian-fonts
Requires:       noto-sans-gujarati-ui-fonts
Requires:       noto-sans-gurmukhi-ui-fonts
Requires:       noto-sans-hanunoo-fonts
Requires:       noto-sans-hebrew-fonts
Requires:       noto-sans-javanese-fonts
Requires:       noto-sans-kannada-ui-fonts
Requires:       noto-sans-kayahli-fonts
Requires:       noto-sans-khmer-ui-fonts
Requires:       noto-sans-lao-ui-fonts
Requires:       noto-sans-lepcha-fonts
Requires:       noto-sans-limbu-fonts
Requires:       noto-sans-lisu-fonts
Requires:       noto-sans-malayalam-ui-fonts
Requires:       noto-sans-mandaic-fonts
Requires:       noto-sans-mongolian-fonts
Requires:       noto-sans-myanmar-ui-fonts
Requires:       noto-sans-newtailue-fonts
Requires:       noto-sans-nko-fonts
Requires:       noto-sans-olchiki-fonts
Requires:       noto-sans-oriya-ui-fonts
Requires:       noto-sans-osage-fonts
Requires:       noto-sans-osmanya-fonts
Requires:       noto-sans-samaritan-fonts
Requires:       noto-sans-saurashtra-fonts
Requires:       noto-sans-shavian-fonts
Requires:       noto-sans-sinhala-fonts
Requires:       noto-sans-sinhala-ui-fonts
Requires:       noto-sans-sundanese-fonts
Requires:       noto-sans-symbols-fonts
Requires:       noto-sans-symbols2-fonts
Requires:       noto-sans-syriaceastern-fonts
Requires:       noto-sans-syriacestrangela-fonts
Requires:       noto-sans-syriacwestern-fonts
Requires:       noto-sans-tagalog-fonts
Requires:       noto-sans-tagbanwa-fonts
Requires:       noto-sans-taile-fonts
Requires:       noto-sans-taitham-fonts
Requires:       noto-sans-taiviet-fonts
Requires:       noto-sans-tamil-ui-fonts
Requires:       noto-sans-telugu-ui-fonts
Requires:       noto-sans-thaana-fonts
Requires:       noto-sans-thai-ui-fonts
Requires:       noto-sans-tibetan-fonts
Requires:       noto-sans-tifinagh-fonts
Requires:       noto-sans-vai-fonts
Requires:       noto-sans-yi-fonts

%description notofonts
Make noto fonts available to mapnik. Contains all the fonts required by main OSM
rendering styles.

Requires M17N:fonts repository for the UI font variants.

Activate with
zypper ar -f M17N:fonts

%post   -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%setup -q -n %{name}-v%{version}


CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" \
%ifarch x86_64 ppc64le ppc64 aarch64 s390x
%define lds lib64
%define lds lib
python scons/ %{?_smp_mflags} PREFIX=%{_prefix} PGSQL_INCLUDES=%{_includedir}/pgsql LIBDIR_SCHEMA=%{lds} SVG2PNG=true XMLPARSER=libxml2 CUSTOM_DEFINES="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"

g++ %{optflags} -s %{SOURCE2} -Wall -o%{name}_fonts -Iinclude -Lsrc -lmapnik "-DMAPNIK_FONTS=\"%{_libdir}/%{name}/fonts/\""

python scons/  %{?_smp_mflags} PREFIX=%{_prefix} PGSQL_INCLUDES=%{_includedir}/pgsql DESTDIR=%{buildroot} LIBDIR_SCHEMA=%{lds} install
chmod -x %{buildroot}/%{_includedir}/%{name}/agg/*.h

# Fix wrong shebang
sed -i "s,#!/usr/bin/env bash,#!/bin/bash,g" %{buildroot}%{_bindir}/mapnik-config

install %{name}_fonts %{buildroot}%{_bindir}

%post notofonts
ln -sf %{_datadir}/fonts/truetype/Noto* %{_libdir}/%{name}/fonts/

%postun notofonts
if [ $1 = 0 ] ; then
  rm %{_libdir}/%{name}/fonts/Noto*

%license COPYING

%files devel
%exclude %{_libdir}/lib%{name}*.a

%files notofonts

%files -n %{libname}

openSUSE Build Service is sponsored by