]>
Commit | Line | Data |
---|---|---|
d7f79747 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without lua # build without tests | |
4 | ||
5 | %define __lua /usr/bin/lua5.1 | |
6 | #define luaver %(%{__lua} -e "print(string.sub(_VERSION, 5))") | |
7 | %define luaver 5.1 | |
8 | %define lualibdir %{_libdir}/lua/%{luaver} | |
9 | %define luapkgdir %{_datadir}/lua/%{luaver} | |
10 | ||
6e3d7976 ER |
11 | Summary: Simple implementation of msgpack in C |
12 | Name: libmpack | |
13 | Version: 1.0.2 | |
14 | Release: 0.1 | |
15 | License: MIT | |
16 | Group: Development/Libraries | |
17 | Source0: https://github.com/tarruda/libmpack/archive/%{version}/%{name}-%{version}.tar.gz | |
18 | # Source0-md5: a6320e37991bb56520d4670419edb43c | |
d7f79747 | 19 | Patch0: https://github.com/tarruda/libmpack/pull/8.diff |
d5c2316e | 20 | # Patch0-md5: 91f4f18a5b74713465b392b3fe20d07a |
d7f79747 ER |
21 | Patch1: https://github.com/tarruda/libmpack/commit/0cc47f7e859b7124cf46483a6e59ed973bbe5e42.diff |
22 | # Patch1-md5: af5612df21a914fe0d06944196cfd274 | |
23 | Patch2: lua.patch | |
6e3d7976 ER |
24 | URL: https://github.com/tarruda/libmpack/ |
25 | BuildRequires: libtool | |
a1ef408a | 26 | BuildRequires: pkgconfig |
d7f79747 | 27 | %if %{with lua} |
a1ef408a ER |
28 | BuildRequires: lua51 |
29 | BuildRequires: lua51-devel >= %{luaver} | |
d7f79747 | 30 | %endif |
6e3d7976 ER |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
32 | ||
33 | %description | |
34 | libmpack is a small binary serialization/RPC library that implements | |
35 | both the msgpack and msgpack-rpc specifications. | |
36 | ||
37 | Differences from mspack-c: | |
38 | - Callback-based API to simplify (de)serialization directly to/from | |
39 | application-specific objects. | |
40 | - C89 compatible code | |
41 | - No allocation performed by the library, but helpers to simplify | |
42 | dynamic allocation if the application needs it. | |
43 | - Non-backtracking, incremental/iterative parse/serialization API | |
44 | ||
d5c2316e ER |
45 | %package devel |
46 | Summary: Header files for %{name} library | |
47 | Summary(pl.UTF-8): Pliki nagłówkowe biblioteki %{name} | |
48 | Group: Development/Libraries | |
49 | Requires: %{name} = %{version}-%{release} | |
50 | ||
51 | %description devel | |
52 | Header files for %{name} library. | |
53 | ||
d7f79747 ER |
54 | %package -n lua-mpack |
55 | Summary: Lua binding to libmpack | |
56 | Group: Development/Languages | |
57 | # does not link with libmpack.so | |
58 | #Requires: %{name} = %{version}-%{release} | |
59 | ||
60 | %description -n lua-mpack | |
61 | Lua binding to libmpack. | |
62 | ||
6e3d7976 ER |
63 | %prep |
64 | %setup -q | |
d5c2316e | 65 | %patch0 -p1 |
d7f79747 ER |
66 | %patch1 -p1 |
67 | %patch2 -p1 | |
6e3d7976 ER |
68 | |
69 | %build | |
70 | %{__make} config=release \ | |
71 | CC="%{__cc}" \ | |
72 | PREFIX=%{_prefix} \ | |
73 | CFLAGS="%{rpmcflags}" \ | |
d5c2316e | 74 | LDFLAGS="%{rpmldflags}" \ |
6e3d7976 ER |
75 | LIBDIR=%{_libdir} \ |
76 | VERBOSE=1 | |
77 | ||
d7f79747 ER |
78 | %if %{with lua} |
79 | %{__make} -C binding/lua \ | |
80 | CC="%{__cc}" \ | |
81 | USE_SYSTEM_LUA=yes | |
82 | %endif | |
83 | ||
6e3d7976 ER |
84 | %install |
85 | rm -rf $RPM_BUILD_ROOT | |
d5c2316e ER |
86 | %{__make} install \ |
87 | PREFIX=%{_prefix} \ | |
88 | LIBDIR=%{_libdir} \ | |
89 | DESTDIR=$RPM_BUILD_ROOT | |
6e3d7976 | 90 | |
d7f79747 ER |
91 | %if %{with lua} |
92 | %{__make} -C binding/lua install \ | |
93 | USE_SYSTEM_LUA=yes \ | |
94 | DESTDIR=$RPM_BUILD_ROOT | |
95 | %endif | |
96 | ||
d5c2316e ER |
97 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/libmpack.a |
98 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/libmpack.la | |
6e3d7976 ER |
99 | |
100 | %clean | |
101 | rm -rf $RPM_BUILD_ROOT | |
102 | ||
d5c2316e ER |
103 | %post -p /sbin/ldconfig |
104 | %postun -p /sbin/ldconfig | |
105 | ||
6e3d7976 ER |
106 | %files |
107 | %defattr(644,root,root,755) | |
108 | %doc README.md LICENSE-MIT | |
d5c2316e ER |
109 | %attr(755,root,root) %{_libdir}/libmpack.so.*.*.* |
110 | %ghost %{_libdir}/libmpack.so.0 | |
111 | ||
112 | %files devel | |
113 | %defattr(644,root,root,755) | |
114 | %{_libdir}/libmpack.so | |
115 | %{_includedir}/mpack.h | |
116 | %{_pkgconfigdir}/mpack.pc | |
d7f79747 ER |
117 | |
118 | %files -n lua-mpack | |
119 | %defattr(644,root,root,755) | |
120 | %attr(755,root,root) %{lualibdir}/mpack.so |