diff options
| author | Koen Kooi <koen@dominion.thruhere.net> | 2011-06-20 21:18:40 +0200 |
|---|---|---|
| committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-06-20 21:18:40 +0200 |
| commit | 73573117d078ac1cc7f31c21d4ac2a4c0e5da574 (patch) | |
| tree | 4ba6232eb779dde106faac7d202bda340dca13e1 | |
| parent | 9fce693d6c393f532795bbc03e854dacce78c429 (diff) | |
| download | meta-openembedded-73573117d078ac1cc7f31c21d4ac2a4c0e5da574.tar.gz | |
slim: add 1.3.2
1.3.1 was imported from OE rev 58b79786c6b1ee26340b20e7606d2144f52543ed, but heavily cleaned
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
13 files changed, 953 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/slim/slim/0002-Fix-image-handling-integer-overflows.patch b/meta-oe/recipes-graphics/slim/slim/0002-Fix-image-handling-integer-overflows.patch new file mode 100644 index 0000000000..de82d63033 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0002-Fix-image-handling-integer-overflows.patch | |||
| @@ -0,0 +1,343 @@ | |||
| 1 | From 24e548a222f0aab4313d5ba8b04f0840b173000f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Mon, 30 Aug 2010 01:24:54 +0000 | ||
| 4 | Subject: [PATCH 2/8] Fix image handling integer overflows | ||
| 5 | |||
| 6 | Image loading memory allocation is based on the image width and height: | ||
| 7 | malloc(heigth * width * 3). Providing an image with large height and | ||
| 8 | width values can cause the result of this calculation to exceed the | ||
| 9 | maximum value of an unsigned int and thus causes an integer overflow. | ||
| 10 | The result: too little memory is allocated and an heap overflow occurs. | ||
| 11 | |||
| 12 | This patch was based by Niels Heinen <niels@freebsd.org> | ||
| 13 | Thanks! | ||
| 14 | |||
| 15 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 16 | |||
| 17 | git-svn-id: svn://svn.berlios.de/slim/trunk@176 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 18 | --- | ||
| 19 | const.h | 3 ++ | ||
| 20 | jpeg.c | 51 +++++++++++++++----------- | ||
| 21 | png.c | 122 ++++++++++++++++++++++++++++++++------------------------------ | ||
| 22 | 3 files changed, 96 insertions(+), 80 deletions(-) | ||
| 23 | |||
| 24 | diff --git a/const.h b/const.h | ||
| 25 | index df0989c..a18c6f3 100644 | ||
| 26 | --- a/const.h | ||
| 27 | +++ b/const.h | ||
| 28 | @@ -42,4 +42,7 @@ | ||
| 29 | // variables replaced in pre-session_cmd and post-session_cmd | ||
| 30 | #define USER_VAR "%user" | ||
| 31 | |||
| 32 | +// max height/width for images | ||
| 33 | +#define MAX_DIMENSION 10000 | ||
| 34 | + | ||
| 35 | #endif | ||
| 36 | diff --git a/jpeg.c b/jpeg.c | ||
| 37 | index 1cf106c..e1f8352 100644 | ||
| 38 | --- a/jpeg.c | ||
| 39 | +++ b/jpeg.c | ||
| 40 | @@ -22,16 +22,22 @@ | ||
| 41 | #include <string.h> | ||
| 42 | |||
| 43 | #include <jpeglib.h> | ||
| 44 | +#include "const.h" | ||
| 45 | |||
| 46 | int | ||
| 47 | read_jpeg(const char *filename, int *width, int *height, unsigned char **rgb) | ||
| 48 | { | ||
| 49 | + int ret = 0; | ||
| 50 | struct jpeg_decompress_struct cinfo; | ||
| 51 | struct jpeg_error_mgr jerr; | ||
| 52 | unsigned char *ptr = NULL; | ||
| 53 | unsigned int i, ipos; | ||
| 54 | |||
| 55 | FILE *infile = fopen(filename, "rb"); | ||
| 56 | + if (infile == NULL) { | ||
| 57 | + fprintf(stderr, "Can not fopen file: %s\n",filename); | ||
| 58 | + return ret; | ||
| 59 | + } | ||
| 60 | |||
| 61 | cinfo.err = jpeg_std_error(&jerr); | ||
| 62 | jpeg_create_decompress(&cinfo); | ||
| 63 | @@ -39,43 +45,39 @@ read_jpeg(const char *filename, int *width, int *height, unsigned char **rgb) | ||
| 64 | jpeg_read_header(&cinfo, TRUE); | ||
| 65 | jpeg_start_decompress(&cinfo); | ||
| 66 | |||
| 67 | + /* Prevent against integer overflow */ | ||
| 68 | + if(cinfo.output_width >= MAX_DIMENSION || cinfo.output_height >= MAX_DIMENSION) { | ||
| 69 | + fprintf(stderr, "Unreasonable dimension found in file: %s\n",filename); | ||
| 70 | + goto close_file; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | *width = cinfo.output_width; | ||
| 74 | *height = cinfo.output_height; | ||
| 75 | |||
| 76 | rgb[0] = malloc(3 * cinfo.output_width * cinfo.output_height); | ||
| 77 | - if (rgb[0] == NULL) | ||
| 78 | - { | ||
| 79 | + if (rgb[0] == NULL) { | ||
| 80 | fprintf(stderr, "Can't allocate memory for JPEG file.\n"); | ||
| 81 | - fclose(infile); | ||
| 82 | - return(0); | ||
| 83 | + goto close_file; | ||
| 84 | } | ||
| 85 | |||
| 86 | - if (cinfo.output_components == 3) | ||
| 87 | - { | ||
| 88 | + if (cinfo.output_components == 3) { | ||
| 89 | ptr = rgb[0]; | ||
| 90 | - while (cinfo.output_scanline < cinfo.output_height) | ||
| 91 | - { | ||
| 92 | + while (cinfo.output_scanline < cinfo.output_height) { | ||
| 93 | jpeg_read_scanlines(&cinfo, &ptr, 1); | ||
| 94 | ptr += 3 * cinfo.output_width; | ||
| 95 | } | ||
| 96 | - } | ||
| 97 | - else if (cinfo.output_components == 1) | ||
| 98 | - { | ||
| 99 | + } else if (cinfo.output_components == 1) { | ||
| 100 | ptr = malloc(cinfo.output_width); | ||
| 101 | - if (ptr == NULL) | ||
| 102 | - { | ||
| 103 | + if (ptr == NULL) { | ||
| 104 | fprintf(stderr, "Can't allocate memory for JPEG file.\n"); | ||
| 105 | - fclose(infile); | ||
| 106 | - return(0); | ||
| 107 | + goto rgb_free; | ||
| 108 | } | ||
| 109 | |||
| 110 | ipos = 0; | ||
| 111 | - while (cinfo.output_scanline < cinfo.output_height) | ||
| 112 | - { | ||
| 113 | + while (cinfo.output_scanline < cinfo.output_height) { | ||
| 114 | jpeg_read_scanlines(&cinfo, &ptr, 1); | ||
| 115 | |||
| 116 | - for (i = 0; i < cinfo.output_width; i++) | ||
| 117 | - { | ||
| 118 | + for (i = 0; i < cinfo.output_width; i++) { | ||
| 119 | memset(rgb[0] + ipos, ptr[i], 3); | ||
| 120 | ipos += 3; | ||
| 121 | } | ||
| 122 | @@ -85,9 +87,16 @@ read_jpeg(const char *filename, int *width, int *height, unsigned char **rgb) | ||
| 123 | } | ||
| 124 | |||
| 125 | jpeg_finish_decompress(&cinfo); | ||
| 126 | - jpeg_destroy_decompress(&cinfo); | ||
| 127 | |||
| 128 | + ret = 1; | ||
| 129 | + goto close_file; | ||
| 130 | + | ||
| 131 | +rgb_free: | ||
| 132 | + free(rgb[0]); | ||
| 133 | + | ||
| 134 | +close_file: | ||
| 135 | + jpeg_destroy_decompress(&cinfo); | ||
| 136 | fclose(infile); | ||
| 137 | |||
| 138 | - return(1); | ||
| 139 | + return(ret); | ||
| 140 | } | ||
| 141 | diff --git a/png.c b/png.c | ||
| 142 | index a2661c6..5c086c6 100644 | ||
| 143 | --- a/png.c | ||
| 144 | +++ b/png.c | ||
| 145 | @@ -22,12 +22,13 @@ | ||
| 146 | #include <stdlib.h> | ||
| 147 | |||
| 148 | #include <png.h> | ||
| 149 | +#include "const.h" | ||
| 150 | |||
| 151 | int | ||
| 152 | read_png(const char *filename, int *width, int *height, unsigned char **rgb, | ||
| 153 | unsigned char **alpha) | ||
| 154 | { | ||
| 155 | - FILE *infile = fopen(filename, "rb"); | ||
| 156 | + int ret = 0; | ||
| 157 | |||
| 158 | png_structp png_ptr; | ||
| 159 | png_infop info_ptr; | ||
| 160 | @@ -38,31 +39,27 @@ read_png(const char *filename, int *width, int *height, unsigned char **rgb, | ||
| 161 | int bit_depth, color_type, interlace_type; | ||
| 162 | int i; | ||
| 163 | |||
| 164 | + FILE *infile = fopen(filename, "rb"); | ||
| 165 | + if (infile == NULL) { | ||
| 166 | + fprintf(stderr, "Can not fopen file: %s\n",filename); | ||
| 167 | + return ret; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, | ||
| 171 | (png_voidp) NULL, | ||
| 172 | (png_error_ptr) NULL, | ||
| 173 | (png_error_ptr) NULL); | ||
| 174 | - if (!png_ptr) | ||
| 175 | - { | ||
| 176 | - fclose(infile); | ||
| 177 | - return(0); | ||
| 178 | - } | ||
| 179 | + if (!png_ptr) | ||
| 180 | + goto file_close; | ||
| 181 | |||
| 182 | info_ptr = png_create_info_struct(png_ptr); | ||
| 183 | - if (!info_ptr) | ||
| 184 | - { | ||
| 185 | + if (!info_ptr) { | ||
| 186 | png_destroy_read_struct(&png_ptr, (png_infopp) NULL, | ||
| 187 | (png_infopp) NULL); | ||
| 188 | - fclose(infile); | ||
| 189 | - return(0); | ||
| 190 | } | ||
| 191 | |||
| 192 | if (setjmp(png_ptr->jmpbuf)) | ||
| 193 | - { | ||
| 194 | - png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); | ||
| 195 | - fclose(infile); | ||
| 196 | - return(0); | ||
| 197 | - } | ||
| 198 | + goto png_destroy; | ||
| 199 | |||
| 200 | png_init_io(png_ptr, infile); | ||
| 201 | png_read_info(png_ptr, info_ptr); | ||
| 202 | @@ -70,18 +67,23 @@ read_png(const char *filename, int *width, int *height, unsigned char **rgb, | ||
| 203 | png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type, | ||
| 204 | &interlace_type, (int *) NULL, (int *) NULL); | ||
| 205 | |||
| 206 | + /* Prevent against integer overflow */ | ||
| 207 | + if(w >= MAX_DIMENSION || h >= MAX_DIMENSION) { | ||
| 208 | + fprintf(stderr, "Unreasonable dimension found in file: %s\n",filename); | ||
| 209 | + goto png_destroy; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | *width = (int) w; | ||
| 213 | *height = (int) h; | ||
| 214 | |||
| 215 | if (color_type == PNG_COLOR_TYPE_RGB_ALPHA | ||
| 216 | - || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) | ||
| 217 | - { | ||
| 218 | - alpha[0] = malloc(*width * *height); | ||
| 219 | - if (alpha[0] == NULL) | ||
| 220 | - { | ||
| 221 | - fprintf(stderr, "Can't allocate memory for alpha channel in PNG file.\n"); | ||
| 222 | - return(0); | ||
| 223 | - } | ||
| 224 | + || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { | ||
| 225 | + alpha[0] = malloc(*width * *height); | ||
| 226 | + if (alpha[0] == NULL) | ||
| 227 | + { | ||
| 228 | + fprintf(stderr, "Can't allocate memory for alpha channel in PNG file.\n"); | ||
| 229 | + goto png_destroy; | ||
| 230 | + } | ||
| 231 | } | ||
| 232 | |||
| 233 | /* Change a paletted/grayscale image to RGB */ | ||
| 234 | @@ -94,68 +96,70 @@ read_png(const char *filename, int *width, int *height, unsigned char **rgb, | ||
| 235 | png_set_gray_to_rgb(png_ptr); | ||
| 236 | |||
| 237 | /* If the PNG file has 16 bits per channel, strip them down to 8 */ | ||
| 238 | - if (bit_depth == 16) png_set_strip_16(png_ptr); | ||
| 239 | + if (bit_depth == 16) | ||
| 240 | + png_set_strip_16(png_ptr); | ||
| 241 | |||
| 242 | /* use 1 byte per pixel */ | ||
| 243 | png_set_packing(png_ptr); | ||
| 244 | |||
| 245 | row_pointers = malloc(*height * sizeof(png_bytep)); | ||
| 246 | - if (row_pointers == NULL) | ||
| 247 | - { | ||
| 248 | + if (row_pointers == NULL) { | ||
| 249 | fprintf(stderr, "Can't allocate memory for PNG file.\n"); | ||
| 250 | - return(0); | ||
| 251 | + goto png_destroy; | ||
| 252 | } | ||
| 253 | |||
| 254 | - for (i = 0; i < *height; i++) | ||
| 255 | - { | ||
| 256 | + for (i = 0; i < *height; i++) { | ||
| 257 | row_pointers[i] = malloc(4 * *width); | ||
| 258 | - if (row_pointers == NULL) | ||
| 259 | - { | ||
| 260 | + if (row_pointers == NULL) { | ||
| 261 | fprintf(stderr, "Can't allocate memory for PNG line.\n"); | ||
| 262 | - return(0); | ||
| 263 | + goto rows_free; | ||
| 264 | } | ||
| 265 | } | ||
| 266 | |||
| 267 | png_read_image(png_ptr, row_pointers); | ||
| 268 | |||
| 269 | rgb[0] = malloc(3 * *width * *height); | ||
| 270 | - if (rgb[0] == NULL) | ||
| 271 | - { | ||
| 272 | + if (rgb[0] == NULL) { | ||
| 273 | fprintf(stderr, "Can't allocate memory for PNG file.\n"); | ||
| 274 | - return(0); | ||
| 275 | + goto rows_free; | ||
| 276 | } | ||
| 277 | |||
| 278 | if (alpha[0] == NULL) | ||
| 279 | { | ||
| 280 | - ptr = rgb[0]; | ||
| 281 | - for (i = 0; i < *height; i++) | ||
| 282 | - { | ||
| 283 | - memcpy(ptr, row_pointers[i], 3 * *width); | ||
| 284 | - ptr += 3 * *width; | ||
| 285 | - } | ||
| 286 | - } | ||
| 287 | - else | ||
| 288 | - { | ||
| 289 | - int j; | ||
| 290 | - ptr = rgb[0]; | ||
| 291 | - for (i = 0; i < *height; i++) | ||
| 292 | - { | ||
| 293 | - int ipos = 0; | ||
| 294 | - for (j = 0; j < *width; j++) | ||
| 295 | - { | ||
| 296 | - *ptr++ = row_pointers[i][ipos++]; | ||
| 297 | - *ptr++ = row_pointers[i][ipos++]; | ||
| 298 | - *ptr++ = row_pointers[i][ipos++]; | ||
| 299 | - alpha[0][i * *width + j] = row_pointers[i][ipos++]; | ||
| 300 | + ptr = rgb[0]; | ||
| 301 | + for (i = 0; i < *height; i++) { | ||
| 302 | + memcpy(ptr, row_pointers[i], 3 * *width); | ||
| 303 | + ptr += 3 * *width; | ||
| 304 | + } | ||
| 305 | + } else { | ||
| 306 | + int j; | ||
| 307 | + ptr = rgb[0]; | ||
| 308 | + for (i = 0; i < *height; i++) { | ||
| 309 | + int ipos = 0; | ||
| 310 | + for (j = 0; j < *width; j++) { | ||
| 311 | + *ptr++ = row_pointers[i][ipos++]; | ||
| 312 | + *ptr++ = row_pointers[i][ipos++]; | ||
| 313 | + *ptr++ = row_pointers[i][ipos++]; | ||
| 314 | + alpha[0][i * *width + j] = row_pointers[i][ipos++]; | ||
| 315 | + } | ||
| 316 | } | ||
| 317 | - } | ||
| 318 | } | ||
| 319 | |||
| 320 | - png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); | ||
| 321 | + ret = 1; /* data reading is OK */ | ||
| 322 | + | ||
| 323 | +rows_free: | ||
| 324 | + for (i = 0; i < *height; i++) { | ||
| 325 | + if (row_pointers[i] != NULL ) { | ||
| 326 | + free(row_pointers[i]); | ||
| 327 | + } | ||
| 328 | + } | ||
| 329 | |||
| 330 | - for (i = 0; i < *height; i++) free(row_pointers[i]); | ||
| 331 | free(row_pointers); | ||
| 332 | |||
| 333 | +png_destroy: | ||
| 334 | + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); | ||
| 335 | + | ||
| 336 | +file_close: | ||
| 337 | fclose(infile); | ||
| 338 | - return(1); | ||
| 339 | + return(ret); | ||
| 340 | } | ||
| 341 | -- | ||
| 342 | 1.6.6.1 | ||
| 343 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/0003-Fix-build-failure-with-ld-as-needed.patch b/meta-oe/recipes-graphics/slim/slim/0003-Fix-build-failure-with-ld-as-needed.patch new file mode 100644 index 0000000000..471c4f51e5 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0003-Fix-build-failure-with-ld-as-needed.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From 6aad913ddd5cdb473db9fa21a5e8ecec58de172b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Wed, 12 Jan 2011 04:41:02 +0000 | ||
| 4 | Subject: [PATCH 3/8] Fix build failure with ld --as-needed. | ||
| 5 | |||
| 6 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 7 | |||
| 8 | git-svn-id: svn://svn.berlios.de/slim/trunk@177 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 9 | --- | ||
| 10 | Makefile | 4 ++-- | ||
| 11 | 1 files changed, 2 insertions(+), 2 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/Makefile b/Makefile | ||
| 14 | index 1219de4..fafa0ef 100644 | ||
| 15 | --- a/Makefile | ||
| 16 | +++ b/Makefile | ||
| 17 | @@ -4,7 +4,7 @@ | ||
| 18 | # to fit into your operating system / distribution | ||
| 19 | ####################################################### | ||
| 20 | CXX=/usr/bin/g++ | ||
| 21 | -CC=/usr/bin/gcc | ||
| 22 | +CC=/usr/bin/gcc-4.5 | ||
| 23 | CFLAGS=-Wall -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/libpng12 -I/usr/include | ||
| 24 | CXXFLAGS=$(CFLAGS) | ||
| 25 | LDFLAGS=-lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg -lrt | ||
| 26 | @@ -33,7 +33,7 @@ endif | ||
| 27 | all: slim | ||
| 28 | |||
| 29 | slim: $(OBJECTS) | ||
| 30 | - $(CXX) $(LDFLAGS) $(OBJECTS) -o $(NAME) | ||
| 31 | + $(CXX) $(OBJECTS) $(LDFLAGS) -o $(NAME) | ||
| 32 | |||
| 33 | .cpp.o: | ||
| 34 | $(CXX) $(CXXFLAGS) $(DEFINES) $(CUSTOM) -c $< -o $@ | ||
| 35 | -- | ||
| 36 | 1.6.6.1 | ||
| 37 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/0004-Add-support-libpng15.patch b/meta-oe/recipes-graphics/slim/slim/0004-Add-support-libpng15.patch new file mode 100644 index 0000000000..f2087c0103 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0004-Add-support-libpng15.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From c2067e8c16bfb721d339718ae0c99c70a994936b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Fri, 17 Jun 2011 20:35:07 +0000 | ||
| 4 | Subject: [PATCH 4/8] Add support libpng15 | ||
| 5 | |||
| 6 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 7 | |||
| 8 | git-svn-id: svn://svn.berlios.de/slim/trunk@178 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 9 | --- | ||
| 10 | Makefile | 4 ++-- | ||
| 11 | png.c | 6 +++++- | ||
| 12 | 2 files changed, 7 insertions(+), 3 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/Makefile b/Makefile | ||
| 15 | index fafa0ef..1202614 100644 | ||
| 16 | --- a/Makefile | ||
| 17 | +++ b/Makefile | ||
| 18 | @@ -5,9 +5,9 @@ | ||
| 19 | ####################################################### | ||
| 20 | CXX=/usr/bin/g++ | ||
| 21 | CC=/usr/bin/gcc-4.5 | ||
| 22 | -CFLAGS=-Wall -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/libpng12 -I/usr/include | ||
| 23 | +CFLAGS=-Wall -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include | ||
| 24 | CXXFLAGS=$(CFLAGS) | ||
| 25 | -LDFLAGS=-lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg -lrt | ||
| 26 | +LDFLAGS=-lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lcrypt -lXmu -lpng -ljpeg -lrt | ||
| 27 | CUSTOM=-DHAVE_SHADOW | ||
| 28 | ifdef USE_PAM | ||
| 29 | LDFLAGS+= -lpam | ||
| 30 | diff --git a/png.c b/png.c | ||
| 31 | index 5c086c6..aa0f5e5 100644 | ||
| 32 | --- a/png.c | ||
| 33 | +++ b/png.c | ||
| 34 | @@ -57,8 +57,12 @@ read_png(const char *filename, int *width, int *height, unsigned char **rgb, | ||
| 35 | png_destroy_read_struct(&png_ptr, (png_infopp) NULL, | ||
| 36 | (png_infopp) NULL); | ||
| 37 | } | ||
| 38 | - | ||
| 39 | + | ||
| 40 | +#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4 | ||
| 41 | + if (setjmp(png_jmpbuf((data->png_ptr)))) | ||
| 42 | +#else | ||
| 43 | if (setjmp(png_ptr->jmpbuf)) | ||
| 44 | +#endif | ||
| 45 | goto png_destroy; | ||
| 46 | |||
| 47 | png_init_io(png_ptr, infile); | ||
| 48 | -- | ||
| 49 | 1.6.6.1 | ||
| 50 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/0005-Remove-path-of-gcc-amd-g-and-version-of-g.patch b/meta-oe/recipes-graphics/slim/slim/0005-Remove-path-of-gcc-amd-g-and-version-of-g.patch new file mode 100644 index 0000000000..566ae355e7 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0005-Remove-path-of-gcc-amd-g-and-version-of-g.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | From 4f69eb1aa85fbb395a0474b1f376505fab81ee22 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Fri, 17 Jun 2011 20:35:10 +0000 | ||
| 4 | Subject: [PATCH 5/8] Remove path of gcc amd g++, and version of g++ | ||
| 5 | |||
| 6 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 7 | |||
| 8 | git-svn-id: svn://svn.berlios.de/slim/trunk@179 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 9 | --- | ||
| 10 | Makefile | 4 ++-- | ||
| 11 | 1 files changed, 2 insertions(+), 2 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/Makefile b/Makefile | ||
| 14 | index 1202614..5c5fde1 100644 | ||
| 15 | --- a/Makefile | ||
| 16 | +++ b/Makefile | ||
| 17 | @@ -3,8 +3,8 @@ | ||
| 18 | # Edit the following section to adjust the options | ||
| 19 | # to fit into your operating system / distribution | ||
| 20 | ####################################################### | ||
| 21 | -CXX=/usr/bin/g++ | ||
| 22 | -CC=/usr/bin/gcc-4.5 | ||
| 23 | +CXX=g++ | ||
| 24 | +CC=gcc | ||
| 25 | CFLAGS=-Wall -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include | ||
| 26 | CXXFLAGS=$(CFLAGS) | ||
| 27 | LDFLAGS=-lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lcrypt -lXmu -lpng -ljpeg -lrt | ||
| 28 | -- | ||
| 29 | 1.6.6.1 | ||
| 30 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/0006-Remove-localhost-from-Authenticator-of-pam.patch b/meta-oe/recipes-graphics/slim/slim/0006-Remove-localhost-from-Authenticator-of-pam.patch new file mode 100644 index 0000000000..a5b812584c --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0006-Remove-localhost-from-Authenticator-of-pam.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From e188d5fd3e3c0e40c3e35729fd8b81b138191a75 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Fri, 17 Jun 2011 20:35:13 +0000 | ||
| 4 | Subject: [PATCH 6/8] Remove localhost from Authenticator of pam | ||
| 5 | |||
| 6 | http://bugs.gentoo.org/346037 | ||
| 7 | https://developer.berlios.de/bugs/?func=detailbug&bug_id=17757&group_id=2663 | ||
| 8 | http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-misc/slim/files/346037-stop_setting_host_for_pam_ck_connector_so.patch?view=log | ||
| 9 | |||
| 10 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 11 | |||
| 12 | git-svn-id: svn://svn.berlios.de/slim/trunk@180 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 13 | --- | ||
| 14 | app.cpp | 2 -- | ||
| 15 | 1 files changed, 0 insertions(+), 2 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/app.cpp b/app.cpp | ||
| 18 | index c80a73e..7177363 100644 | ||
| 19 | --- a/app.cpp | ||
| 20 | +++ b/app.cpp | ||
| 21 | @@ -236,8 +236,6 @@ void App::Run() { | ||
| 22 | pam.start("slim"); | ||
| 23 | pam.set_item(PAM::Authenticator::TTY, DisplayName); | ||
| 24 | pam.set_item(PAM::Authenticator::Requestor, "root"); | ||
| 25 | - pam.set_item(PAM::Authenticator::Host, "localhost"); | ||
| 26 | - | ||
| 27 | } | ||
| 28 | catch(PAM::Exception& e){ | ||
| 29 | cerr << APPNAME << ": " << e << endl; | ||
| 30 | -- | ||
| 31 | 1.6.6.1 | ||
| 32 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/0007-Fix-tty-slowness.patch b/meta-oe/recipes-graphics/slim/slim/0007-Fix-tty-slowness.patch new file mode 100644 index 0000000000..fa2502bf05 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0007-Fix-tty-slowness.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From da172fd6234b3b2b487ab36d63da72758829cb1d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Fri, 17 Jun 2011 20:35:15 +0000 | ||
| 4 | Subject: [PATCH 7/8] Fix tty slowness | ||
| 5 | |||
| 6 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 7 | |||
| 8 | git-svn-id: svn://svn.berlios.de/slim/trunk@181 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 9 | --- | ||
| 10 | app.cpp | 10 ++++++---- | ||
| 11 | 1 files changed, 6 insertions(+), 4 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/app.cpp b/app.cpp | ||
| 14 | index 7177363..44ab099 100644 | ||
| 15 | --- a/app.cpp | ||
| 16 | +++ b/app.cpp | ||
| 17 | @@ -278,21 +278,23 @@ void App::Run() { | ||
| 18 | signal(SIGALRM, AlarmSignal); | ||
| 19 | |||
| 20 | #ifndef XNEST_DEBUG | ||
| 21 | - OpenLog(); | ||
| 22 | - | ||
| 23 | if (!force_nodaemon && cfg->getOption("daemon") == "yes") { | ||
| 24 | daemonmode = true; | ||
| 25 | } | ||
| 26 | |||
| 27 | // Daemonize | ||
| 28 | if (daemonmode) { | ||
| 29 | - if (daemon(0, 1) == -1) { | ||
| 30 | + if (daemon(0, 0) == -1) { | ||
| 31 | cerr << APPNAME << ": " << strerror(errno) << endl; | ||
| 32 | exit(ERR_EXIT); | ||
| 33 | } | ||
| 34 | - UpdatePid(); | ||
| 35 | } | ||
| 36 | |||
| 37 | + OpenLog(); | ||
| 38 | + | ||
| 39 | + if (daemonmode) | ||
| 40 | + UpdatePid(); | ||
| 41 | + | ||
| 42 | CreateServerAuth(); | ||
| 43 | StartServer(); | ||
| 44 | alarm(2); | ||
| 45 | -- | ||
| 46 | 1.6.6.1 | ||
| 47 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch b/meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch new file mode 100644 index 0000000000..0c5cfb742f --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | From ee77a3d154443d2823ecbf2141daa1b5924f629f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
| 3 | Date: Fri, 17 Jun 2011 20:38:34 +0000 | ||
| 4 | Subject: [PATCH 8/8] restart Xserver if killed | ||
| 5 | |||
| 6 | Patch from http://developer.berlios.de/patch/?func=detailpatch&patch_id=2378&group_id=2663. | ||
| 7 | |||
| 8 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
| 9 | |||
| 10 | git-svn-id: svn://svn.berlios.de/slim/trunk@182 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
| 11 | --- | ||
| 12 | app.cpp | 36 +++++++++--------------------------- | ||
| 13 | app.h | 2 +- | ||
| 14 | 2 files changed, 10 insertions(+), 28 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/app.cpp b/app.cpp | ||
| 17 | index 44ab099..358a98f 100644 | ||
| 18 | --- a/app.cpp | ||
| 19 | +++ b/app.cpp | ||
| 20 | @@ -104,6 +104,11 @@ int conv(int num_msg, const struct pam_message **msg, | ||
| 21 | |||
| 22 | extern App* LoginApp; | ||
| 23 | |||
| 24 | +int xioerror(Display *disp) { | ||
| 25 | + LoginApp->RestartServer(); | ||
| 26 | + return 0; | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | void CatchSignal(int sig) { | ||
| 30 | cerr << APPNAME << ": unexpected signal " << sig << endl; | ||
| 31 | |||
| 32 | @@ -114,19 +119,6 @@ void CatchSignal(int sig) { | ||
| 33 | exit(ERR_EXIT); | ||
| 34 | } | ||
| 35 | |||
| 36 | - | ||
| 37 | -void AlarmSignal(int sig) { | ||
| 38 | - int pid = LoginApp->GetServerPID(); | ||
| 39 | - if(waitpid(pid, NULL, WNOHANG) == pid) { | ||
| 40 | - LoginApp->StopServer(); | ||
| 41 | - LoginApp->RemoveLock(); | ||
| 42 | - exit(OK_EXIT); | ||
| 43 | - } | ||
| 44 | - signal(sig, AlarmSignal); | ||
| 45 | - alarm(2); | ||
| 46 | -} | ||
| 47 | - | ||
| 48 | - | ||
| 49 | void User1Signal(int sig) { | ||
| 50 | signal(sig, User1Signal); | ||
| 51 | } | ||
| 52 | @@ -275,7 +267,6 @@ void App::Run() { | ||
| 53 | signal(SIGHUP, CatchSignal); | ||
| 54 | signal(SIGPIPE, CatchSignal); | ||
| 55 | signal(SIGUSR1, User1Signal); | ||
| 56 | - signal(SIGALRM, AlarmSignal); | ||
| 57 | |||
| 58 | #ifndef XNEST_DEBUG | ||
| 59 | if (!force_nodaemon && cfg->getOption("daemon") == "yes") { | ||
| 60 | @@ -297,7 +288,6 @@ void App::Run() { | ||
| 61 | |||
| 62 | CreateServerAuth(); | ||
| 63 | StartServer(); | ||
| 64 | - alarm(2); | ||
| 65 | #endif | ||
| 66 | |||
| 67 | } | ||
| 68 | @@ -613,6 +603,8 @@ void App::Login() { | ||
| 69 | int status; | ||
| 70 | while (wpid != pid) { | ||
| 71 | wpid = wait(&status); | ||
| 72 | + if (wpid == ServerPID) | ||
| 73 | + xioerror(Dpy); // Server died, simulate IO error | ||
| 74 | } | ||
| 75 | if (WIFEXITED(status) && WEXITSTATUS(status)) { | ||
| 76 | LoginPanel->Message("Failed to execute login command"); | ||
| 77 | @@ -658,9 +650,6 @@ void App::Login() { | ||
| 78 | |||
| 79 | |||
| 80 | void App::Reboot() { | ||
| 81 | - // Stop alarm clock | ||
| 82 | - alarm(0); | ||
| 83 | - | ||
| 84 | #ifdef USE_PAM | ||
| 85 | try{ | ||
| 86 | pam.end(); | ||
| 87 | @@ -683,9 +672,6 @@ void App::Reboot() { | ||
| 88 | |||
| 89 | |||
| 90 | void App::Halt() { | ||
| 91 | - // Stop alarm clock | ||
| 92 | - alarm(0); | ||
| 93 | - | ||
| 94 | #ifdef USE_PAM | ||
| 95 | try{ | ||
| 96 | pam.end(); | ||
| 97 | @@ -771,6 +757,7 @@ void App::RestartServer() { | ||
| 98 | |||
| 99 | StopServer(); | ||
| 100 | RemoveLock(); | ||
| 101 | + while (waitpid(-1, NULL, WNOHANG) > 0); // Collects all dead childrens | ||
| 102 | Run(); | ||
| 103 | } | ||
| 104 | |||
| 105 | @@ -841,6 +828,7 @@ int App::WaitForServer() { | ||
| 106 | |||
| 107 | for(cycles = 0; cycles < ncycles; cycles++) { | ||
| 108 | if((Dpy = XOpenDisplay(DisplayName))) { | ||
| 109 | + XSetIOErrorHandler(xioerror); | ||
| 110 | return 1; | ||
| 111 | } else { | ||
| 112 | if(!ServerTimeout(1, (char *) "X server to begin accepting connections")) | ||
| 113 | @@ -925,9 +913,6 @@ int App::StartServer() { | ||
| 114 | ServerPID = -1; | ||
| 115 | break; | ||
| 116 | } | ||
| 117 | - alarm(15); | ||
| 118 | - pause(); | ||
| 119 | - alarm(0); | ||
| 120 | |||
| 121 | // Wait for server to start up | ||
| 122 | if(WaitForServer() == 0) { | ||
| 123 | @@ -962,15 +947,12 @@ int IgnoreXIO(Display *d) { | ||
| 124 | |||
| 125 | |||
| 126 | void App::StopServer() { | ||
| 127 | - // Stop alars clock and ignore signals | ||
| 128 | - alarm(0); | ||
| 129 | signal(SIGQUIT, SIG_IGN); | ||
| 130 | signal(SIGINT, SIG_IGN); | ||
| 131 | signal(SIGHUP, SIG_IGN); | ||
| 132 | signal(SIGPIPE, SIG_IGN); | ||
| 133 | signal(SIGTERM, SIG_DFL); | ||
| 134 | signal(SIGKILL, SIG_DFL); | ||
| 135 | - signal(SIGALRM, SIG_DFL); | ||
| 136 | |||
| 137 | // Catch X error | ||
| 138 | XSetIOErrorHandler(IgnoreXIO); | ||
| 139 | diff --git a/app.h b/app.h | ||
| 140 | index dd7c281..2db1038 100644 | ||
| 141 | --- a/app.h | ||
| 142 | +++ b/app.h | ||
| 143 | @@ -34,6 +34,7 @@ public: | ||
| 144 | ~App(); | ||
| 145 | void Run(); | ||
| 146 | int GetServerPID(); | ||
| 147 | + void RestartServer(); | ||
| 148 | void StopServer(); | ||
| 149 | |||
| 150 | bool serverStarted; | ||
| 151 | @@ -49,7 +50,6 @@ private: | ||
| 152 | void Console(); | ||
| 153 | void Exit(); | ||
| 154 | void KillAllClients(Bool top); | ||
| 155 | - void RestartServer(); | ||
| 156 | void ReadConfig(); | ||
| 157 | void OpenLog(); | ||
| 158 | void CloseLog(); | ||
| 159 | -- | ||
| 160 | 1.6.6.1 | ||
| 161 | |||
diff --git a/meta-oe/recipes-graphics/slim/slim/Makefile.oe b/meta-oe/recipes-graphics/slim/slim/Makefile.oe new file mode 100644 index 0000000000..2ee69346a9 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/Makefile.oe | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | # Makefile for slim - OpenEmbedded | ||
| 2 | ####################################################### | ||
| 3 | |||
| 4 | |||
| 5 | SLIMLDFLAGS=-lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg -lrt -lpthread | ||
| 6 | CUSTOM=-DHAVE_SHADOW | ||
| 7 | |||
| 8 | USE_PAM=1 | ||
| 9 | ifdef USE_PAM | ||
| 10 | SLIMLDFLAGS+= -lpam | ||
| 11 | CUSTOM+= -DUSE_PAM | ||
| 12 | endif | ||
| 13 | |||
| 14 | ####################################################### | ||
| 15 | |||
| 16 | NAME=slim | ||
| 17 | VERSION=1.3.2 | ||
| 18 | |||
| 19 | DEFINES=-DPACKAGE=\"$(NAME)\" -DVERSION=\"$(VERSION)\" \ | ||
| 20 | -DPKGDATADIR=\"$(PREFIX)/share/slim\" -DSYSCONFDIR=\"$(CFGDIR)\" | ||
| 21 | |||
| 22 | OBJECTS=jpeg.o png.o main.o image.o numlock.o cfg.o switchuser.o app.o \ | ||
| 23 | panel.o util.o | ||
| 24 | ifdef USE_PAM | ||
| 25 | OBJECTS+=PAM.o | ||
| 26 | endif | ||
| 27 | |||
| 28 | all: slim | ||
| 29 | |||
| 30 | slim: $(OBJECTS) | ||
| 31 | $(CXX) $(OBJECTS) $(LDFLAGS) $(SLIMLDFLAGS) -o $(NAME) | ||
| 32 | |||
| 33 | .cpp.o: | ||
| 34 | $(CXX) $(CXXFLAGS) $(DEFINES) $(CUSTOM) -c $< -o $@ | ||
| 35 | |||
| 36 | .c.o: | ||
| 37 | $(CC) $(CFLAGS) $(DEFINES) $(CUSTOM) -c $< -o $@ | ||
| 38 | |||
| 39 | install: slim install-theme | ||
| 40 | install -D -m 755 slim $(DESTDIR)$(PREFIX)/bin/slim | ||
| 41 | install -D -m 644 slim.1 $(DESTDIR)$(MANDIR)/man1/slim.1 | ||
| 42 | test -e $(DESTDIR)$(CFGDIR)/slim.conf || \ | ||
| 43 | install -D -m 644 slim.conf $(DESTDIR)$(CFGDIR)/slim.conf | ||
| 44 | |||
| 45 | clean: | ||
| 46 | @rm -f slim *.o | ||
| 47 | |||
| 48 | dist: | ||
| 49 | @rm -rf $(NAME)-$(VERSION) | ||
| 50 | @mkdir $(NAME)-$(VERSION) | ||
| 51 | @cp -r *.cpp *.h *.c Makefile Makefile.* COPYING ChangeLog INSTALL README TODO \ | ||
| 52 | xinitrc.sample slim.1 THEMES themes slim.conf $(NAME)-$(VERSION) | ||
| 53 | @rm -rf $(NAME)-$(VERSION)/themes/.svn $(NAME)-$(VERSION)/themes/default/.svn | ||
| 54 | @tar cvzf $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION) | ||
| 55 | @rm -rf $(NAME)-$(VERSION) | ||
| 56 | |||
| 57 | |||
| 58 | install-theme: | ||
| 59 | install -D -m 644 themes/default/slim.theme \ | ||
| 60 | $(DESTDIR)$(PREFIX)/share/slim/themes/default/slim.theme | ||
| 61 | install -D -m 644 themes/default/panel.png \ | ||
| 62 | $(DESTDIR)$(PREFIX)/share/slim/themes/default/panel.png | ||
| 63 | install -D -m 644 themes/default/background.jpg \ | ||
| 64 | $(DESTDIR)$(PREFIX)/share/slim/themes/default/background.jpg | ||
diff --git a/meta-oe/recipes-graphics/slim/slim/slim-dynwm b/meta-oe/recipes-graphics/slim/slim/slim-dynwm new file mode 100644 index 0000000000..49c9d47eca --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/slim-dynwm | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | update_slim_wmlist | ||
| 3 | if [ "x$1" = "x-nodaemon" ]; then | ||
| 4 | shift | ||
| 5 | exec slim "$@" | ||
| 6 | else | ||
| 7 | slim -d "$@" | ||
| 8 | fi | ||
diff --git a/meta-oe/recipes-graphics/slim/slim/slim.pamd b/meta-oe/recipes-graphics/slim/slim/slim.pamd new file mode 100644 index 0000000000..80c34b1dba --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/slim.pamd | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # Begin /etc/pam.d/slim | ||
| 2 | |||
| 3 | auth required pam_shells.so | ||
| 4 | auth include common-auth | ||
| 5 | auth optional pam_securetty.so | ||
| 6 | auth optional pam_gnome_keyring.so | ||
| 7 | |||
| 8 | account required pam_nologin.so | ||
| 9 | account include common-account | ||
| 10 | |||
| 11 | password include common-password | ||
| 12 | |||
| 13 | session include common-session | ||
| 14 | session required pam_mkhomedir.so skel=/etc/skel/ umask=0022 | ||
| 15 | session optional pam_lastlog.so nowtmp | ||
| 16 | session optional pam_mail.so dir=/var/mail standard | ||
| 17 | session optional pam_gnome_keyring.so auto_start | ||
| 18 | |||
| 19 | # End /etc/pam.d/slim | ||
diff --git a/meta-oe/recipes-graphics/slim/slim/slim.service b/meta-oe/recipes-graphics/slim/slim/slim.service new file mode 100644 index 0000000000..341351aad8 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/slim.service | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=SLiM Simple Login Manager | ||
| 3 | Requires=dev-tty7.device | ||
| 4 | After=dev-tty7.device systemd-user-sessions.service | ||
| 5 | |||
| 6 | [Service] | ||
| 7 | ExecStart=/usr/bin/slim -nodaemon | ||
| 8 | StandardOutput=syslog | ||
| 9 | |||
| 10 | [Install] | ||
| 11 | WantedBy=graphical.target | ||
diff --git a/meta-oe/recipes-graphics/slim/slim/update_slim_wmlist b/meta-oe/recipes-graphics/slim/slim/update_slim_wmlist new file mode 100644 index 0000000000..0f116537fd --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim/update_slim_wmlist | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | # | ||
| 3 | # update_slim_wmlist, based on: | ||
| 4 | # update_wdm_wmlist, (c) 1998 Marcelo Magallón <mmagallo@debian.org> | ||
| 5 | # rewriten to use the x-window-manager alternative | ||
| 6 | # modified to also use the x-session-manager alternative by Arthur Korn | ||
| 7 | # Copyright 2000 Wichert Akkerman <wakkerma@debian.org> | ||
| 8 | # Modified to use the freedesktop.org .desktop like kdm and gdm | ||
| 9 | # | ||
| 10 | # This script will read the list of installed window managers from | ||
| 11 | # the freedesktop .desktop files in <etc>/X11/sessions/:<etc>/dm/Sessions/: | ||
| 12 | # <share>/xsessions/ | ||
| 13 | # and update the sessions line in /etc/slim.conf. | ||
| 14 | # BEWARE: It doesn't ask any questions about this. It just does it. It | ||
| 15 | # takes an optional list of window managers. | ||
| 16 | |||
| 17 | use strict; | ||
| 18 | use File::DesktopEntry; | ||
| 19 | |||
| 20 | my $wm_list=''; | ||
| 21 | my %desktop_files; | ||
| 22 | |||
| 23 | unless (@ARGV) { | ||
| 24 | #my @wm_list = ('default'); | ||
| 25 | my @wm_list; | ||
| 26 | foreach my $dir ('/etc/X11/sessions/','/etc/dm/Sessions/','/usr/share/xsessions/') { | ||
| 27 | next unless (opendir DIR, $dir); | ||
| 28 | my @files; | ||
| 29 | @files = grep { /\.desktop$/ && -r "$dir/$_" } readdir(DIR); | ||
| 30 | foreach my $file (@files) { | ||
| 31 | push @{$desktop_files{$file}}, "$dir/$file"; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | DESKTOP: foreach my $desktop_file (keys(%desktop_files)) { | ||
| 35 | foreach my $file (@{$desktop_files{$desktop_file}}) { | ||
| 36 | my $entry = File::DesktopEntry->new_from_file($file); | ||
| 37 | next DESKTOP if (defined($entry->get_value('Hidden')) | ||
| 38 | and $entry->get_value('Hidden') eq 'true'); | ||
| 39 | if ($entry->get_value('Name') =~ /^gnome$/i) { | ||
| 40 | push (@wm_list, 'gnome'); | ||
| 41 | } | ||
| 42 | elsif ($entry->get_value('Name') =~ /^kde$/i) { | ||
| 43 | push (@wm_list, 'kde'); | ||
| 44 | } | ||
| 45 | elsif (defined($entry->get_value('Exec'))) { | ||
| 46 | push (@wm_list, $entry->get_value('Exec')); | ||
| 47 | } | ||
| 48 | else { # not found, go to next file | ||
| 49 | next; | ||
| 50 | } | ||
| 51 | # found, proceed to next destop file | ||
| 52 | next DESKTOP; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | $wm_list = join (',', sort @wm_list) . ',custom'; | ||
| 56 | } else { | ||
| 57 | $wm_list = join (',', sort @ARGV); | ||
| 58 | } | ||
| 59 | |||
| 60 | open (SLIM_CONFIG_FILE, '</etc/slim.conf') | ||
| 61 | or die "Can't open /etc/slim.conf for reading: $!"; | ||
| 62 | open (NEW_SLIM_CONFIG_FILE, '>/etc/slim.conf.new') | ||
| 63 | or die "Can't open /etc/slim.conf.new for writing: $!"; | ||
| 64 | |||
| 65 | while (<SLIM_CONFIG_FILE>) { | ||
| 66 | s|^(sessions\s*).*|$1$wm_list|; | ||
| 67 | print NEW_SLIM_CONFIG_FILE; | ||
| 68 | } | ||
| 69 | |||
| 70 | close(SLIM_CONFIG_FILE); | ||
| 71 | close(NEW_SLIM_CONFIG_FILE); | ||
| 72 | |||
| 73 | rename '/etc/slim.conf.new', '/etc/slim.conf' | ||
| 74 | or die "Can't rename /etc/slim.conf.new: $!"; | ||
| 75 | |||
| 76 | exit 0; | ||
diff --git a/meta-oe/recipes-graphics/slim/slim_1.3.2.bb b/meta-oe/recipes-graphics/slim/slim_1.3.2.bb new file mode 100644 index 0000000000..5d8f583244 --- /dev/null +++ b/meta-oe/recipes-graphics/slim/slim_1.3.2.bb | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | DESCRIPTION="Simple Login Manager" | ||
| 2 | HOMEPAGE="http://slim.berlios.de" | ||
| 3 | LICENSE = "GPLv2+" | ||
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b" | ||
| 5 | |||
| 6 | DEPENDS = "virtual/libx11 libxmu libpng jpeg freetype sessreg ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" | ||
| 7 | |||
| 8 | SRC_URI = " \ | ||
| 9 | http://download.berlios.de/${PN}/${P}.tar.gz \ | ||
| 10 | file://0002-Fix-image-handling-integer-overflows.patch \ | ||
| 11 | file://0003-Fix-build-failure-with-ld-as-needed.patch \ | ||
| 12 | file://0004-Add-support-libpng15.patch \ | ||
| 13 | file://0005-Remove-path-of-gcc-amd-g-and-version-of-g.patch \ | ||
| 14 | file://0006-Remove-localhost-from-Authenticator-of-pam.patch \ | ||
| 15 | file://0007-Fix-tty-slowness.patch \ | ||
| 16 | file://0008-restart-Xserver-if-killed.patch \ | ||
| 17 | file://slim-dynwm \ | ||
| 18 | file://update_slim_wmlist \ | ||
| 19 | file://Makefile.oe \ | ||
| 20 | file://slim.pamd \ | ||
| 21 | file://slim.service \ | ||
| 22 | " | ||
| 23 | |||
| 24 | SRC_URI[md5sum] = "ca1ae6120e6f4b4969f2d6cf94f47b42" | ||
| 25 | SRC_URI[sha256sum] = "f1560125005f253b9b88220598fed7a9575ef405716862c6ca3fcc72dbd482b8" | ||
| 26 | |||
| 27 | |||
| 28 | EXTRA_OEMAKE += " \ | ||
| 29 | USE_PAM=${@base_contains('DISTRO_FEATURES', 'pam', '1', '0', d)} \ | ||
| 30 | PREFIX=${prefix} \ | ||
| 31 | CFGDIR=${sysconfdir} \ | ||
| 32 | MANDIR=${mandir} \ | ||
| 33 | DESTDIR=${D} \ | ||
| 34 | CFLAGS+=-I${STAGING_INCDIR}/freetype2 \ | ||
| 35 | CXXFLAGS+=-I${STAGING_INCDIR}/freetype2 \ | ||
| 36 | " | ||
| 37 | |||
| 38 | do_compile_prepend() { | ||
| 39 | cp -pP ${WORKDIR}/Makefile.oe ${S}/Makefile | ||
| 40 | } | ||
| 41 | |||
| 42 | do_install() { | ||
| 43 | oe_runmake install | ||
| 44 | install -d ${D}${bindir} | ||
| 45 | install -m 0755 ${WORKDIR}/slim-dynwm ${D}${bindir}/ | ||
| 46 | install -m 0755 ${WORKDIR}/update_slim_wmlist ${D}${bindir}/ | ||
| 47 | install -d ${D}${sysconfdir}/pam.d/ | ||
| 48 | install -m 0644 ${WORKDIR}/slim.pamd ${D}${sysconfdir}/pam.d/slim | ||
| 49 | |||
| 50 | echo 'sessionstart_cmd /usr/bin/sessreg -a -l $DISPLAY %user' >> ${D}${sysconfdir}/slim.conf | ||
| 51 | echo 'sessionstop_cmd /usr/bin/sessreg -d -l $DISPLAY %user' >> ${D}${sysconfdir}/slim.conf | ||
| 52 | } | ||
| 53 | |||
| 54 | |||
| 55 | RDEPENDS_${PN} = "perl xauth freetype sessreg ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam-meta', '', d)}" | ||
| 56 | |||
| 57 | pkg_postinst_${PN} () { | ||
| 58 | if test "x$D" != "x"; then | ||
| 59 | exit 1 | ||
| 60 | fi | ||
| 61 | systemctl enable slim.service | ||
| 62 | |||
| 63 | # Register SLiM as default DM | ||
| 64 | mkdir -p ${sysconfdir}/X11/ | ||
| 65 | echo "${bindir}/slim" > ${sysconfdir}/X11/default-display-manager | ||
| 66 | } | ||
| 67 | |||
| 68 | pkg_postrm_${PN} () { | ||
| 69 | if test "x$D" != "x"; then | ||
| 70 | exit 1 | ||
| 71 | fi | ||
| 72 | systemctl disable slim.service | ||
| 73 | sed -i /slim/d $D${sysconfdir}/X11/default-display-manager || true | ||
| 74 | } | ||
| 75 | |||
