diff options
Diffstat (limited to 'recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch')
-rw-r--r-- | recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch | 126 |
1 files changed, 75 insertions, 51 deletions
diff --git a/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch b/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch index 70f9fbd2..62b864c1 100644 --- a/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch +++ b/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 124cdabedd4aa0836480942537f6eea67347e80e Mon Sep 17 00:00:00 2001 | 1 | From 5f2d71998eb77068cbaee2d468cbb296a42d5739 Mon Sep 17 00:00:00 2001 |
2 | From: Tom Hochstein <tom.hochstein@nxp.com> | 2 | From: Tom Hochstein <tom.hochstein@nxp.com> |
3 | Date: Wed, 22 Feb 2017 15:53:30 +0200 | 3 | Date: Wed, 22 Feb 2017 15:53:30 +0200 |
4 | Subject: [PATCH] weston-launch: Provide a default version that doesn't require | 4 | Subject: [PATCH] weston-launch: Provide a default version that doesn't require |
@@ -15,46 +15,49 @@ Upstream-Status: Pending | |||
15 | Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> | 15 | Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> |
16 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> | 16 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> |
17 | Signed-off-by: Denys Dmytriyenko <denys@ti.com> | 17 | Signed-off-by: Denys Dmytriyenko <denys@ti.com> |
18 | Signed-off-by: Ming Liu <ming.liu@toradex.com> | ||
18 | 19 | ||
19 | --- | 20 | --- |
20 | configure.ac | 9 +++++++-- | 21 | libweston/meson.build | 16 ++++++++++++---- |
21 | libweston/weston-launch.c | 20 ++++++++++++++++++++ | 22 | libweston/weston-launch.c | 21 +++++++++++++++++++++ |
22 | 2 files changed, 27 insertions(+), 2 deletions(-) | 23 | meson_options.txt | 7 +++++++ |
24 | 3 files changed, 40 insertions(+), 4 deletions(-) | ||
23 | 25 | ||
24 | diff --git a/configure.ac b/configure.ac | 26 | diff --git a/libweston/meson.build b/libweston/meson.build |
25 | index 2396cba5..1f1242bb 100644 | 27 | index 08d23ec..cb9fd3f 100644 |
26 | --- a/configure.ac | 28 | --- a/libweston/meson.build |
27 | +++ b/configure.ac | 29 | +++ b/libweston/meson.build |
28 | @@ -539,13 +539,17 @@ AC_ARG_ENABLE(resize-optimization, | 30 | @@ -216,16 +216,24 @@ dep_vertex_clipping = declare_dependency( |
29 | AS_IF([test "x$enable_resize_optimization" = "xyes"], | 31 | ) |
30 | [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])]) | 32 | |
31 | 33 | if get_option('weston-launch') | |
32 | +AC_ARG_WITH(pam, | 34 | - dep_pam = cc.find_library('pam') |
33 | + AS_HELP_STRING([--with-pam], [Use PAM]), | 35 | + deps_weston_launch = [systemd_dep, dep_libdrm] |
34 | + [use_pam=$withval], [use_pam=yes]) | 36 | |
35 | AC_ARG_ENABLE(weston-launch, [ --enable-weston-launch],, enable_weston_launch=yes) | 37 | - if not cc.has_function('pam_open_session', dependencies: dep_pam) |
36 | AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes) | 38 | - error('pam_open_session not found for weston-launch') |
37 | -if test x$enable_weston_launch = xyes; then | 39 | + if get_option('pam') |
38 | +if test x$enable_weston_launch = xyes -a x$use_pam = xyes; then | 40 | + dep_pam = cc.find_library('pam') |
39 | WESTON_SEARCH_LIBS([PAM], [pam], [pam_open_session], [have_pam=yes], [have_pam=no]) | 41 | + if not cc.has_function('pam_open_session', dependencies: dep_pam) |
40 | if test x$have_pam = xno; then | 42 | + error('pam_open_session not found for weston-launch') |
41 | - AC_ERROR([weston-launch requires pam]) | 43 | + endif |
42 | + AC_ERROR([PAM support is explicitly requested, but libpam couldn't be found]) | 44 | + |
43 | fi | 45 | + if dep_pam.found() |
44 | + AC_DEFINE([HAVE_PAM], [1], [Define if PAM is available]) | 46 | + deps_weston_launch += dep_pam |
45 | fi | 47 | + config_h.set('HAVE_PAM', '1') |
46 | 48 | + endif | |
47 | AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes") | 49 | endif |
48 | @@ -794,6 +798,7 @@ AC_MSG_RESULT([ | 50 | |
49 | Enable developer documentation ${enable_devdocs} | 51 | executable( |
50 | 52 | 'weston-launch', | |
51 | weston-launch utility ${enable_weston_launch} | 53 | 'weston-launch.c', |
52 | + PAM support ${use_pam} | 54 | - dependencies: [dep_pam, systemd_dep, dep_libdrm], |
53 | systemd-login support ${have_systemd_login} | 55 | + dependencies: deps_weston_launch, |
54 | systemd notify support ${enable_systemd_notify} | 56 | include_directories: common_inc, |
55 | 57 | install: true | |
58 | ) | ||
56 | diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c | 59 | diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c |
57 | index bd0015e6..706b80fd 100644 | 60 | index 8a711b4..54c567a 100644 |
58 | --- a/libweston/weston-launch.c | 61 | --- a/libweston/weston-launch.c |
59 | +++ b/libweston/weston-launch.c | 62 | +++ b/libweston/weston-launch.c |
60 | @@ -51,7 +51,9 @@ | 63 | @@ -51,7 +51,9 @@ |
@@ -67,7 +70,7 @@ index bd0015e6..706b80fd 100644 | |||
67 | 70 | ||
68 | #ifdef HAVE_SYSTEMD_LOGIN | 71 | #ifdef HAVE_SYSTEMD_LOGIN |
69 | #include <systemd/sd-login.h> | 72 | #include <systemd/sd-login.h> |
70 | @@ -101,8 +103,10 @@ drmSetMaster(int drm_fd) | 73 | @@ -100,8 +102,10 @@ drmSetMaster(int drm_fd) |
71 | #endif | 74 | #endif |
72 | 75 | ||
73 | struct weston_launch { | 76 | struct weston_launch { |
@@ -78,7 +81,7 @@ index bd0015e6..706b80fd 100644 | |||
78 | int tty; | 81 | int tty; |
79 | int ttynr; | 82 | int ttynr; |
80 | int sock[2]; | 83 | int sock[2]; |
81 | @@ -193,6 +197,7 @@ weston_launch_allowed(struct weston_launch *wl) | 84 | @@ -192,6 +196,7 @@ weston_launch_allowed(struct weston_launch *wl) |
82 | return false; | 85 | return false; |
83 | } | 86 | } |
84 | 87 | ||
@@ -86,7 +89,7 @@ index bd0015e6..706b80fd 100644 | |||
86 | static int | 89 | static int |
87 | pam_conversation_fn(int msg_count, | 90 | pam_conversation_fn(int msg_count, |
88 | const struct pam_message **messages, | 91 | const struct pam_message **messages, |
89 | @@ -233,6 +238,7 @@ setup_pam(struct weston_launch *wl) | 92 | @@ -232,6 +237,7 @@ setup_pam(struct weston_launch *wl) |
90 | 93 | ||
91 | return 0; | 94 | return 0; |
92 | } | 95 | } |
@@ -94,7 +97,7 @@ index bd0015e6..706b80fd 100644 | |||
94 | 97 | ||
95 | static int | 98 | static int |
96 | setup_launcher_socket(struct weston_launch *wl) | 99 | setup_launcher_socket(struct weston_launch *wl) |
97 | @@ -426,6 +432,7 @@ quit(struct weston_launch *wl, int status) | 100 | @@ -431,6 +437,7 @@ quit(struct weston_launch *wl, int status) |
98 | close(wl->signalfd); | 101 | close(wl->signalfd); |
99 | close(wl->sock[0]); | 102 | close(wl->sock[0]); |
100 | 103 | ||
@@ -102,7 +105,7 @@ index bd0015e6..706b80fd 100644 | |||
102 | if (wl->new_user) { | 105 | if (wl->new_user) { |
103 | err = pam_close_session(wl->ph, 0); | 106 | err = pam_close_session(wl->ph, 0); |
104 | if (err) | 107 | if (err) |
105 | @@ -433,6 +440,7 @@ quit(struct weston_launch *wl, int status) | 108 | @@ -438,6 +445,7 @@ quit(struct weston_launch *wl, int status) |
106 | err, pam_strerror(wl->ph, err)); | 109 | err, pam_strerror(wl->ph, err)); |
107 | pam_end(wl->ph, err); | 110 | pam_end(wl->ph, err); |
108 | } | 111 | } |
@@ -110,7 +113,7 @@ index bd0015e6..706b80fd 100644 | |||
110 | 113 | ||
111 | if (ioctl(wl->tty, KDSKBMUTE, 0) && | 114 | if (ioctl(wl->tty, KDSKBMUTE, 0) && |
112 | ioctl(wl->tty, KDSKBMODE, wl->kb_mode)) | 115 | ioctl(wl->tty, KDSKBMODE, wl->kb_mode)) |
113 | @@ -614,6 +622,7 @@ setup_session(struct weston_launch *wl, char **child_argv) | 116 | @@ -666,6 +674,7 @@ setup_session(struct weston_launch *wl, char **child_argv) |
114 | setenv("HOME", wl->pw->pw_dir, 1); | 117 | setenv("HOME", wl->pw->pw_dir, 1); |
115 | setenv("SHELL", wl->pw->pw_shell, 1); | 118 | setenv("SHELL", wl->pw->pw_shell, 1); |
116 | 119 | ||
@@ -118,7 +121,7 @@ index bd0015e6..706b80fd 100644 | |||
118 | env = pam_getenvlist(wl->ph); | 121 | env = pam_getenvlist(wl->ph); |
119 | if (env) { | 122 | if (env) { |
120 | for (i = 0; env[i]; ++i) { | 123 | for (i = 0; env[i]; ++i) { |
121 | @@ -622,6 +631,7 @@ setup_session(struct weston_launch *wl, char **child_argv) | 124 | @@ -674,6 +683,7 @@ setup_session(struct weston_launch *wl, char **child_argv) |
122 | } | 125 | } |
123 | free(env); | 126 | free(env); |
124 | } | 127 | } |
@@ -126,7 +129,7 @@ index bd0015e6..706b80fd 100644 | |||
126 | 129 | ||
127 | /* | 130 | /* |
128 | * We open a new session, so it makes sense | 131 | * We open a new session, so it makes sense |
129 | @@ -689,8 +699,10 @@ static void | 132 | @@ -745,8 +755,10 @@ static void |
130 | help(const char *name) | 133 | help(const char *name) |
131 | { | 134 | { |
132 | fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name); | 135 | fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name); |
@@ -137,7 +140,7 @@ index bd0015e6..706b80fd 100644 | |||
137 | fprintf(stderr, " -t, --tty Start session on alternative tty,\n" | 140 | fprintf(stderr, " -t, --tty Start session on alternative tty,\n" |
138 | " e.g. -t /dev/tty4, requires -u option.\n"); | 141 | " e.g. -t /dev/tty4, requires -u option.\n"); |
139 | fprintf(stderr, " -v, --verbose Be verbose\n"); | 142 | fprintf(stderr, " -v, --verbose Be verbose\n"); |
140 | @@ -704,7 +716,9 @@ main(int argc, char *argv[]) | 143 | @@ -760,7 +772,9 @@ main(int argc, char *argv[]) |
141 | int i, c; | 144 | int i, c; |
142 | char *tty = NULL; | 145 | char *tty = NULL; |
143 | struct option opts[] = { | 146 | struct option opts[] = { |
@@ -147,21 +150,24 @@ index bd0015e6..706b80fd 100644 | |||
147 | { "tty", required_argument, NULL, 't' }, | 150 | { "tty", required_argument, NULL, 't' }, |
148 | { "verbose", no_argument, NULL, 'v' }, | 151 | { "verbose", no_argument, NULL, 'v' }, |
149 | { "help", no_argument, NULL, 'h' }, | 152 | { "help", no_argument, NULL, 'h' }, |
150 | @@ -716,9 +730,13 @@ main(int argc, char *argv[]) | 153 | @@ -772,11 +786,16 @@ main(int argc, char *argv[]) |
151 | while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) { | 154 | while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) { |
152 | switch (c) { | 155 | switch (c) { |
153 | case 'u': | 156 | case 'u': |
154 | +#ifdef HAVE_PAM | 157 | +#ifdef HAVE_PAM |
155 | wl.new_user = optarg; | 158 | wl.new_user = optarg; |
156 | if (getuid() != 0) | 159 | if (getuid() != 0) { |
157 | error(1, 0, "Permission denied. -u allowed for root only"); | 160 | fprintf(stderr, "weston: Permission denied. -u allowed for root only\n"); |
161 | exit(EXIT_FAILURE); | ||
162 | } | ||
158 | +#else | 163 | +#else |
159 | + error(1, 0, "-u is unsupported in this weston-launch build"); | 164 | + fprintf(stderr, "weston: -u is unsupported in this weston-launch build\n"); |
165 | + exit(EXIT_FAILURE); | ||
160 | +#endif | 166 | +#endif |
161 | break; | 167 | break; |
162 | case 't': | 168 | case 't': |
163 | tty = optarg; | 169 | tty = optarg; |
164 | @@ -759,8 +777,10 @@ main(int argc, char *argv[]) | 170 | @@ -828,8 +847,10 @@ main(int argc, char *argv[]) |
165 | if (setup_tty(&wl, tty) < 0) | 171 | if (setup_tty(&wl, tty) < 0) |
166 | exit(EXIT_FAILURE); | 172 | exit(EXIT_FAILURE); |
167 | 173 | ||
@@ -172,3 +178,21 @@ index bd0015e6..706b80fd 100644 | |||
172 | 178 | ||
173 | if (setup_launcher_socket(&wl) < 0) | 179 | if (setup_launcher_socket(&wl) < 0) |
174 | exit(EXIT_FAILURE); | 180 | exit(EXIT_FAILURE); |
181 | diff --git a/meson_options.txt b/meson_options.txt | ||
182 | index c862ecc..73ef2c3 100644 | ||
183 | --- a/meson_options.txt | ||
184 | +++ b/meson_options.txt | ||
185 | @@ -73,6 +73,13 @@ option( | ||
186 | ) | ||
187 | |||
188 | option( | ||
189 | + 'pam', | ||
190 | + type: 'boolean', | ||
191 | + value: true, | ||
192 | + description: 'Define if PAM is available' | ||
193 | +) | ||
194 | + | ||
195 | +option( | ||
196 | 'xwayland', | ||
197 | type: 'boolean', | ||
198 | value: true, | ||