Move defines to spec and set smack label on file with default base addresses
[platform/core/dotnet/launcher.git] / packaging / dotnet-launcher.spec
1 Name:       dotnet-launcher
2 Summary:    Launchpad plugin for dotnet apps
3 Version:    3.0.0
4 Release:    1
5 Group:      Application Framework/Application State Management
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 AutoReqProv: no
9 Source1: %{name}.conf
10
11 BuildRequires: cmake
12 BuildRequires: pkgconfig(aul)
13 BuildRequires: pkgconfig(bundle)
14 BuildRequires: pkgconfig(dlog)
15 BuildRequires: pkgconfig(ecore)
16 BuildRequires: pkgconfig(liblaunchpad)
17 BuildRequires: pkgconfig(pkgmgr-info)
18 BuildRequires: pkgconfig(pkgmgr-installer)
19 BuildRequires: pkgconfig(glib-2.0)
20 BuildRequires: pkgconfig(libsmack)
21 BuildRequires: pkgconfig(capi-appfw-app-common)
22 BuildRequires: pkgconfig(storage)
23 BuildRequires: pkgconfig(jsoncpp)
24 BuildRequires: pkgconfig(openssl)
25 BuildRequires: sqlite-devel
26 BuildRequires: boost-devel
27 BuildRequires: aul-devel
28 BuildRequires: dotnet-build-tools
29
30 %if 0%{?asan_enabled}
31 BuildRequires: clang >= 3.8
32 BuildRequires: compiler-rt
33 %endif
34
35 Requires: aul
36 Requires: liblaunchpad
37 Requires: coreclr
38 Requires: mscorlib
39 Requires: corefx-native
40 Requires: corefx-managed
41
42 Requires(post): /sbin/ldconfig
43 Requires(post): /usr/bin/systemctl
44 Requires(post): /usr/bin/chsmack
45 Requires(postun): /sbin/ldconfig
46 Requires(postun): /usr/bin/systemctl
47 Requires(preun): /usr/bin/systemctl
48
49 %define _loaderdir %{_prefix}/share/aul
50 %define _device_api_dir %{dotnet_assembly_path}
51 %define _runtime_dir /usr/share/dotnet.tizen/netcoreapp
52 %define _framework_dir /usr/share/dotnet.tizen/framework
53 %define _install_mdplugin_dir /etc/package-manager/parserlib/metadata
54 %define _native_lib_dir /usr/share/dotnet.tizen/lib
55 %define _tac_dir /opt/usr/dotnet
56 %define _system_base_addr_file /usr/share/dotnet.tizen/system.base.addr
57
58 %define _default_base_addr_start 0x3000000
59
60 ExcludeArch: aarch64
61
62 %description
63 Launchpad plugin for launching dotnet apps
64
65 %package devel
66 Summary: Libraries and Header Files for dotnet-launcher plugins and AOTC tools
67 Requires: %{name} = %{version}
68
69 %description devel
70 This package contains library and header files needed to develop plugins for dotnet-launcher
71 and AOTC tools.
72
73 %prep
74 %setup -q
75 cp %{SOURCE1} .
76
77 %build
78
79 %if 0%{?asan_enabled}
80 %define _dotnet_build_conf Debug
81 export CFLAGS=" --target=%{_host} "
82 export CXXFLAGS=" --target=%{_host} "
83 %ifarch %{ix86}
84 export CFLAGS=$(echo $CFLAGS | sed -e 's/--target=i686/--target=i586/')
85 export CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/--target=i686/--target=i586/')
86 %endif
87 %endif
88
89 dotnet msbuild Init/Tizen.Init.csproj /t:clean
90 dotnet msbuild Init/Tizen.Init.csproj /t:restore /p:RestoreSources=/nuget
91 dotnet msbuild Init/Tizen.Init.csproj
92
93 dotnet msbuild Managed/Dotnet.Launcher.csproj /t:clean
94 dotnet msbuild Managed/Dotnet.Launcher.csproj /t:restore /p:RestoreSources=/nuget
95 dotnet msbuild Managed/Dotnet.Launcher.csproj
96
97 cmake \
98         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
99 %if 0%{?asan_enabled}
100         -DCMAKE_C_COMPILER=clang \
101         -DCMAKE_CXX_COMPILER=clang++ \
102         -DASAN_ENABLED=TRUE \
103 %endif
104         -DLIBDIR=%{_libdir} \
105         -DBINDIR=%{_bindir} \
106         -DINCLUDEDIR=%{_includedir} \
107         -DLOADERDIR=%{_loaderdir} \
108         -DCMAKE_BUILD_TYPE=%{_dotnet_build_conf} \
109         -DDEVICE_API_DIR=%{_device_api_dir} \
110         -DRUNTIME_DIR=%{_runtime_dir} \
111         -DCROSSGEN_PATH=%{_runtime_dir}/crossgen \
112         -DINSTALL_MDPLUGIN_DIR=%{_install_mdplugin_dir} \
113         -DTAC_DIR=%{_tac_dir} \
114         -DVERSION=%{version} \
115         -DNATIVE_LIB_DIR=%{_native_lib_dir} \
116 %if 0%{?use_default_base_addr}
117         -DUSE_DEFAULT_BASE_ADDR="" \
118 %endif
119         -DUNIQUE_DEFAULT_BASE_ADDR_SUPPORT="" \
120         -DSYSTEM_BASE_FILE=%{_system_base_addr_file} \
121         -DDEFAULT_BASE_ADDR_START=%{_default_base_addr_start} \
122         NativeLauncher
123
124 make %{?jobs:-j%jobs} VERBOSE=1
125
126 %install
127 rm -rf %{buildroot}
128 %make_install
129 mkdir -p %{buildroot}%{_framework_dir}
130 mv Init/bin/Release/Tizen.Init.dll %{buildroot}%{_framework_dir}
131 mv Managed/bin/Release/Dotnet.Launcher.dll %{buildroot}%{_framework_dir}
132
133 mkdir -p %{buildroot}%{_tac_dir}
134 mkdir -p %{buildroot}%{_native_lib_dir}
135 ln -sf %{_libdir}/libsqlite3.so.0 %{buildroot}%{_native_lib_dir}/libsqlite3.so
136
137 mkdir -p %{buildroot}/etc/tmpfiles.d
138 install -m 0644 %{name}.conf %{buildroot}/etc/tmpfiles.d/%{name}.conf
139
140 %post
141 mkdir -p /opt/etc/skel/.dotnet
142 chsmack -t -a User::App::Shared /opt/etc/skel/.dotnet
143 %{_bindir}/nitool --dll %{_runtime_dir}/System.Private.CoreLib.dll
144 chsmack -a _ %{_system_base_addr_file}
145
146 %files
147 %manifest dotnet-launcher.manifest
148 %{_loaderdir}/dotnet.loader
149 %{_loaderdir}/dotnet.launcher
150 %{_loaderdir}/dotnet.debugger
151 %{_native_lib_dir}/libsqlite3.so
152 %{_bindir}/nitool
153 %{_bindir}/tpatool
154 %{_bindir}/tactool
155 %{_install_mdplugin_dir}/libprefer_nuget_cache_plugin.so
156 %{_install_mdplugin_dir}/libprefer_dotnet_aot_plugin.so
157 %{_bindir}/dotnet-launcher
158 %{_libdir}/libdotnet_launcher_util.so
159 %{_libdir}/libni_common.so
160 /etc/tmpfiles.d/%{name}.conf
161 /usr/share/parser-plugins/dotnet-launcher.info
162 %{_framework_dir}/Tizen.Init.dll
163 %{_framework_dir}/Dotnet.Launcher.dll
164 %{_tac_dir}
165
166 %files devel
167 %manifest dotnet-launcher.manifest
168 %defattr(-,root,root,-)
169 %{_includedir}/ni_common.h
170 %{_includedir}/dotnet_launcher_plugin.h
171 %{_includedir}/coreclr_host.h
172 %{_libdir}/libdotnet_launcher_util.so
173 %{_libdir}/libni_common.so
174 %{_libdir}/pkgconfig/dotnet-launcher.pc