ec871bf15c1ca983fc5bb75c85f774bac0b44a99
[scm/bb/meta-tizen.git] / meta-tizen-ivi / meta-tizen-common-demo / recipes-graphics / weston-common / weston-common.inc
1 DESCRIPTION = "Tizen Common Weston configuration and set-up"
2 HOMEPAGE = "http://nohomepage.org"
3 SECTION = "Base/Configuration"
4 LICENSE = "MIT"
5 PV = "1"
6
7 SRC_URI = ""
8
9 S = "${WORKDIR}/git"
10
11 inherit manifest autotools-brokensep
12
13 BBCLASSEXTEND = ""
14 PROVIDES = ""
15
16 #PROVIDES by weston-common
17 # the PROVIDES rules is ignore "weston-startup  "
18 PROVIDES += "weston-startup"
19 RPROVIDES_weston-common += "weston-startup"
20
21
22 #PROVIDES by weston-common-config
23 PROVIDES += "weston-common-config"
24
25
26 #PROVIDES by weston-common-qa-plugin
27 PROVIDES += "weston-common-qa-plugin"
28
29
30 #PROVIDES by weston-common-tz-launcher
31 PROVIDES += "weston-common-tz-launcher"
32
33
34 RDEPENDS = ""
35 #RDEPENDS of weston-common (${PN})
36 RDEPENDS_${PN} += "weston"
37 RDEPENDS_${PN} += "glibc"
38 RDEPENDS_${PN} += "shadow"
39
40
41 DEPENDS = ""
42 #DEPENDS of weston-common
43 DEPENDS += "weston"
44 DEPENDS += "virtual/egl"
45 DEPENDS += "libxkbcommon"
46 DEPENDS += "libjpeg-turbo"
47 DEPENDS += "glib-2.0"
48 inherit pkgconfig
49 DEPENDS_append_class-native = " automake-native"
50 DEPENDS_append_class-target = " automake-native"
51 DEPENDS += "xz"
52 DEPENDS += "wayland"
53 DEPENDS_append_class-native = " libtool"
54 DEPENDS_append_class-target = " libtool-cross"
55 DEPENDS += "cairo"
56 DEPENDS += "libpng"
57 DEPENDS_append_class-native = " autoconf-native"
58 DEPENDS_append_class-target = " autoconf-native"
59 DEPENDS += "vconf"
60 DEPENDS += "virtual/libgles2"
61 DEPENDS += "pixman"
62
63 do_prep() {
64  cd ${S}
65  chmod -Rf a+rX,u+w,g-w,o-w ${S}
66  #setup -q
67  cp ${S}/packaging/weston-common.manifest .
68  
69  
70 }
71 do_patch_append() {
72     bb.build.exec_func('do_prep', d)
73 }
74
75 do_configure() {
76 }
77
78 do_compile() {
79  cd ${S}
80   LANG=C
81   export LANG
82   unset DISPLAY
83   LD_AS_NEEDED=1; export LD_AS_NEEDED ;
84   
85   
86   autotools_do_configure
87   make -j16
88   
89   
90   
91 }
92 EXTRA_OECONF += ""
93
94 do_install() {
95  export RPM_BUILD_ROOT=${D}
96  cd ${S}
97  LANG=C
98  export LANG
99  unset DISPLAY
100  rm -rf ${D}
101  mkdir -p ${D}
102  
103  
104  #install tz-launcher
105  
106    oe_runmake \
107          DESTDIR=${D} \
108          INSTALL_ROOT=${D} \
109          BINDIR=${prefix}/bin \
110    install  
111    rm -f ${D}${infodir}/dir 
112    find ${D} -regex ".*\.la$" | xargs rm -f -- 
113    find ${D} -regex ".*\.a$" | xargs rm -f --
114  
115  # install weston service as 'display-manager.service' as it's the one wanted by graphical.target
116  mkdir -p ${D}${systemd_unitdir}/system
117  install -m 644 display-manager-run.service ${D}${systemd_unitdir}/system/display-manager-run.service
118  install -m 644 display-manager.service ${D}${systemd_unitdir}/system/display-manager.service
119  install -m 644 display-manager.path ${D}${systemd_unitdir}/system/display-manager.path
120  
121  # install Environment file for weston service and weston-user.service
122  mkdir -p ${D}${sysconfdir}/sysconfig
123  install -m 0644 weston.sysconfig ${D}${sysconfdir}/sysconfig/weston
124  install -m 0644 weston-user.sysconfig ${D}${sysconfdir}/sysconfig/weston-user
125  
126  # install tmpfiles.d(5) conf
127  mkdir -p ${D}${prefix}/lib/tmpfiles.d
128  install -m 0644 weston_tmpfiles.conf ${D}${prefix}/lib/tmpfiles.d/weston.conf
129  
130  # install weston-user service in user session
131  mkdir -p ${D}${prefix}/lib/systemd/user
132  install -m 644 weston-user.service ${D}${prefix}/lib/systemd/user/
133  
134  # install weston.sh
135  mkdir -p ${D}${sysconfdir}/profile.d/
136  install -m 0644 weston.sh ${D}${sysconfdir}/profile.d/
137  
138  # install weston.ini
139  mkdir -p ${D}${sysconfdir}/xdg/weston
140  install -m 0644 weston.ini ${D}${sysconfdir}/xdg/weston
141  
142  # Add a rule to ensure the 'display' user has permissions to
143  # open the graphics device
144  mkdir -p ${D}${sysconfdir}/udev/rules.d
145  cat >${D}${sysconfdir}/udev/rules.d/99-dri.rules <<'EOF'
146  SUBSYSTEM=="drm", MODE="0660", GROUP="display", SECLABEL{smack}="*"
147 EOF
148  
149  # user 'display' must own /dev/tty7 for weston to start correctly
150  cat >${D}${sysconfdir}/udev/rules.d/99-tty.rules <<'EOF'
151  SUBSYSTEM=="tty", KERNEL=="tty7", OWNER="display", SECLABEL{smack}="^"
152 EOF
153  
154  # user 'display' must also be able to access /dev/input/*
155  cat >${D}${sysconfdir}/udev/rules.d/99-input.rules <<'EOF'
156  SUBSYSTEM=="input", MODE="0660", GROUP="input", SECLABEL{smack}="^"
157 EOF
158  
159  # install desktop file
160  mkdir -p ${D}${prefix}/share/applications
161  install -m 0644 weston-terminal.desktop ${D}${prefix}/share/applications
162  
163  
164 }
165
166 pkg_preinst_${PN}() {
167     #!/bin/sh -e
168
169     # create groups 'display' and 'weston-launch'
170     getent group display >/dev/null || $D${prefix}/sbin/groupadd -r -o display
171     getent group input >/dev/null || $D${prefix}/sbin/groupadd -r -o input
172     getent group weston-launch >/dev/null || $D${prefix}/sbin/groupadd -r -o weston-launch
173     # create user 'display'
174     getent passwd display >/dev/null || $D${prefix}/sbin/useradd -r -g display -d /run/display -s /bin/false -c "Display daemon" display
175     # add user 'display' to groups 'weston-launch', 'input' and 'video'
176     groupmod -A display weston-launch
177     groupmod -A display input
178     groupmod -A display video
179     # setup display manager service
180     mkdir -p $D${systemd_unitdir}/system/graphical.target.wants/
181     ln -sf ../display-manager.path  $D${systemd_unitdir}/system/graphical.target.wants/
182
183 }
184
185 pkg_postrm_${PN}() {
186     #!/bin/sh -e
187
188     rm -f $D${systemd_unitdir}/system/graphical.target.wants/display-manager.path
189
190 }
191
192 PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
193 PACKAGES += " weston-common-tz-launcher "
194 PACKAGES += " weston-common-config "
195 PACKAGES += " weston-common-qa-plugin "
196 PACKAGES += " weston-common "
197
198 weston-common-tz-launcher_files = ""
199 weston-common-tz-launcher_files += "${prefix}/bin/tz-launcher"
200 weston-common-tz-launcher_files += "${prefix}/bin/wl-pre"
201 MANIFESTFILES_${PN}-tz-launcher = "weston-common.manifest"
202
203 weston-common-config_files = ""
204 weston-common-config_files += "${sysconfdir}/xdg/weston/weston.ini"
205 CONFFILES_${PN}-config = ""
206 CONFFILES_${PN}-config += "${sysconfdir}/xdg/weston/weston.ini"
207 MANIFESTFILES_${PN}-config = "weston-common.manifest"
208
209 weston-common-qa-plugin_files = ""
210 weston-common-qa-plugin_files += "${prefix}/bin/weston-qa-client"
211 weston-common-qa-plugin_files += "${prefix}/lib/weston/qa-plugin.so"
212 MANIFESTFILES_${PN}-qa-plugin = "weston-common.manifest"
213
214 weston-common_files = ""
215 weston-common_files += "${systemd_unitdir}/system/display-manager-run.service"
216 weston-common_files += "${systemd_unitdir}/system/display-manager.service"
217 weston-common_files += "${systemd_unitdir}/system/display-manager.path"
218 weston-common_files += "${sysconfdir}/sysconfig/*"
219 weston-common_files += "${prefix}/lib/tmpfiles.d/weston.conf"
220 weston-common_files += "${prefix}/lib/systemd/user/weston-user.service"
221 weston-common_files += "${sysconfdir}/profile.d/*"
222 weston-common_files += "${sysconfdir}/udev/rules.d/*"
223 weston-common_files += "${prefix}/share/applications/*.desktop"
224 CONFFILES_${PN} = ""
225 CONFFILES_${PN} += "${sysconfdir}/sysconfig/*"
226 CONFFILES_${PN} += "${sysconfdir}/profile.d/*"
227 CONFFILES_${PN} += "${sysconfdir}/udev/rules.d/*"
228 MANIFESTFILES_${PN} = "weston-common.manifest"
229
230 FILES_${PN}-tz-launcher = "${weston-common-tz-launcher_files}"
231 FILES_${PN}-config = "${weston-common-config_files}"
232 FILES_${PN}-qa-plugin = "${weston-common-qa-plugin_files}"
233 FILES_${PN} = "${weston-common_files}"
234
235 PKG_weston-common-tz-launcher= "weston-common-tz-launcher"
236 PKG_weston-common-config= "weston-common-config"
237 PKG_weston-common-qa-plugin= "weston-common-qa-plugin"
238 PKG_weston-common= "weston-common"
239
240 require weston-common-extraconf.inc
241