summaryrefslogtreecommitdiffstats
path: root/cygwin-clang.spec
blob: 0d1d8e70feb8e5104a6b9e7dd8ff103cc89c6969 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%global cygwin_gcc_version 4.9.3

Name:      cygwin-clang
Version:   3.5.2
Release:   4%{?dist}
Summary:   Clang compiler for Cygwin toolchain

Group:     Development/Languages
License:   NCSA
URL:       http://clang.llvm.org

Source0:   http://www.llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz
Source1:   http://www.llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz
Patch0:    llvm-3.5.0-gcc49.patch
Patch1:    llvm-3.5.0-gcc5.patch

Patch101:  clang-3.5.1-cygwin-includes.patch
Patch102:  clang-3.5.1-cygwin64.patch
Patch103:  clang-3.5.1-cygwin-cxa-atexit.patch

BuildRequires: cygwin32-filesystem
BuildRequires: cygwin64-filesystem
BuildRequires: gcc-c++
BuildRequires: libffi-devel
BuildRequires: ncurses-devel
BuildRequires: perl
%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires: perl-podlators
%endif
BuildRequires: python

%description
Clang C/C++/ObjC compiler for the Cygwin toolchains

%package -n cygwin32-clang
Summary:    Clang compiler for Cygwin32 toolchain
Group:      Development/Languages
Obsoletes:  %{name} < %{version}-%{release}
Provides:   %{name} = %{version}-%{release}
Requires:   cygwin32-binutils
Requires:   cygwin32-gcc = %{cygwin_gcc_version}
Requires:   cygwin32-gcc-c++ = %{cygwin_gcc_version}

%description -n cygwin32-clang
%{description}

%package -n cygwin64-clang
Summary:    Clang compiler for Cygwin64 toolchain
Group:      Development/Languages
Requires:   cygwin64-binutils
Requires:   cygwin64-gcc = %{cygwin_gcc_version}
Requires:   cygwin64-gcc-c++ = %{cygwin_gcc_version}

%description -n cygwin64-clang
%{description}


%prep
%setup -q -T -b 0 -a 1 -n llvm-%{version}.src
mv cfe-%{version}.src tools/clang
%patch0 -p1
%patch1 -p4
%patch101 -p2
%patch102 -p2
%patch103 -p2


%build
mkdir -p target_cyg32 target_cyg64
%define _configure ../configure

pushd target_cyg32
%{configure} --target=%{cygwin32_target} --enable-targets=host,cpp \
    --disable-assertions --enable-optimized --enable-debug-runtime \
    --enable-debug-symbols --enable-libffi \
    --disable-embed-stdcxx --disable-bindings --disable-shared \
    --with-gcc-toolchain=/usr --with-default-sysroot=%{cygwin32_sysroot} \
    --with-c-include-dirs=%{_prefix}/lib/gcc/%{cygwin32_target}/%{cygwin_gcc_version}/include:%{cygwin32_includedir}:%{cygwin32_includedir}/w32api \
    --with-clang-resource-dir=../lib/clang/%{cygwin32_target}/%{version}

make %{?_smp_mflags} clang-only REQUIRES_RTTI=1
make -C tools/clang/docs/tools man
popd

pushd target_cyg64
%{configure} --target=%{cygwin64_target} --enable-targets=host,cpp \
    --disable-assertions --enable-optimized --enable-debug-runtime \
    --enable-debug-symbols --enable-libffi \
    --disable-embed-stdcxx --disable-bindings --disable-shared \
    --with-gcc-toolchain=/usr --with-default-sysroot=%{cygwin64_sysroot} \
    --with-c-include-dirs=%{_prefix}/lib/gcc/%{cygwin64_target}/%{cygwin_gcc_version}/include:%{cygwin64_includedir}:%{cygwin64_includedir}/w32api \
    --with-clang-resource-dir=../lib/clang/%{cygwin64_target}/%{version}

make %{?_smp_mflags} clang-only REQUIRES_RTTI=1
make -C tools/clang/docs/tools man
popd


%install
pushd target_cyg32
make install -C tools/clang/lib/Headers \
    PROJ_headers=$RPM_BUILD_ROOT%{_prefix}/lib/clang/%{cygwin32_target}/%{version}/include

install -D -m0755 Release+Debug/bin/clang $RPM_BUILD_ROOT%{_bindir}/%{cygwin32_target}-clang
ln -s %{cygwin32_target}-clang $RPM_BUILD_ROOT%{_bindir}/%{cygwin32_target}-clang++
install -D -m0644 tools/clang/docs/tools/clang.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{cygwin32_target}-clang.1
popd

pushd target_cyg64
make install -C tools/clang/lib/Headers \
    PROJ_headers=$RPM_BUILD_ROOT%{_prefix}/lib/clang/%{cygwin64_target}/%{version}/include

install -D -m0755 Release+Debug/bin/clang $RPM_BUILD_ROOT%{_bindir}/%{cygwin64_target}-clang
ln -s %{cygwin64_target}-clang $RPM_BUILD_ROOT%{_bindir}/%{cygwin64_target}-clang++
install -D -m0644 tools/clang/docs/tools/clang.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{cygwin64_target}-clang.1
popd


%files -n cygwin32-clang
%doc LICENSE.TXT README.txt
%{_bindir}/%{cygwin32_target}-clang
%{_bindir}/%{cygwin32_target}-clang++
%{_prefix}/lib/clang/%{cygwin32_target}/
%{_mandir}/man1/%{cygwin32_target}-clang.*

%files -n cygwin64-clang
%doc LICENSE.TXT README.txt
%{_bindir}/%{cygwin64_target}-clang
%{_bindir}/%{cygwin64_target}-clang++
%{_prefix}/lib/clang/%{cygwin64_target}/
%{_mandir}/man1/%{cygwin64_target}-clang.*


%changelog
* Fri Aug 14 2015 Yaakov Selkowitz <yselkowi@redhat.com> - 3.5.2-4
- rebuilt for cygwin-gcc 4.9.3

* Mon Jun 22 2015 Yaakov Selkowitz <yselkowi@redhat.com> - 3.5.2-3
- Fix BRs on EL6

* Fri Jun 19 2015 Yaakov Selkowitz <yselkowi@redhat.com> - 3.5.2-2
- Fix FTBFS on GCC 5

* Fri Jun 19 2015 Yaakov Selkowitz <yselkowi@redhat.com> - 3.5.2-1
- new version, build for cygwin-gcc 4.9.2

* Sun Nov 02 2014 Yaakov Selkowitz <yselkowi@redhat.com> - 3.4.2-2
- Enabled -fuse-cxa-atexit flag by default

* Wed Jul 30 2014 Yaakov Selkowitz <yselkowitz@cygwin.com> - 3.4.2-1
- Version bump
- Add cygwin64 compiler
- Cleanup spec

* Mon Jan 14 2013 Yaakov Selkowitz <cygwin-ports-general@lists.sourceforge.net> - 3.1-2
- Add patches for compatibility with w32api headers and libtool.

* Fri Jul 13 2012 Yaakov Selkowitz <cygwin-ports-general@lists.sourceforge.net> - 3.1-1
- Version bump.
- Add patch to support dllexport/dllimport attributes.

* Sun Feb 05 2012 Yaakov Selkowitz <cygwin-ports-general@lists.sourceforge.net> - 3.0-1
- Initial RPM release.