summaryrefslogtreecommitdiffstats
path: root/dlib.spec
blob: 69f7e2d2984d24d8eda66260a939363b07fb415c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# remirepo/fedora spec file for dlib
#
# Copyright (c) 2020 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%global gh_commit   5612caa16937b5b81eb2dba17c20e303537a6a9d
%global gh_short    %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner    davisking
%global gh_project  dlib
%global libname     lib%{gh_project}
%global soname      19

Name:          %{gh_project}
Summary:       A toolkit for making real world machine learning and data analysis
Version:       19.20
Release:       2%{?dist}
License:       Boost

URL:           https://github.com/%{gh_owner}/%{gh_project}/
Source0:       https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz

# only really needed libraries, not using full path
Patch0:        %{gh_project}-pc.patch

%if 0%{?rhel} == 6 || 0%{?rhel} == 7
BuildRequires: cmake3
%if 0%{?rhel} == 7
%global dtsenable source /opt/rh/devtoolset-7/enable
BuildRequires: devtoolset-7-toolchain
%else
%global dtsenable source /opt/rh/devtoolset-7/enable
BuildRequires: devtoolset-6-toolchain
%endif
%else
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
%endif
BuildRequires: openblas-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: libjpeg-turbo-devel
BuildRequires: giflib-devel
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
BuildRequires: libX11-devel
BuildRequires: libXext-devel


%description
Dlib is a modern C++ toolkit containing machine learning algorithms and tools
for creating complex software in C++ to solve real world problems.

See http://dlib.net for the main project documentation and API reference.


%package devel
Summary:    Header files and development libraries for %{name}
Group:      Development/Libraries
Requires:   %{name}%{?_isa} = %{version}-%{release}
Requires:   giflib-devel

%description devel

This package contains the header files and development libraries
for %{libname}.


%prep
%setup -q -n %{gh_project}-%{gh_commit}
%patch0 -p1 -b .fixpc


%build
mkdir build
cd build

%if 0%{?rhel} == 6 || 0%{?rhel} == 7
%{dtsenable}

%cmake3 \
%else
%cmake \
%endif
  ..

make %{_smp_mflags}

# see https://github.com/davisking/dlib/issues/2111
sed -E '/private/s:%{_libdir}/lib([^ ]*).so:-l\1:g' \
    -i dlib/dlib-1.pc


%install
cd build

%if 0%{?rhel} == 6 || 0%{?rhel} == 7
%{dtsenable}
%endif

make install DESTDIR="%{buildroot}"


%if 0%{?fedora} < 28 && 0%{?rhel} < 8
%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif


%files
%{!?_licensedir:%global license %%doc}
%license dlib/LICENSE.txt
%{_libdir}/%{libname}.so.%{soname}*

%files devel
%doc README.md
%{_libdir}/%{libname}.so
%{_includedir}/%{name}
%{_libdir}/cmake/%{name}
%{_libdir}/pkgconfig/%{name}-1.pc


%changelog
* Wed Jul  1 2020 Remi Collet <remi@remirepo.net> - 19.20-2
- use DTS 7 on EL-7
- improve pkg-config fix

* Mon Jun 22 2020 Remi Collet <remi@remirepo.net> - 19.20-1
- initial package
- open https://github.com/davisking/dlib/issues/2111 broken pkg-config file