summaryrefslogtreecommitdiff
path: root/packaging/cmake.spec
blob: e236706033fff9f0eda331cc9c75ef21b0fa7d87 (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
Name:           cmake
Version:        3.25.2
Release:        0
License:        BSD-3-Clause
Summary:        Cross-platform make system
Url:            http://www.cmake.org
Group:          Platfrom Development/Tools
Source0:        %{name}-%{version}.tar.gz
Source1:        macros.cmake
Source2:        TizenCommon.cmake
Source1001:     cmake.manifest

BuildRequires:  fdupes
BuildRequires:  pkgconfig(ncurses)
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(libarchive)
BuildRequires:  pkgconfig(openssl3)

%description
CMake is used to control the software compilation process using simple platform
and compiler independent configuration files. CMake generates native makefiles
and workspaces that can be used in the compiler environment of your choice.
CMake is quite sophisticated: it is possible to support complex environments
requiring system configuration, pre-processor generation, code generation, and
template instantiation.


%prep
%setup -q -n cmake-%{version}
cp %{SOURCE1001} .

%build
export CXXFLAGS="$RPM_OPT_FLAGS -fPIC -pie"
export CFLAGS="$CXXFLAGS"

# Set up default CMake configuration for ranlib, ar and nm, so we can build
# both CMake and target packages with LTO
insertconfline() {
    sed -e "/^' > .*InitialCacheFlags.cmake\"/i ${1}" -i bootstrap
}

insertconfline "set (CMAKE_RANLIB \"$(which %__ranlib)\" CACHE FILEPATH \"Path to ranlib tool.\" FORCE)"
insertconfline "set (CMAKE_AR \"$(which %__ar)\" CACHE FILEPATH \"Path to ar tool.\" FORCE)"
insertconfline "set (CMAKE_NM \"$(which %__nm)\" CACHE FILEPATH \"Path to nm tool.\" FORCE)"

./configure \
    --prefix=%{_prefix} \
    --datadir=/share/%{name} \
    --docdir=/share/doc/packages/%{name} \
    --mandir=/share/man \
    --system-libs \
    --parallel=0%jobs \
    --no-qt-gui \
    --no-system-curl \
    --no-system-librhash \
    --no-system-nghttp2 \
    --no-system-jsoncpp \
    --no-system-libuv
%__make VERBOSE=1 %{?_smp_mflags}

%install
%make_install
mkdir -p %{buildroot}%{_libdir}/%{name}
find %{buildroot}%{_datadir}/%{name} -type f -print0 | xargs -0 chmod 644
cp %{SOURCE2} %{buildroot}%{_datadir}/%{name}/Modules

# Install cmake rpm macros
install -D -p -m 0644 %{S:1} \
  %{buildroot}%{_sysconfdir}/rpm/macros.cmake

fdupes %{buildroot}%{_datadir}/%{name}

rm -rf %{buildroot}%{_datadir}/bash-completion
rm -rf %{buildroot}%{_datadir}/emacs
rm -rf %{buildroot}%{_datadir}/vim
%docs_package

%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/rpm/macros.cmake
%doc %{_datadir}/doc/packages/%{name}
%{_datadir}/aclocal/cmake.m4
%{_bindir}/cmake
%{_bindir}/ccmake
%{_bindir}/cpack
%{_bindir}/ctest
%{_datadir}/%{name}