865b7962e590bae4cc956be50cf364edc223c54b
[platform/core/system/tizen-platform-config.git] / packaging / tizen-platform-config.spec
1 %define libname libtzplatform-config
2 %define keepstatic 1
3
4 Name:           tizen-platform-config
5 Version:        2.0
6 Release:        0
7 Summary:        Tizen Platform Configuration
8 License:        MIT
9 Url:            http://www.tizen.org
10 Group:          System/Configuration
11 Source0:        %{name}-%{version}.tar.gz
12 Source1:        %{name}-rpmlintrc
13 Source1001:     %{name}.manifest
14 BuildRequires:  tizen-platform-wrapper >= 2
15 Requires(post): smack
16 Requires(post): coreutils
17
18 # the main package only contains a config file but other dependent packages
19 # will contain binary. So, we can't build a noarch package and have to avoid
20 # a rpmlint warning using a filter in xxx-rpmlintrc
21
22 %description
23 Tizen Platform Configuration - variables definitions
24
25 %package -n %{libname}
26 Summary:        Tizen Platform Configuration - helper library
27 Group:          System/Libraries
28 License:        LGPL-2.0
29 Requires:       %{name} = %{version}
30 %description -n %{libname}
31 Tizen Platform Configuration - helper library to lookup Tizen variables easily
32
33 %package -n %{libname}-devel
34 Summary:        Tizen Platform Configuration - helper libray headers, RPM macros
35 Group:          Development/Libraries
36 License:        LGPL-2.0
37 Requires:       %{libname} = %{version}
38 %description -n %{libname}-devel
39 Tizen Platform Configuration - helper library headers to include in source code,
40 RPM macros to call in spec files
41
42 %package -n %{name}-tools
43 Summary:        Tizen Platform Configuration - tools
44 Group:          System/Utilities
45 License:        LGPL-2.0
46 Requires:       %{libname} = %{version}
47 %description -n %{name}-tools
48 Tizen Platform Configuration - helper program to lookup Tizen variables easily
49
50 %prep
51 %setup -q
52 cp %{SOURCE1001} .
53
54 %build
55 %reconfigure --enable-static
56 %__make %{?_smp_mflags}
57
58 %check
59 %__make check
60
61 %install
62 %make_install
63
64 %post
65 ##############################################
66 # BEGIN - setting of predefined directories (also /etc/skel)
67 ##############################################
68 saveHOME="$HOME"
69 HOME="%{_sysconfdir}/skel"
70 . "%{_sysconfdir}/tizen-platform.conf"
71 cat << ENDOFCAT |
72 MODE 777
73 SMACK System::Shared true
74 $TZ_SYS_STORAGE
75 $TZ_SYS_MEDIA
76
77 MODE 700
78 SMACK User::Home true
79 $TZ_USER_HOME
80 $TZ_USER_APPROOT
81 $TZ_USER_CONTENT
82 $TZ_USER_DB
83 $TZ_USER_PACKAGES
84 $TZ_USER_ICONS
85 $TZ_USER_APP
86
87 MODE 775
88 SMACK User::Home false
89 $TZ_SYS_DB
90 $TZ_SYS_RW_PACKAGES
91 $TZ_SYS_RW_APP
92
93 MODE 775
94 SMACK User::Home true
95 $TZ_SYS_RW_ICONS
96 $TZ_SYS_RW_ICONS/default
97 $TZ_SYS_RW_ICONS/default/small
98
99 SMACK User::App::Shared true
100 $TZ_USER_CAMERA
101 $TZ_USER_DOCUMENTS
102 $TZ_USER_DOWNLOADS
103 $TZ_USER_GAMES
104 $TZ_USER_IMAGES
105 $TZ_USER_OTHERS
106 $TZ_USER_SOUNDS
107 $TZ_USER_MUSIC
108 $TZ_USER_VIDEOS
109 $TZ_USER_SHARE
110 $TZ_USER_CACHE
111 $TZ_USER_CONFIG
112 $TZ_USER_HOME/.pki/nssdb
113 $TZ_USER_APP/xwalk-service
114
115 SMACK System::Shared true
116 $TZ_USER_DESKTOP
117
118 ENDOFCAT
119 while read s1 s2 s3; do
120   case "$s1" in
121     MODE) m="$s2";;
122     SMACK) c="$s2"; t="$s3";;
123     "") ;;
124     *) echo "$s1 ${m:-700} ${c:-_} ${t:-false}";;
125   esac
126 done |
127 LANG=C sort |
128 while read dirname mode context transmute; do
129         mkdir -p -m "$mode" "$dirname"
130         if [ "$transmute" = true ]; then
131                 chsmack -a "$context" -t "$dirname"
132         else
133                 chsmack -a "$context" "$dirname"
134         fi >&2
135 done
136 HOME="$saveHOME"
137 ##############################################
138 # END - setting of predefined directories (also /etc/skel)
139 ##############################################
140
141 %post -n %{libname} -p /sbin/ldconfig
142
143 %postun -n %{libname} -p /sbin/ldconfig
144
145 %files
146 %manifest %{name}.manifest
147 %license MIT
148 %config %{_sysconfdir}/tizen-platform.conf
149
150 %files -n %{libname}
151 %manifest %{name}.manifest
152 %{_libdir}/*.so.*
153
154 %files -n %{libname}-devel
155 %manifest %{name}.manifest
156 %license LGPL_2.0
157 %{_libdir}/*.so
158 %{_libdir}/pkgconfig/*.pc
159 %{_includedir}/*.h
160 %config %{_sysconfdir}/rpm/macros.tizen-platform
161 %{_libdir}/*.a
162
163 %files -n %{name}-tools
164 %manifest %{name}.manifest
165 %{_bindir}/*