packaging: pass '--enable-portable-binary' to configure
[platform/upstream/libffi.git] / packaging / libffi.spec
1 %define keepstatic 1
2 %global multilib_arches %{ix86}  x86_64
3
4 Name:           libffi
5 Version:        3.3
6 Release:        0
7 Summary:        A portable foreign function interface library
8 License:        MIT
9 Url:            http://sourceware.org/libffi
10 Group:          Base/Toolchain
11 Source0:        ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
12 Source1:        ffi-multilib.h
13 Source2:        ffitarget-multilib.h
14
15 %description
16 Compilers for high level languages generate code that follow certain
17 conventions.  These conventions are necessary, in part, for separate
18 compilation to work.  One such convention is the "calling convention".
19 The calling convention is a set of assumptions made by the compiler
20 about where function arguments will be found on entry to a function.  A
21 calling convention also specifies where the return value for a function
22 is found.
23
24 Some programs may not know at the time of compilation what arguments
25 are to be passed to a function.  For instance, an interpreter may be
26 told at run-time about the number and types of arguments used to call a
27 given function.  `Libffi' can be used in such programs to provide a
28 bridge from the interpreter program to compiled code.
29
30 The `libffi' library provides a portable, high level programming
31 interface to various calling conventions.  This allows a programmer to
32 call any function specified by a call interface description at run time.
33
34 FFI stands for Foreign Function Interface.  A foreign function
35 interface is the popular name for the interface that allows code
36 written in one language to call code written in another language.  The
37 `libffi' library really only provides the lowest, machine dependent
38 layer of a fully featured foreign function interface.  A layer must
39 exist above `libffi' that handles type conversions for values passed
40 between the two languages.
41
42 %package        devel
43 Summary:        Development files for %{name}
44 Requires:       %{name} = %{version}
45 Requires:       pkgconfig
46
47 %description    devel
48 The %{name}-devel package contains libraries and header files for
49 developing applications that use %{name}.
50
51 %package        devel-static
52 Summary:        Development files for %{name}
53 Requires:       %{name}-devel = %{version}
54
55 %description    devel-static
56 The %{name}-devel package contains libraries and header files for
57 developing applications that use %{name}.
58
59 %prep
60 %setup -q
61
62 %build
63 export LDFLAGS+="-Wl,-z,noexecstack"
64 %reconfigure "--enable-portable-binary"
65 %{__make} %{?_smp_mflags}
66
67 %install
68 %make_install
69
70 # Determine generic arch target name for multilib wrapper
71 basearch=%{_arch}
72 %ifarch %{ix86}
73 basearch=i386
74 %endif
75
76 %ifarch %{multilib_arches}
77 # Do header file switcheroo to avoid file conflicts on systems where you
78 # can have both a 32- and 64-bit version of the library, and they each need
79 # their own correct-but-different versions of the headers to be usable.
80 for i in ffi ffitarget; do
81   mv %{buildroot}%{_includedir}/$i.h %{buildroot}%{_includedir}/$i-${basearch}.h
82 done
83 install -m644 %{SOURCE1} %{buildroot}%{_includedir}/ffi.h
84 install -m644 %{SOURCE2} %{buildroot}%{_includedir}/ffitarget.h
85 %endif
86
87
88 %post -p /sbin/ldconfig
89
90 %postun -p /sbin/ldconfig
91
92
93 %files
94 %defattr(-,root,root,-)
95 %license LICENSE
96 %{_libdir}/*.so.*
97
98 %files devel
99 %defattr(-,root,root,-)
100 %{_libdir}/pkgconfig/*.pc
101 %{_includedir}/ffi*.h
102 %{_libdir}/*.so
103 %{_mandir}/man3/*.gz
104 #%{_infodir}/libffi.info.gz
105
106 %changelog
107
108 %files devel-static
109 %defattr(-,root,root,-)
110 %{_libdir}/*.a