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