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