Skip to content

Commit 9093a72

Browse files
ksh8281clover2123
authored andcommitted
Implment tizen build of escargot
Signed-off-by: Seonghyun Kim <[email protected]>
1 parent 003d417 commit 9093a72

6 files changed

+370
-1
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ PROCESSORCOUNT (NPROCS)
1919
# INCLUDE CMAKE FILES
2020
INCLUDE (${PROJECT_SOURCE_DIR}/build/config.cmake)
2121
INCLUDE (${PROJECT_SOURCE_DIR}/build/escargot.cmake)
22+
23+
# Pkgconfig
24+
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/escargot.pc.in ${CMAKE_BINARY_DIR}/escargot.pc @ONLY)

RELEASE_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v4.0.0
1+
v4.0.1

packaging/escargot.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/usr/lib/escargot
2+
/usr/lib64/escargot
3+

packaging/escargot.manifest

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<manifest>
2+
<request>
3+
<domain name="_"/>
4+
</request>
5+
</manifest>

packaging/escargot.pc.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=/usr
2+
exec_prefix=/usr
3+
libdir=@LIBDIR@/escargot
4+
includedir=@INCLUDEDIR@/escargot
5+
6+
Name: Escargot
7+
Description: Lightweight JavaScript engine Escargot
8+
Version: 0.0.1
9+
Cflags: -I${includedir}
10+
Libs: -L${libdir} -lescargot
11+

packaging/escargot.spec

+347
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,347 @@
1+
#
2+
# Copyright (c) 2023-present Samsung Electronics Co., Ltd
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation; either
7+
# version 2.1 of the License, or (at your option) any later version.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU Lesser General Public
15+
# License along with this library; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17+
# USA
18+
19+
Name: escargot
20+
Summary: Lightweight JavaScript Engine Escargot
21+
Version: 1.0.0
22+
Release: 1
23+
Group: Development/Libraries
24+
License: LGPL-2.1+ and BSD-2-Clause and BSD-3-Clause and BSL-1.0 and MIT and ISC and Zlib and BOEHM-GC and ICU
25+
Source: %{name}-%{version}.tar.gz
26+
#ExclusiveArch: %arm
27+
28+
Requires(post): /sbin/ldconfig
29+
Requires(postun): /sbin/ldconfig
30+
31+
# RPM ref: http://backreference.org/2011/09/17/some-tips-on-rpm-conditional-macros/
32+
33+
# [ tv | mobile | wearable ]
34+
# The following syntax's been outdated.
35+
# %if %{?tizen_profile_name:1}%{!?tizen_profile_name:0}
36+
# %define profile %{tizen_profile_name}
37+
# %else
38+
# %define profile undefined
39+
# %endif
40+
41+
# [ tv | headless | mobile | wearable | all ]
42+
# build for all profile
43+
%if 0%{?build_profile:1}
44+
%define rpm %{build_profile}
45+
%else
46+
%define rpm all
47+
%endif
48+
49+
%if 0%{?tizen_version_major:1}
50+
%else
51+
%define tizen_version_major 4
52+
%endif
53+
54+
%if 0%{?tizen_version_minor:1}
55+
%else
56+
%define tizen_version_minor 0
57+
%endif
58+
59+
%if %{?_vd_cfg_product_type:1}%{!?_vd_cfg_product_type:0}
60+
%if "%{_vd_cfg_product_type}" == "AUDIO" || "%{rpm}" == "headless"
61+
%define rpm headless
62+
%else
63+
%if "%{_vd_cfg_product_type}" == "TV" || "%{_vd_cfg_product_type}" == "LFD" || "%{_vd_cfg_product_type}" == "IWB" || "%{_vd_cfg_product_type}" == "WALL"
64+
%define rpm prod_tv
65+
%endif
66+
%endif
67+
%endif
68+
69+
%if 0%{?sec_product_feature_profile_wearable} == 1
70+
%define rpm wearable
71+
%endif
72+
73+
%if 0%{?rebuild_force:1}
74+
%define force_build 1
75+
%else
76+
%define force_build 0
77+
%endif
78+
79+
%if 0%{?disable_lto:1}
80+
%define using_lto 0
81+
%else
82+
%if (0%{?tizen_version_major} == 5) && (0%{?tizen_version_minor} == 5) && %{?_vd_cfg_product_type:1}%{!?_vd_cfg_product_type:0}
83+
%define using_lto 0
84+
%else
85+
%if 0%{?tizen_version_major} >= 5
86+
%define using_lto 1
87+
%else
88+
%define using_lto 0
89+
%endif
90+
%endif
91+
%endif
92+
93+
%if 0%{?enable_codecache:1}
94+
%else
95+
%define enable_codecache 0
96+
%endif
97+
98+
%if 0%{?enable_wasm:1}
99+
%else
100+
%define enable_wasm 0
101+
%endif
102+
103+
%if 0%{?enable_debugger:1}
104+
%else
105+
%define enable_debugger 0
106+
%endif
107+
108+
%if 0%{?enable_test:1}
109+
%else
110+
%define enable_test 0
111+
%endif
112+
113+
%if 0%{?enable_shell:1}
114+
%else
115+
%define enable_shell 0
116+
%endif
117+
118+
# build requirements
119+
BuildRequires: cmake
120+
BuildRequires: ninja
121+
BuildRequires: pkgconfig(dlog)
122+
BuildRequires: pkgconfig(bundle)
123+
124+
# If you want to speed up the gbs build for devel, please uncomment below block.
125+
#%ifarch armv7l
126+
#BuildRequires: clang-accel-armv7l-cross-arm
127+
#%endif # arm7l
128+
#%ifarch aarch64
129+
#BuildRequires: clang-accel-aarch64-cross-aarch64
130+
#%endif # aarch64
131+
132+
# Supporting multiprofiles
133+
# Use profile_mobile as default, as it is both minimal and
134+
# platform-independent version of LWE at the time of writing
135+
# TODO: Creates a profile_common if this is no longer true.
136+
Requires: %{name}-compat = %{version}-%{release}
137+
Recommends: %{name}-profile_mobile = %{version}-%{release}
138+
139+
%description
140+
This package provides implementation of Lightweight JavaScript Engine.
141+
142+
143+
##############################################
144+
# Packages for profiles
145+
##############################################
146+
%if "%{rpm}" == "tv" || "%{rpm}" == "prod_tv" || "%{rpm}" == "all"
147+
%package profile_tv
148+
Summary: Lightweight JavaScript Engine Escargot for tv
149+
Provides: %{name}-compat = %{version}-%{release}
150+
Conflicts: %{name}-profile_headless = %{version}-%{release}
151+
Conflicts: %{name}-profile_mobile = %{version}-%{release}
152+
Conflicts: %{name}-profile_wearable = %{version}-%{release}
153+
%description profile_tv
154+
Lightweight JavaScript Engine for tv
155+
%endif
156+
157+
%if "%{rpm}" == "headless"
158+
%package profile_headless
159+
Summary: Lightweight JavaScript Engine for headless
160+
Provides: %{name}-compat = %{version}-%{release}
161+
Conflicts: %{name}-profile_tv = %{version}-%{release}
162+
Conflicts: %{name}-profile_mobile = %{version}-%{release}
163+
Conflicts: %{name}-profile_wearable = %{version}-%{release}
164+
%description profile_headless
165+
Lightweight JavaScript Engine for headless
166+
%endif
167+
168+
%if "%{rpm}" == "mobile" || "%{rpm}" == "all"
169+
%package profile_mobile
170+
Summary: Lightweight JavaScript Engine Escargot for mobile
171+
Provides: %{name}-compat = %{version}-%{release}
172+
Conflicts: %{name}-profile_tv = %{version}-%{release}
173+
Conflicts: %{name}-profile_headless = %{version}-%{release}
174+
Conflicts: %{name}-profile_wearable = %{version}-%{release}
175+
%description profile_mobile
176+
Lightweight JavaScript Engine for mobile
177+
%endif
178+
179+
%if "%{rpm}" == "wearable" || "%{rpm}" == "all"
180+
%package profile_wearable
181+
Summary: Lightweight JavaScript Engine Escargot for wearable
182+
Provides: %{name}-compat = %{version}-%{release}
183+
Conflicts: %{name}-profile_tv = %{version}-%{release}
184+
Conflicts: %{name}-profile_headless = %{version}-%{release}
185+
Conflicts: %{name}-profile_mobile = %{version}-%{release}
186+
%description profile_wearable
187+
Lightweight JavaScript Engine for wearable
188+
%endif
189+
190+
%package devel
191+
Summary: Development files for Lightweight JavaScript Engine Escargot
192+
Group: Development/Libraries
193+
Requires: %{name} = %{version}
194+
%description devel
195+
Development files for Lightweight JavaScript Engine Escargot. This package provides
196+
headers and package configs.
197+
198+
##############################################
199+
# Prep
200+
##############################################
201+
%prep
202+
%setup -q
203+
204+
##############################################
205+
# Build
206+
##############################################
207+
%build
208+
echo "Building for: " %{rpm}
209+
210+
CXXFLAGS+=' -DESCARGOT_TIZEN_MAJOR_VERSION=%{tizen_version_major} '
211+
CXXFLAGS+=' -DESCARGOT_TIZEN_VERSION_%{tizen_version_major}_%{tizen_version_minor} '
212+
213+
##############################################
214+
# Asan with lto leads internal compiler error
215+
##############################################
216+
%if 0%{?asan} == 1
217+
CFLAGS+=' -fno-lto '
218+
CXXFLAGS+=' -fno-lto '
219+
%endif
220+
221+
##############################################
222+
# Disable lto option
223+
##############################################
224+
%if 0%{?using_lto} == 0
225+
CFLAGS+=' -fno-lto '
226+
CXXFLAGS+=' -fno-lto '
227+
%endif
228+
229+
##############################################
230+
## Build rules for each profile
231+
##############################################
232+
%define fp_mode soft
233+
%ifarch armv7l armv7hl
234+
%define tizen_arch arm
235+
%endif
236+
%ifarch armv7hl
237+
%define fp_mode hard
238+
%endif
239+
%ifarch aarch64
240+
%define tizen_arch aarch64
241+
%endif
242+
%ifarch i686
243+
%define tizen_arch i686
244+
%endif
245+
%ifarch x86_64
246+
%define tizen_arch x86_64
247+
%endif
248+
249+
%if "%{rpm}" == "wearable"
250+
CFLAGS+=' -Os '
251+
CXXFLAGS+=' -Os '
252+
%endif
253+
254+
%if "%{?enable_test}" == "1"
255+
CFLAGS+=' -DESCARGOT_ENABLE_TEST -DESCARGOT_ENABLE_TEMPORAL '
256+
CXXFLAGS+=' -DESCARGOT_ENABLE_TEST -DESCARGOT_ENABLE_TEMPORAL '
257+
%endif
258+
259+
cmake CMakeLists.txt -H./ -Bbuild/out_tizen_%{rpm} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} -DTIZEN_MAJOR_VERSION='%{tizen_version_major}' \
260+
-DESCARGOT_ARCH='%{tizen_arch}' -DESCARGOT_WASM='%{enable_wasm}' -DESCARGOT_DEBUGGER='%{enable_debugger}' \
261+
-DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_MODE=release -DESCARGOT_HOST=tizen_obs -DESCARGOT_OUTPUT=shared_lib -G Ninja
262+
pushd build/out_tizen_%{rpm}
263+
ninja -v
264+
popd
265+
266+
%if "%{?enable_shell}" == "1"
267+
g++ src/shell/Shell.cpp -std=c++11 -Lbuild/out_tizen_%{rpm} -Isrc/ -Ithird_party/GCutil -Ithird_party/GCutil/bdwgc/include -o build/out_tizen_%{rpm}/escargot -O2 -DNDEBUG -Wl,-rpath=\$ORIGIN ${CXXFLAGS} -lescargot -lpthread
268+
g++ tools/test/test-data-runner/test-data-runner.cpp -o build/out_tizen_%{rpm}/test-data-runner -std=c++11 ${CXXFLAGS} -lpthread
269+
%endif
270+
271+
272+
273+
##############################################
274+
## Install
275+
##############################################
276+
277+
%install
278+
%define bin libescargot.so
279+
280+
rm -rf %{buildroot}
281+
mkdir -p %{buildroot}%{_libdir}
282+
mkdir -p %{buildroot}%{_libdir}/escargot
283+
mkdir -p %{buildroot}%{_bindir}
284+
cp -fr build/out_tizen_%{rpm}/*.so* %{buildroot}%{_libdir}/escargot
285+
286+
# for devel files
287+
mkdir -p %{buildroot}%{_includedir}/%{name}
288+
cp src/api/*.h %{buildroot}%{_includedir}/%{name}
289+
290+
mkdir -p %{buildroot}%{_libdir}/pkgconfig/
291+
cp build/out_tizen_%{rpm}/escargot.pc %{buildroot}%{_libdir}/pkgconfig/
292+
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/
293+
cp packaging/escargot.conf %{buildroot}%{_sysconfdir}/ld.so.conf.d/
294+
295+
##############################################
296+
## Scripts
297+
##############################################
298+
299+
# Post Install
300+
%post
301+
/sbin/ldconfig
302+
303+
# Post Uninstall
304+
%postun
305+
/sbin/ldconfig
306+
307+
##############################################
308+
## Packaging rpms
309+
##############################################
310+
311+
%files
312+
%manifest packaging/%{name}.manifest
313+
314+
%if "%{rpm}" == "tv" || "%{rpm}" == "prod_tv" || "%{rpm}" == "all"
315+
%files profile_tv
316+
%manifest packaging/%{name}.manifest
317+
%{_libdir}/escargot/libescargot.so*
318+
%license LICENSE.BSD-2-Clause LICENSE.LGPL-2.1+ LICENSE.MPL-2.0 LICENSE.Apache-2.0 LICENSE.BSD-3-Clause LICENSE.MIT LICENSE.BOEHM-GC
319+
%endif
320+
321+
%if "%{rpm}" == "headless"
322+
%files profile_headless
323+
%manifest packaging/%{name}.manifest
324+
%{_libdir}/escargot/libescargot.so*
325+
%license LICENSE.BSD-2-Clause LICENSE.LGPL-2.1+ LICENSE.MPL-2.0 LICENSE.Apache-2.0 LICENSE.BSD-3-Clause LICENSE.MIT LICENSE.BOEHM-GC
326+
%endif
327+
328+
%if "%{rpm}" == "mobile" || "%{rpm}" == "all"
329+
%files profile_mobile
330+
%manifest packaging/%{name}.manifest
331+
%{_libdir}/escargot/libescargot.so*
332+
%{_sysconfdir}/ld.so.conf.d/*.conf
333+
%license LICENSE.BSD-2-Clause LICENSE.LGPL-2.1+ LICENSE.MPL-2.0 LICENSE.Apache-2.0 LICENSE.BSD-3-Clause LICENSE.MIT LICENSE.BOEHM-GC
334+
%endif
335+
336+
%if "%{rpm}" == "wearable" || "%{rpm}" == "all"
337+
%files profile_wearable
338+
%manifest packaging/%{name}.manifest
339+
%{_libdir}/escargot/libescargot.so*
340+
%{_sysconfdir}/ld.so.conf.d/*.conf
341+
%license LICENSE.BSD-2-Clause LICENSE.LGPL-2.1+ LICENSE.MPL-2.0 LICENSE.Apache-2.0 LICENSE.BSD-3-Clause LICENSE.MIT LICENSE.BOEHM-GC
342+
%endif
343+
344+
%files devel
345+
%manifest packaging/%{name}.manifest
346+
%{_includedir}
347+
%{_libdir}/pkgconfig/*.pc

0 commit comments

Comments
 (0)