Add packaging with v3.4.2 41/289641/1
authorDongkyun Son <dongkyun.s@samsung.com>
Fri, 29 Apr 2022 19:07:33 +0000 (04:07 +0900)
committerDongkyun Son <dongkyun.s@samsung.com>
Mon, 13 Mar 2023 02:05:00 +0000 (11:05 +0900)
Change-Id: I95cbe89e71086b8b6e7e148dded6313b934310de
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
packaging/baselibs.conf [new file with mode: 0755]
packaging/ffi-multilib.h [new file with mode: 0755]
packaging/ffitarget-multilib.h [new file with mode: 0755]
packaging/libffi.spec [new file with mode: 0755]

diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100755 (executable)
index 0000000..551c07e
--- /dev/null
@@ -0,0 +1,3 @@
+libffi
+libffi-devel
+    requires "libffi-<targettype> = <version>"
diff --git a/packaging/ffi-multilib.h b/packaging/ffi-multilib.h
new file mode 100755 (executable)
index 0000000..50a6226
--- /dev/null
@@ -0,0 +1,23 @@
+/* This file is here to prevent a file conflict on multiarch systems. */
+#ifdef ffi_wrapper_h
+#error "Do not define ffi_wrapper_h!"
+#endif
+#define ffi_wrapper_h
+
+#if defined(__i386__)
+#include "ffi-i386.h"
+#elif defined(__powerpc64__)
+#include "ffi-ppc64.h"
+#elif defined(__powerpc__)
+#include "ffi-ppc.h"
+#elif defined(__s390x__)
+#include "ffi-s390x.h"
+#elif defined(__s390__)
+#include "ffi-s390.h"
+#elif defined(__x86_64__)
+#include "ffi-x86_64.h"
+#else
+#error "The libffi-devel package is not usable with the architecture."
+#endif
+
+#undef ffi_wrapper_h
diff --git a/packaging/ffitarget-multilib.h b/packaging/ffitarget-multilib.h
new file mode 100755 (executable)
index 0000000..b2ed545
--- /dev/null
@@ -0,0 +1,23 @@
+/* This file is here to prevent a file conflict on multiarch systems. */
+#ifdef ffitarget_wrapper_h
+#error "Do not define ffitarget_wrapper_h!"
+#endif
+#define ffitarget_wrapper_h
+
+#if defined(__i386__)
+#include "ffitarget-i386.h"
+#elif defined(__powerpc64__)
+#include "ffitarget-ppc64.h"
+#elif defined(__powerpc__)
+#include "ffitarget-ppc.h"
+#elif defined(__s390x__)
+#include "ffitarget-s390x.h"
+#elif defined(__s390__)
+#include "ffitarget-s390.h"
+#elif defined(__x86_64__)
+#include "ffitarget-x86_64.h"
+#else
+#error "The libffi-devel package is not usable with the architecture."
+#endif
+
+#undef ffitarget_wrapper_h
diff --git a/packaging/libffi.spec b/packaging/libffi.spec
new file mode 100755 (executable)
index 0000000..b93d09c
--- /dev/null
@@ -0,0 +1,110 @@
+%define keepstatic 1
+%global multilib_arches %{ix86}  x86_64
+
+Name:           libffi
+Version:        3.4.2
+Release:        0
+Summary:        A portable foreign function interface library
+License:        MIT
+Url:            http://sourceware.org/libffi
+Group:          Base/Toolchain
+Source0:        ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
+Source1:        ffi-multilib.h
+Source2:        ffitarget-multilib.h
+
+%description
+Compilers for high level languages generate code that follow certain
+conventions.  These conventions are necessary, in part, for separate
+compilation to work.  One such convention is the "calling convention".
+The calling convention is a set of assumptions made by the compiler
+about where function arguments will be found on entry to a function.  A
+calling convention also specifies where the return value for a function
+is found.
+
+Some programs may not know at the time of compilation what arguments
+are to be passed to a function.  For instance, an interpreter may be
+told at run-time about the number and types of arguments used to call a
+given function.  `Libffi' can be used in such programs to provide a
+bridge from the interpreter program to compiled code.
+
+The `libffi' library provides a portable, high level programming
+interface to various calling conventions.  This allows a programmer to
+call any function specified by a call interface description at run time.
+
+FFI stands for Foreign Function Interface.  A foreign function
+interface is the popular name for the interface that allows code
+written in one language to call code written in another language.  The
+`libffi' library really only provides the lowest, machine dependent
+layer of a fully featured foreign function interface.  A layer must
+exist above `libffi' that handles type conversions for values passed
+between the two languages.
+
+%package       devel
+Summary:        Development files for %{name}
+Requires:       %{name} = %{version}
+Requires:       pkgconfig
+
+%description   devel
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
+
+%package       devel-static
+Summary:        Development files for %{name}
+Requires:       %{name}-devel = %{version}
+
+%description   devel-static
+The %{name}-devel package contains libraries and header files for
+developing applications that use %{name}.
+
+%prep
+%setup -q
+
+%build
+export LDFLAGS+="-Wl,-z,noexecstack"
+%reconfigure
+%{__make} %{?_smp_mflags}
+
+%install
+%make_install
+
+# Determine generic arch target name for multilib wrapper
+basearch=%{_arch}
+%ifarch %{ix86}
+basearch=i386
+%endif
+
+%ifarch %{multilib_arches}
+# Do header file switcheroo to avoid file conflicts on systems where you
+# can have both a 32- and 64-bit version of the library, and they each need
+# their own correct-but-different versions of the headers to be usable.
+for i in ffi ffitarget; do
+  mv %{buildroot}%{_includedir}/$i.h %{buildroot}%{_includedir}/$i-${basearch}.h
+done
+install -m644 %{SOURCE1} %{buildroot}%{_includedir}/ffi.h
+install -m644 %{SOURCE2} %{buildroot}%{_includedir}/ffitarget.h
+%endif
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%defattr(-,root,root,-)
+%license LICENSE
+%{_libdir}/*.so.*
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/pkgconfig/*.pc
+%{_includedir}/ffi*.h
+%{_libdir}/*.so
+%{_mandir}/man3/*.gz
+#%{_infodir}/libffi.info.gz
+
+%changelog
+
+%files devel-static
+%defattr(-,root,root,-)
+%{_libdir}/*.a