Add RPM packaging
authorWonyoung Choi <wy80.choi@samsung.com>
Mon, 27 Aug 2018 00:28:56 +0000 (09:28 +0900)
committerWonyoung Choi <wy80.choi@samsung.com>
Mon, 27 Aug 2018 00:50:15 +0000 (09:50 +0900)
packaging/build-tools.tar.gz [new file with mode: 0644]
packaging/externals.dng_sdk.tar.gz [new file with mode: 0644]
packaging/externals.libwebp.tar.gz [new file with mode: 0644]
packaging/externals.piex.tar.gz [new file with mode: 0644]
packaging/externals.zlib.tar.gz [new file with mode: 0644]
packaging/fix-build-gn.patch [new file with mode: 0644]
packaging/libSkiaSharp.manifest [new file with mode: 0644]
packaging/libSkiaSharp.spec [new file with mode: 0644]

diff --git a/packaging/build-tools.tar.gz b/packaging/build-tools.tar.gz
new file mode 100644 (file)
index 0000000..2a33c64
Binary files /dev/null and b/packaging/build-tools.tar.gz differ
diff --git a/packaging/externals.dng_sdk.tar.gz b/packaging/externals.dng_sdk.tar.gz
new file mode 100644 (file)
index 0000000..31d760e
Binary files /dev/null and b/packaging/externals.dng_sdk.tar.gz differ
diff --git a/packaging/externals.libwebp.tar.gz b/packaging/externals.libwebp.tar.gz
new file mode 100644 (file)
index 0000000..7879bc2
Binary files /dev/null and b/packaging/externals.libwebp.tar.gz differ
diff --git a/packaging/externals.piex.tar.gz b/packaging/externals.piex.tar.gz
new file mode 100644 (file)
index 0000000..10171b3
Binary files /dev/null and b/packaging/externals.piex.tar.gz differ
diff --git a/packaging/externals.zlib.tar.gz b/packaging/externals.zlib.tar.gz
new file mode 100644 (file)
index 0000000..5e1ab36
Binary files /dev/null and b/packaging/externals.zlib.tar.gz differ
diff --git a/packaging/fix-build-gn.patch b/packaging/fix-build-gn.patch
new file mode 100644 (file)
index 0000000..ca99431
--- /dev/null
@@ -0,0 +1,26 @@
+diff --git a/gn/BUILD.gn b/gn/BUILD.gn
+index dcb34815c9..0fe2d39b97 100644
+--- a/gn/BUILD.gn
++++ b/gn/BUILD.gn
+@@ -3,7 +3,7 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+-exec_script("xamarin_inject_compat.py", [ rebase_path("..") ])
++#exec_script("xamarin_inject_compat.py", [ rebase_path("..") ])
+ declare_args() {
+   ar = "ar"
+@@ -416,9 +416,9 @@ config("warnings") {
+       ]
+     }
+   }
+-  if (!is_win || is_clang) {
+-    cflags += [ "-Wno-implicit-fallthrough" ]
+-  }
++#  if (!is_win || is_clang) {
++#    cflags += [ "-Wno-implicit-fallthrough" ]
++#  }
+ }
+ config("warnings_except_public_headers") {
+   if (!is_win) {
diff --git a/packaging/libSkiaSharp.manifest b/packaging/libSkiaSharp.manifest
new file mode 100644 (file)
index 0000000..96a1325
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
\ No newline at end of file
diff --git a/packaging/libSkiaSharp.spec b/packaging/libSkiaSharp.spec
new file mode 100644 (file)
index 0000000..a734358
--- /dev/null
@@ -0,0 +1,106 @@
+Name:       libSkiaSharp
+Summary:    Native library for SkiaSharp nuget package
+Version:    1.60.3
+Release:    0
+Group:      System/API
+License:    BSD-3-Clause
+Source0:    %{name}-%{version}.tar.gz
+Source1:    %{name}.manifest
+Source2:    build-tools.tar.gz
+Patch0:     fix-build-gn.patch
+
+ExcludeArch: aarch64
+
+BuildRequires: pkgconfig(icu-i18n)
+BuildRequires: pkgconfig(fontconfig)
+BuildRequires: pkgconfig(turbojpeg)
+BuildRequires: pkgconfig(libpng)
+BuildRequires: pkgconfig(zlib)
+
+BuildRequires: patchelf
+BuildRequires: ninja
+BuildRequires: expat-devel, python, python-xml
+
+%ifarch %arm
+%define ARCH armv7
+%define MFPU neon
+%endif
+%ifarch %ix86
+%define ARCH x86
+%endif
+%ifarch x86_64
+%define ARCH x64
+%endif
+
+%define _BINDIR bin
+
+%description
+Native library for SkiaSharp nuget package.
+Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.
+See full details, and build instructions, at https://skia.org.
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%patch0 -p1
+
+mkdir -p %{_BINDIR}
+tar xvfz %{SOURCE2} -C %{_BINDIR}
+
+# patchelf for bin/
+%define PATCH_TARGETS %{_BINDIR}/gn
+for x in %{PATCH_TARGETS}; do
+    patchelf --set-interpreter %{_BINDIR}/deps/ld-linux-x86-64.so.2 $x
+    patchelf --set-rpath %{_BINDIR}/deps/ $x
+done
+
+# patchelf for bin/deps/
+for x in $( find %{_BINDIR}/deps -type f \( -name "*.so" -or -name "*.so.*" \) -not -name "ld-*.so*" ); do
+    patchelf --set-rpath %{_BINDIR}/deps/ $x
+done
+
+# prepare external modules
+for ext in $(ls -1 packaging/externals.*.tar.gz); do
+  extname=$(basename -- $ext)
+  extname=${extname#externals\.}
+  extname=${extname%\.tar\.gz}
+  mkdir -p third_party/externals/$extname
+  tar xvfz $ext -C third_party/externals/$extname
+done
+
+%build
+%{_BINDIR}/gn gen out/Tizen --args='
+        is_official_build=true
+        skia_enable_tools=false
+        target_os="linux"
+        target_cpu="%{ARCH}"
+        skia_enable_gpu=true
+        skia_use_icu=false
+        skia_use_sfntly=false
+        skia_use_piex=true
+        skia_use_system_expat=true
+        skia_use_system_freetype2=true
+        skia_use_system_libjpeg_turbo=true
+        skia_use_system_libpng=true
+        skia_use_system_libwebp=false
+        skia_use_system_zlib=true
+        extra_cflags=[
+          "-DSKIA_C_DLL", "-DSK_BUILD_FOR_TIZEN", "-DSK_BUILD_FOR_UNIX"
+          , "-DSK_INTERNAL", "-DSK_SUPPORT_GPU=1"
+          , "-Wno-unused-function"
+%ifarch %arm
+          , "-mfpu=%{MFPU}", "-mfloat-abi=softfp"
+%endif
+        ] '
+
+ninja -C out/Tizen
+
+%install
+mkdir -p %{buildroot}%{_libdir}
+install -p -m 644 out/Tizen/%{name}.so %{buildroot}%{_libdir}
+
+%files
+%license LICENSE
+%manifest %{name}.manifest
+%attr(644,root,root) %{_libdir}/*.so