summaryrefslogtreecommitdiff
path: root/packaging/coreclr.spec
blob: 93ba2769b92122e36e0c5d5f536b66cd0266b088 (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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
%{!?dotnet_buildtype: %define dotnet_buildtype Release}

%define skipnative 0
%define skipmscorlib 0

%define pgo_instrument 0
%define pgo_optimize 1

%ifarch %{ix86}
%define dotnet_buildtype Release
%endif

%define dotnet_version  3.0.0

Name:		coreclr
Version:	3.0.0
Release:	0
Summary:	Microsoft .NET Runtime, Coreclr
Group:		Development/Languages
License:	MIT
URL:		http://github.com/dotnet/coreclr
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest


ExcludeArch: aarch64

BuildRequires:  python
BuildRequires:  python-xml
# libcoreclr.so
BuildRequires:  pkgconfig(libunwind)
BuildRequires:  pkgconfig(uuid)
# System.Globalization.Native.so
BuildRequires:  libicu-devel
BuildRequires:  tizen-release
# No matter what tizen-release package you use in any profile
AutoReq: 0
Requires: glibc
Requires: libgcc
Requires: libstdc++
Requires: libunwind
Requires: libuuid

# Accelerate python, clang
%ifarch %{arm}
BuildRequires: python-accel-armv7l-cross-arm
BuildRequires: clang-accel-armv7l-cross-arm
%endif

%ifarch aarch64
BuildRequires: python-accel-aarch64-cross-aarch64
BuildRequires: clang-accel-aarch64-cross-aarch64
%endif

BuildRequires:  cmake
BuildRequires:  llvm >= 3.8
BuildRequires:  llvm-devel >= 3.8
BuildRequires:  clang >= 3.8
BuildRequires:  clang-devel >= 3.8
BuildRequires:  lldb >= 3.8
BuildRequires:  lldb-devel >= 3.8
BuildRequires:  gettext-tools
BuildRequires:  libopenssl1.1-devel
# C include headers
BuildRequires:  libstdc++-devel
BuildRequires:  pkgconfig(lttng-ust)

%if 0%{skipmscorlib}
%else
%ifarch %{arm}
BuildRequires:  patchelf
%endif
%ifarch %{ix86}
BuildRequires:  patchelf
BuildRequires:  glibc-64bit
BuildRequires:  libgcc-64bit
BuildRequires:  libstdc++-64bit
BuildRequires:  libunwind-64bit
BuildRequires:  libuuid-64bit
BuildRequires:  zlib-64bit
BuildRequires:  libopenssl11-64bit
%endif
%endif

%if 0%{pgo_instrument} || 0%{pgo_optimize}
BuildRequires:  binutils-gold
BuildRequires:  compiler-rt
%endif

%description
The CoreCLR repo contains the complete runtime implementation for .NET Core. It includes RyuJIT, the .NET GC, native interop and many other components. It is cross-platform, with multiple OS and CPU ports in progress.

%package test
Summary:    Dotnet Core Unit Test
Requires:    coreclr

%description test
Unit Test objs

%package devel
Summary:    Dotnet Core Development package
Requires:   coreclr

%description devel
Headers and static libraries

%package -n mscorlib
Summary:	Core Library for MS .NET
Requires:	coreclr

%description -n mscorlib
The MSCORLIB.DLL for .NET Core Runtime (coreclr)

%prep
%setup -q -n %{name}-%{version}
cp %{SOURCE1} .


%if 0%{skipmscorlib}
%else
%ifarch %{arm} %{ix86}
%ifarch %{arm}
# Detect interpreter name from cross-gcc
LD_INTERPRETER=$(patchelf --print-interpreter /emul/usr/bin/gcc)
LD_RPATH=$(patchelf --print-rpath /emul/usr/bin/gcc)
for file in $( find ./Tools ./.dotnet -name "dotnet" -type f)
do
    patchelf --set-interpreter ${LD_INTERPRETER} ${file}
    patchelf --set-rpath ${LD_RPATH}:%{_builddir}/%{name}-%{version}/libicu-57.1/ ${file}
done
for file in $( find ./Tools ./.dotnet ./libicu-57.1 -iname "*.so" -or -iname "*.so.*" )
do
    patchelf --set-rpath ${LD_RPATH}:%{_builddir}/%{name}-%{version}/libicu-57.1/ ${file}
done
%endif
%ifarch %{ix86}
for file in $( find ./Tools ./.dotnet ./libicu-57.1 -iname "*.so" -or -iname "*.so.*" )
do
    patchelf --set-rpath %{_builddir}/%{name}-%{version}/libicu-57.1/ ${file}
done
%endif
%endif
%endif

%build
# disable asan build when global forced asan build
%{?asan:
export ASAN_OPTIONS=use_sigaltstack=false:`cat /ASAN_OPTIONS`
/usr/bin/gcc-unforce-options
export LD_LIBRARY_PATH=`pwd`/libicu-57.1
export CPPFLAGS+=" -DHAS_ADDRESS_SANITIZER "
}

export CFLAGS=" --target=%{_host} "
export CXXFLAGS=" --target=%{_host} "

%ifarch x86_64
# Even though build architectur is x86_64, it will be running on arm board.
# So we need to pass the arch argument as arm.
%define _barch  %{?cross:%{cross}}%{!?cross:x64}
%else
%ifarch aarch64
%define _barch  arm64
%else
%ifarch %{ix86}
%define _barch  x86
export CLANG_NO_LIBDIR_SUFFIX=1
export CFLAGS=$(echo $CFLAGS | sed -e 's/--target=i686/--target=i586/')
export CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/--target=i686/--target=i586/')
%else
%ifarch %{arm}
%define _barch  armel
export CLANG_NO_LIBDIR_SUFFIX=1
%else

%endif
%endif
%endif
%endif

%define _buildtype  %{dotnet_buildtype}
%define _reldir     bin/Product/Linux.%{_barch}.%{_buildtype}
%define _numproc    %(getconf _NPROCESSORS_ONLN)

%ifarch %{arm}
%if %{dotnet_buildtype} == "Release"
export CXXFLAGS+="-fstack-protector-strong -D_FORTIFY_SOURCE=2"
%else
export CXXFLAGS+="-fstack-protector-strong"
%endif
%endif

%if 0%{skipnative}
%else
%if 0%{pgo_instrument}
%define _pgo_flags -pgoinstrument
%else
%if 0%{pgo_optimize}
# pgo optimization is enabled by default
%define _pgo_flags ""
%else
%define _pgo_flags -nopgooptimize
%endif
%endif
%endif

%ifarch %{arm}
%define _ngen_relocs_opts cmakeargs "-DFEATURE_NGEN_RELOCS_OPTIMIZATIONS=true"
%else
%define _ngen_relocs_opts ""
%endif

%if 0%{skipmscorlib}
%if 0%{skipnative}
# No build native and mscorlib.
%else
# Build native only.
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/
./build.sh -%{_barch} -%{_buildtype} -numproc %{_numproc} -skipmscorlib -skipgenerateversion -skipnuget -msbuildonunsupportedplatform -cmakeargs "-DFEATURE_PREJIT=true -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro" %{_pgo_flags} %{_ngen_relocs_opts}
%endif
%else
%if 0%{skipnative}
# Build mscorlib only.
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/
./build.sh -%{_barch} -%{_buildtype} -numproc %{_numproc} -skiprestore -skiprestoreoptdata -skipnative -skipnuget -skipcrossgen -msbuildonunsupportedplatform
%else
# Build native and mscorlib.
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/libicu-57.1/
./build.sh -%{_barch} -%{_buildtype} -numproc %{_numproc} -skipgenerateversion -skiprestore -skiprestoreoptdata -skipnuget -skipcrossgen -msbuildonunsupportedplatform -cmakeargs "-DFEATURE_IBCLOGGER=true -DFEATURE_PREJIT=true -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION=true -DCLR_ADDITIONAL_LINKER_FLAGS=-Wl,-z,relro" %{_pgo_flags} %{_ngen_relocs_opts}
%endif
%endif

%install
# .NET Core Runtime
%define dotnetdir       dotnet
%define netshareddir    %{dotnetdir}/shared
%define netcoreappdir   %{netshareddir}/Microsoft.NETCore.App/%{dotnet_version}
mkdir -p %{buildroot}%{_datadir}/%{netcoreappdir}

# .NET Tizen Runtime
%define dotnettizendir  dotnet.tizen
%define dotnetfwdir     %{dotnettizendir}/framework
%define dotnettestdir   %{dotnettizendir}/test
mkdir -p %{buildroot}%{_datadir}/%{dotnettizendir}
mkdir -p %{buildroot}%{_datadir}/%{dotnetfwdir}
mkdir -p %{buildroot}%{_datadir}/%{dotnettestdir}
ln -sf %{_datadir}/%{netcoreappdir} %{buildroot}%{_datadir}/%{dotnettizendir}/netcoreapp

# symlink to .NET version for compatibility
ln -sf %{dotnet_version} %{buildroot}%{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.0.0
ln -sf %{dotnet_version} %{buildroot}%{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.1.0
ln -sf %{dotnet_version} %{buildroot}%{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.1.1
ln -sf %{dotnet_version} %{buildroot}%{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.1.4

%if 0%{skipnative}
%else
cp %{_reldir}/corerun   %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libclrjit.so  %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libcoreclr.so %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libdbgshim.so %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libmscordaccore.so  %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libmscordbi.so  %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libcoreclrtraceptprovider.so %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/libdnetmemoryenum.so %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/System.Globalization.Native.so  %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/coreconsole %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/crossgen %{buildroot}%{_datadir}/%{netcoreappdir}

# .NET Core Headers and static libraries
mkdir -p %{buildroot}%{_datadir}/%{netcoreappdir}/src/pal/src/
mkdir -p %{buildroot}%{_datadir}/%{netcoreappdir}/src/debug/
mkdir -p %{buildroot}%{_datadir}/%{netcoreappdir}/src/dlls/
mkdir -p %{buildroot}%{_datadir}/%{netcoreappdir}/src/coreclr/hosts/
cp -rf src/inc                %{buildroot}%{_datadir}/%{netcoreappdir}/src/
cp -rf src/pal/inc            %{buildroot}%{_datadir}/%{netcoreappdir}/src/pal/
cp -rf src/pal/prebuilt       %{buildroot}%{_datadir}/%{netcoreappdir}/src/pal/
cp -rf src/debug/inc          %{buildroot}%{_datadir}/%{netcoreappdir}/src/debug/
cp -rf src/debug/shim         %{buildroot}%{_datadir}/%{netcoreappdir}/src/debug/
cp -rf src/dlls/dbgshim       %{buildroot}%{_datadir}/%{netcoreappdir}/src/dlls/
cp -rf src/coreclr/hosts/inc  %{buildroot}%{_datadir}/%{netcoreappdir}/src/coreclr/hosts/
cp -rf src/pal/src/include    %{buildroot}%{_datadir}/%{netcoreappdir}/src/pal/src
cp -rf %{_reldir}/lib         %{buildroot}%{_datadir}/%{netcoreappdir}

# extra
ln -sf %{_datadir}/%{netcoreappdir}/crossgen    %{buildroot}%{_datadir}/%{dotnetfwdir}/crossgen
ln -sf %{_datadir}/%{netcoreappdir}/coreconsole %{buildroot}%{_datadir}/%{dotnetfwdir}/coreconsole
ln -sf ../%{netcoreappdir}/corerun    %{buildroot}%{_datadir}/%{dotnetdir}/corerun

# devel
cp %{_reldir}/ilasm   %{buildroot}%{_datadir}/%{netcoreappdir}
cp %{_reldir}/ildasm  %{buildroot}%{_datadir}/%{netcoreappdir}

# test
cp -rf bin/obj/Linux.%{_barch}.%{_buildtype}/tests/src %{buildroot}%{_datadir}/%{dotnettestdir}
cp %{_reldir}/superpmi %{buildroot}%{_datadir}/%{dotnettestdir}
cp %{_reldir}/mcs %{buildroot}%{_datadir}/%{dotnettestdir}
cp %{_reldir}/libsuperpmi-shim-collector.so %{buildroot}%{_datadir}/%{dotnettestdir}
cp %{_reldir}/libsuperpmi-shim-counter.so %{buildroot}%{_datadir}/%{dotnettestdir}
cp %{_reldir}/libsuperpmi-shim-simple.so %{buildroot}%{_datadir}/%{dotnettestdir}
%endif

%if 0%{skipmscorlib}
%else
cp %{_reldir}/System.Private.CoreLib.dll  %{buildroot}%{_datadir}/%{netcoreappdir}
%endif

%if 0%{skipnative}
%else
%files
%manifest %{name}.manifest
%dir %{_datadir}/%{dotnetdir}
%dir %{_datadir}/%{netcoreappdir}
%dir %{_datadir}/%{dotnettizendir}
%{_datadir}/%{netcoreappdir}/crossgen
%{_datadir}/%{dotnetfwdir}/crossgen
%{_datadir}/%{netcoreappdir}/*.so
%{_datadir}/%{dotnettizendir}/netcoreapp

# symlink to .NET version for compatibility
%dir %{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.0.0
%dir %{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.1.0
%dir %{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.1.1
%dir %{_datadir}/%{netshareddir}/Microsoft.NETCore.App/2.1.4

%files test
%manifest %{name}.manifest
%dir %{_datadir}/%{dotnettestdir}
%{_datadir}/%{dotnettestdir}/*

%files devel
%manifest %{name}.manifest
%dir %{_datadir}/%{netcoreappdir}/lib
%dir %{_datadir}/%{netcoreappdir}/src
%dir %{_datadir}/%{dotnetfwdir}
%{_datadir}/%{netcoreappdir}/lib/*
%{_datadir}/%{netcoreappdir}/src/*
%{_datadir}/%{netcoreappdir}/ilasm
%{_datadir}/%{netcoreappdir}/ildasm
%{_datadir}/%{netcoreappdir}/corerun
%{_datadir}/%{netcoreappdir}/coreconsole
%{_datadir}/%{dotnetdir}/corerun
%{_datadir}/%{dotnetfwdir}/coreconsole
%endif

%if 0%{skipmscorlib}
%else
%files -n mscorlib
%manifest %{name}.manifest
%{_datadir}/%{netcoreappdir}/*.dll
%endif