summaryrefslogtreecommitdiff
path: root/packaging/tizen-platform-config.spec
blob: abaccaa03e8b0419402bf050de192f9d8f0ff7e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
%define libname libtzplatform-config
%define keepstatic 1

Name:           tizen-platform-config
Version:        4.0
Release:        1
Summary:        Tizen Platform Configuration
License:        MIT
Url:            http://www.tizen.org
Group:          System/Configuration
Source0:        %{name}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc
Source1001:     %{name}.manifest
Source1002:     201.tizen-platform-config_upgrade.sh
Source2001:     200.filesystem-pre.patch.sh
Source2002:     799.filesystem-post.patch.sh
BuildRequires:  tizen-platform-wrapper >= 2
BuildRequires:  tizen-platform-config-meta
Requires(post): smack
Requires(post): coreutils

# the main package only contains a config file but other dependent packages
# will contain binary. So, we can't build a noarch package and have to avoid
# a rpmlint warning using a filter in xxx-rpmlintrc

%description
Tizen Platform Configuration - variables definitions

%package -n %{libname}
Summary:        Tizen Platform Configuration - helper library
Group:          System/Libraries
License:        LGPL-2.0
Requires:       %{name} = %{version}
%description -n %{libname}
Tizen Platform Configuration - helper library to lookup Tizen variables easily

%package -n %{libname}-devel
Summary:        Tizen Platform Configuration - helper libray headers, RPM macros
Group:          Development/Libraries
License:        LGPL-2.0
Requires:       %{libname} = %{version}
%description -n %{libname}-devel
Tizen Platform Configuration - helper library headers to include in source code,
RPM macros to call in spec files

%package -n %{name}-tools
Summary:        Tizen Platform Configuration - tools
Group:          System/Utilities
License:        LGPL-2.0
Requires:       %{libname} = %{version}
%description -n %{name}-tools
Tizen Platform Configuration - helper program to lookup Tizen variables easily

%prep
%setup -q
cp %{SOURCE1001} .

%build
%reconfigure --enable-static
%__make %{?_smp_mflags}

%check
%__make check

%install
%make_install
install -m 755 %{SOURCE1002} -D %{buildroot}%{_datadir}/upgrade/scripts/201.tizen-platform-config_upgrade.sh
install -m 755 %{SOURCE2001} -D %{buildroot}%{_datadir}/upgrade/scripts/200.filesystem-pre.patch.sh
install -m 755 %{SOURCE2002} -D %{buildroot}%{_datadir}/upgrade/scripts/799.filesystem-post.patch.sh
rm %{buildroot}%{_libdir}/*.a

%post
##############################################
# BEGIN - setting of predefined directories (also /etc/skel)
##############################################
saveHOME="$HOME"
HOME="/opt/etc/skel"
. "%{_sysconfdir}/tizen-platform.conf"
cat << ENDOFCAT |
MODE 755
SMACK System::Shared true
$TZ_SYS_STORAGE
$TZ_SYS_MEDIA

MODE 700
SMACK _ true
$TZ_USER_HOME

SMACK User::Home true
$TZ_USER_APPROOT
$TZ_USER_DB
$TZ_USER_PACKAGES
$TZ_USER_ICONS
$TZ_USER_APP

MODE 775
SMACK User::Home false
$TZ_SYS_DB
$TZ_SYS_RO_PACKAGES
$TZ_SYS_RO_APP
$TZ_SYS_RW_PACKAGES
$TZ_SYS_RW_APP

MODE 775
SMACK User::Home true
$TZ_SYS_RW_ICONS
$TZ_SYS_RW_ICONS/default
$TZ_SYS_RW_ICONS/default/small

SMACK User::App::Shared true
$TZ_USER_CONTENT
$TZ_USER_CAMERA
$TZ_USER_DOCUMENTS
$TZ_USER_DOWNLOADS
$TZ_USER_GAMES
$TZ_USER_IMAGES
$TZ_USER_OTHERS
$TZ_USER_SOUNDS
$TZ_USER_MUSIC
$TZ_USER_VIDEOS
$TZ_USER_SHARE
$TZ_USER_CACHE
$TZ_USER_CONFIG
$TZ_USER_DATA
$TZ_USER_HOME/.pki/nssdb
$TZ_USER_APP/xwalk-service

SMACK System::Shared true
$TZ_USER_DESKTOP

SMACK System::Shared false
$TZ_SYS_ETC

ENDOFCAT
while read s1 s2 s3; do
  case "$s1" in
    MODE) m="$s2";;
    SMACK) c="$s2"; t="$s3";;
    "") ;;
    *) echo "$s1 ${m:-700} ${c:-_} ${t:-false}";;
  esac
done |
LANG=C sort |
while read dirname mode context transmute; do
        if [ -e "$dirname" ]; then
                chmod "$mode" "$dirname"
        else
                mkdir -p -m "$mode" "$dirname"
        fi
        if [ "$transmute" = true ]; then
                chsmack -a "$context" -t "$dirname"
        else
                chsmack -a "$context" "$dirname"
        fi >&2
done
HOME="$saveHOME"
##############################################
# END - setting of predefined directories (also /etc/skel)
##############################################

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%files
%manifest %{name}.manifest
%license LICENSE
%config %{_sysconfdir}/tizen-platform.conf
%{_datadir}/upgrade/scripts/*

%files -n %{libname}
%manifest %{name}.manifest
%{_libdir}/*.so.*

%files -n %{libname}-devel
%manifest %{name}.manifest
%license LICENSE
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/*.h
%config %{_sysconfdir}/rpm/macros.tizen-platform

%files -n %{name}-tools
%manifest %{name}.manifest
%{_bindir}/*