VPP-390: include *.so symlinks in vpp-lib
[vpp.git] / build-root / rpm / vpp.spec
1 %define _vpp_install_dir ../%{_install_dir}
2 %define _vpp_build_dir   ../build-tool-native
3 %define _unitdir         /lib/systemd/system
4 %define _topdir          %(pwd)
5 %define _builddir        %{_topdir}
6 %define _version         %(../scripts/version rpm-version)
7 %define _release         %(../scripts/version rpm-release)
8
9 Name: vpp
10 Summary: Vector Packet Processing
11 License: MIT
12 Version: %{_version}
13 Release: %{_release}
14 Requires: vpp-lib = %{_version}-%{_release}, net-tools, pciutils
15
16 %description
17 This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
18 vpp - the vector packet engine
19 vpp_api_test - vector packet engine API test tool
20 vpp_json_test - vector packet engine JSON test tool
21
22 %package lib
23 Summary: VPP libraries
24 Group: System Environment/Libraries
25
26 %description lib
27 This package contains the VPP shared libraries, including:
28 vppinfra - foundation library supporting vectors, hashes, bitmaps, pools, and string formatting.
29 dpdk - Intel DPDK library
30 svm - vm library
31 vlib - vector processing library
32 vlib-api - binary API library
33 vnet -  network stack library
34
35 %package devel
36 Summary: VPP header files, static libraries
37 Group: Development/Libraries
38 Requires: vpp-lib
39
40 %description devel
41 This package contains the header files and static libraries for
42 vppinfra.  Install this package if you want to write or compile a
43 program that needs vpp.
44 Do we need to list those header files or just leave it blank ? 
45 dynamic vectors (vec.c), dynamic bitmaps (bitmap.h), allocation heap of
46 objects (heap.c), allocation pool(pool.h), dynamic hash tables (hash.c), memory
47 allocator (mheap.c), extendable printf-like interface built on top of vectors
48 (format.c), formats for data structures (std-formats.c), and support for clock
49 time-based function calls (timer.c).
50 TODO: reference and describe only the .h files
51
52 %pre
53 # Add the vpp group
54 groupadd -f -r vpp
55
56 %install
57 #
58 # binaries
59 #
60 mkdir -p -m755 %{buildroot}%{_bindir}
61 mkdir -p -m755 %{buildroot}%{_unitdir}
62 install -p -m 755 %{_vpp_install_dir}/*/bin/* %{buildroot}%{_bindir}
63 install -p -m 755 %{_vpp_build_dir}/vppapigen/vppapigen %{buildroot}%{_bindir}
64 #
65 # configs
66 #
67 mkdir -p -m755 %{buildroot}/etc/vpp
68 mkdir -p -m755 %{buildroot}/etc/sysctl.d
69 install -p -m 644 vpp.service %{buildroot}%{_unitdir}
70 install -p -m 644 ../../vpp/conf/startup.uiopcigeneric.conf %{buildroot}/etc/vpp/startup.conf
71 install -p -m 644 ../../vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d
72 #
73 # libraries
74 #
75 mkdir -p -m755 %{buildroot}%{_libdir}
76 for file in $(find %{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*.*' -print )
77 do
78         install -p -m 755 $file %{buildroot}%{_libdir}
79 done
80 for file in $(cd %{buildroot}%{_libdir} && find . -type f -print | sed -e 's/^\.\///')
81 do
82         # make lib symlinks
83         ( cd %{buildroot}%{_libdir} && 
84           ln -fs $file $(echo $file | sed -e 's/\(\.so\.[0-9]\+\).*/\1/') )
85         ( cd %{buildroot}%{_libdir} && 
86           ln -fs $file $(echo $file | sed -e 's/\(\.so\)\.[0-9]\+.*/\1/') )
87 done
88
89 #
90 # devel
91 #
92 for dir in $(find %{_vpp_install_dir}/*/include/ -maxdepth 0 -type d -print | grep -v dpdk)
93 do
94         for subdir in $(cd ${dir} && find . -type d -print)
95         do
96                 mkdir -p -m755 %{buildroot}/usr/include/${subdir}
97         done
98         for file in $(cd ${dir} && find . -type f -print)
99         do
100                 install -p -m 644 $dir/$file %{buildroot}%{_includedir}/$file
101         done
102 done
103
104 mkdir -p -m755 %{buildroot}%{python2_sitelib}/jvppgen
105 install -p -m755 ../../vpp-api/java/jvpp/gen/jvpp_gen.py %{buildroot}/usr/bin
106 for i in $(ls ../../vpp-api/java/jvpp/gen/jvppgen/*.py); do
107    install -p -m666 ${i} %{buildroot}%{python2_sitelib}/jvppgen
108 done;
109
110 # sample plugin
111 mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/sample
112 for file in $(cd %{_vpp_install_dir}/../../sample-plugin && find -type f -print)
113 do
114         install -p -m 644 %{_vpp_install_dir}/../../sample-plugin/$file \
115            %{buildroot}/usr/share/doc/vpp/examples/sample-plugin/$file
116 done
117
118 %post
119 sysctl --system
120 %systemd_post vpp.service
121
122 %postun
123 %systemd_postun_with_restart vpp.service
124
125 %files
126 %defattr(-,bin,bin)
127 %{_unitdir}/vpp.service
128 /usr/bin/vpp*
129 /usr/bin/svm*
130 /usr/bin/elftool
131 %config /etc/sysctl.d/80-vpp.conf
132 %config /etc/vpp/startup.conf
133
134 %files lib
135 %defattr(-,bin,bin)
136 %{_libdir}/*
137
138 %files devel
139 %defattr(-,bin,bin)
140 /usr/bin/vppapigen
141 /usr/bin/jvpp_gen.py
142 %{_includedir}/*
143 %{python2_sitelib}/jvppgen/*
144 /usr/share/doc/vpp/examples/sample-plugin
145