Hi folks, I've had good results with the Beryl compositor on SXCE b59 with the NVIDIA drivers.
http://trisk.acm.jhu.edu/beryl-solaris.patch (or the attachment) is a patch to apply to the Beryl tree from current SVN. As noted in the patch, you will need updated X libraries (similarly to Compiz). Additional build requirements and a screenshot are at http://trisk.acm.jhu.edu/ -Albert ---------- Forwarded message ---------- Date: Mon, 12 Mar 2007 18:02:11 -0400 (EDT) From: Albert Lee <[email protected]> To: Beryl development list <beryl-dev at lists.beryl-project.org> Subject: [PATCH] Re: [beryl-dev] Patch for Beryl to support Solaris Express/Solaris 11 On Sun, 11 Mar 2007, Robert Carr wrote: > Can you give me a license on this code? > > For reference Beryl core is GPL and Compiz core is MIT. > The code included was mostly LGPL and GPL code derived from e.g. GNU libc or libiberty. I've now reimplemented or replaced all of the code with MIT licenced versions in case anyone wants to push parts of this upstream to Compiz. This also adds emulation of FNM_CASEFOLD support for fnmatch() in the state plugin. Check new patch attached. Thanks, -Albert > > On 3/11/07, Albert Lee <trisk+beryl at acm.jhu.edu> wrote: >> Hi, >> >> I've slightly modified the build system and added compatibility code for >> GNU-specific functions to get Compiz working on Solaris Express b59. Among >> other things, this requires libXrender to be linked into libberyl. >> >> Please review these changes and commit them if they are appropriate. >> >> Thanks, >> >> -Albert -------------- next part -------------- Patch to Beryl compositing manager and utilities for Solaris Express b59 or later with Xorg 7.2. Needs updated xineramaproto (1.1.2), libXinerama (1.0.1), libXrender (0.9.2), compositeproto (0.3.1), libXcomposite (0.3.1). Index: bdock/configure.ac =================================================================== --- bdock/configure.ac (revision 4388) +++ bdock/configure.ac (working copy) @@ -1,7 +1,7 @@ AC_PREREQ(2.57) source $srcdir/VERSION -AC_INIT([bdock],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([bdock],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: beryl-plugins-unsupported/configure.ac =================================================================== --- beryl-plugins-unsupported/configure.ac (revision 4388) +++ beryl-plugins-unsupported/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-plugins-unsupported],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([beryl-plugins-unsupported],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: bcop/configure.ac =================================================================== --- bcop/configure.ac (revision 4388) +++ bcop/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([bcop],esyscmd(. ./VERSION;echo -n $VERSION), [onestone at beryl-project.org]) +AC_INIT([bcop],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [onestone at beryl-project.org]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: beryl-manager/src/compat.c =================================================================== --- beryl-manager/src/compat.c (revision 0) +++ beryl-manager/src/compat.c (revision 0) @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2007 Albert Lee <trisk at acm.jhu.edu>. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#ifndef HAVE_DAEMON +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> + +int daemon(int nochdir, int noclose); + +int daemon(int nochdir, int noclose) +{ + int fd, i; + + switch (fork()) { + case 0: + break; + case -1: + return -1; + default: + _exit(0); + } + + if (!nochdir) { + chdir("/"); + } + + if (setsid() < 0) { + return -1; + } + + if (!noclose) { + if (fd = open("/dev/null", O_RDWR) >= 0) { + for (i = 0; i < 3; i++) { + dup2(fd, i); + } + if (fd > 2) { + close(fd); + } + } + } + + return 0; +} +#endif + Index: beryl-manager/src/Makefile.am =================================================================== --- beryl-manager/src/Makefile.am (revision 4388) +++ beryl-manager/src/Makefile.am (working copy) @@ -2,7 +2,7 @@ beryl_manager_CPPFLAGS=-DDATADIR='"$(datadir)"' -DPIXMAPS_DIR='"$(datadir)/pixmaps"' -DLOCALEDIR="\"@datadir@/locale\"" @CPPFLAGS@ beryl_manager_LDADD = @COMAN_LIBS@ INCLUDES = @COMAN_CFLAGS@ -beryl_manager_SOURCES = main.c eggtrayicon.c eggtrayicon.h +beryl_manager_SOURCES = main.c compat.c eggtrayicon.c eggtrayicon.h beryl_manager_program = beryl-manager bin_PROGRAMS = $(beryl_manager_program) Index: beryl-manager/configure.ac =================================================================== --- beryl-manager/configure.ac (revision 4388) +++ beryl-manager/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-manager],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([beryl-manager],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) @@ -28,6 +28,9 @@ PKG_CHECK_MODULES(COMAN, $COMAN_REQUIRES) AC_SUBST(COMAN_REQUIRES) +AC_CHECK_FUNC(daemon, [ AC_DEFINE(HAVE_DAEMON, 1, [Define if the 'daemon' function is available.]) ]) + + AC_OUTPUT([ Makefile src/Makefile Index: beryl-settings-tool/configure.ac =================================================================== --- beryl-settings-tool/configure.ac (revision 4388) +++ beryl-settings-tool/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-settings-tool],esyscmd(. ./VERSION;echo -n $VERSION), +AC_INIT([beryl-settings-tool],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [ixce at beryl-project.org]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: emerald-themes/configure.ac =================================================================== --- emerald-themes/configure.ac (revision 4388) +++ emerald-themes/configure.ac (working copy) @@ -1,7 +1,7 @@ AC_PREREQ(2.57) source $srcdir/VERSION -AC_INIT([emerald-themes],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([emerald-themes],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: beryl-plugins/src/state.c =================================================================== --- beryl-plugins/src/state.c (revision 4388) +++ beryl-plugins/src/state.c (working copy) @@ -27,6 +27,7 @@ #include <unistd.h> #include <stdio.h> #include <limits.h> +#include <ctype.h> #include <beryl.h> @@ -635,7 +636,34 @@ if (value->is_regex) return regexec(&value->match, match, 0, 0, 0) != REG_NOMATCH; else - return fnmatch(value->name, match, FNM_CASEFOLD) == 0; +#ifdef FNM_CASEFOLD + return fnmatch(value->name, match, FNM_CASEFOLD) == 0; +#else + { + int ret; + char *temp_name, *temp_match, *p, *np; + + np = temp_name = malloc(strlen(value->name) + 1); + for (p = value->name; *p; p++) { + *np = toupper(*p); + np++; + } + *np = '\0'; + + np = temp_match = malloc(strlen(match) + 1); + for (p = match; *p; p++) { + *np = toupper(*p); + np++; + } + *np = '\0'; + + ret = fnmatch(temp_name, temp_match, 0) == 0; + free(temp_name); + free(temp_match); + + return ret; + } +#endif } static signed int Index: beryl-plugins/src/compat.c =================================================================== --- beryl-plugins/src/compat.c (revision 0) +++ beryl-plugins/src/compat.c (revision 0) @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007 Albert Lee <trisk at acm.jhu.edu>. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#ifndef HAVE_STRNDUP +#include <stdlib.h> +#include <string.h> + +char *strndup(const char *s, size_t n); + +char *strndup(const char *s, size_t n) +{ + char *ns; + + n = strnlen(s, n); + + if (ns = (char *) malloc(n + 1)) { + ns[n] = '\0'; + return memcpy(ns, s, n); + } + + return NULL; +} +#endif Index: beryl-plugins/src/decoration.c =================================================================== --- beryl-plugins/src/decoration.c (revision 4388) +++ beryl-plugins/src/decoration.c (working copy) @@ -30,6 +30,7 @@ #include <unistd.h> #include <X11/Xatom.h> +#include <X11/Xlib.h> #include <X11/extensions/shape.h> #include <beryl.h> Index: beryl-plugins/src/Makefile.am =================================================================== --- beryl-plugins/src/Makefile.am (revision 4388) +++ beryl-plugins/src/Makefile.am (working copy) @@ -52,7 +52,7 @@ if TEXT_PLUGIN libtext_la_LDFLAGS = $(PFLAGS) libtext_la_LIBADD = @BERYL_LIBS@ @BERYLSETTINGS_LIBS@ @TEXT_LIBS@ -libtext_la_SOURCES = text.c +libtext_la_SOURCES = text.c compat.c endif if DBUS_PLUGIN @@ -79,6 +79,7 @@ libbench_la_LDFLAGS = $(PFLAGS) libbench_la_LIBADD = @BERYL_LIBS@ @BERYLSETTINGS_LIBS@ libbench_la_SOURCES = bench_options.c bench.c bench_tex.h +libbench_module = libbench.la endif libscreenshot_la_LDFLAGS = $(PFLAGS) @@ -216,7 +217,6 @@ libblurfx.la \ libsplash.la \ libtext.la \ - libbench.la \ libclone.la \ libobs.la \ lib3d.la \ @@ -232,6 +232,7 @@ libfake.la \ $(libimgjpeg_module) \ $(libannotate_module) \ + $(libbench_module) \ $(libdbus_module) CLEANFILES = *_options.c *_options.h Index: beryl-plugins/configure.ac =================================================================== --- beryl-plugins/configure.ac (revision 4388) +++ beryl-plugins/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-plugins],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([beryl-plugins],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) @@ -156,6 +156,8 @@ AM_CONDITIONAL(TEXT_PLUGIN, test "x$use_text" = "xyes") if test "$use_text" = yes; then AC_DEFINE(USE_TEXT, 1, [Build text plugin]) + AC_CHECK_FUNC(strndup, [ AC_DEFINE(HAVE_STRNDUP, 1, [Define if the 'strndup' function is available.]) ]) + fi AM_CONDITIONAL(JPEG_PLUGIN, test "x$use_jpeg" = "xyes") Index: beryl-settings-simple/configure.ac =================================================================== --- beryl-settings-simple/configure.ac (revision 4388) +++ beryl-settings-simple/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-settings-simple],esyscmd(. ./VERSION;echo -n $VERSION), +AC_INIT([beryl-settings-simple],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [racarr at beryl-project.org]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: beryl-core/libberylsettings/Makefile.am =================================================================== --- beryl-core/libberylsettings/Makefile.am (revision 4388) +++ beryl-core/libberylsettings/Makefile.am (working copy) @@ -7,6 +7,7 @@ -DIMAGEDIR=\"$(imagedir)\" libberylsettings_la_SOURCES=main.c\ + $(top_srcdir)/src/compat.c\ $(top_srcdir)/src/screen_options.c\ $(top_srcdir)/src/type_mask.c\ $(top_srcdir)/src/display_options.c Index: beryl-core/src/compat.c =================================================================== --- beryl-core/src/compat.c (revision 0) +++ beryl-core/src/compat.c (revision 0) @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2007 Albert Lee <trisk at acm.jhu.edu>. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Copyright (c) 2004 Darren Tucker. + * + * Based originally on asprintf.c from OpenBSD: + * Copyright (c) 1997 Todd C. Miller <Todd.Miller at courtesan.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#ifndef HAVE_VASPRINTF +#include <errno.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <limits.h> + +#ifndef VA_COPY +# ifdef HAVE_VA_COPY +# define VA_COPY(dest, src) va_copy(dest, src) +# else +# ifdef HAVE___VA_COPY +# define VA_COPY(dest, src) __va_copy(dest, src) +# else +# define VA_COPY(dest, src) (dest) = (src) +# endif +# endif +#endif + +#define INIT_SZ 128 + +int vasprintf(char **str, const char *fmt, va_list ap); + +int vasprintf(char **str, const char *fmt, va_list ap) +{ + int ret = -1; + va_list ap2; + char *string, *newstr; + size_t len; + + VA_COPY(ap2, ap); + if ((string = malloc(INIT_SZ)) == NULL) + goto fail; + + ret = vsnprintf(string, INIT_SZ, fmt, ap2); + if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */ + *str = string; + } else if (ret == INT_MAX) { /* shouldn't happen */ + goto fail; + } else { /* bigger than initial, realloc allowing for nul */ + len = (size_t)ret + 1; + if ((newstr = realloc(string, len)) == NULL) { + free(string); + goto fail; + } else { + va_end(ap2); + VA_COPY(ap2, ap); + ret = vsnprintf(newstr, len, fmt, ap2); + if (ret >= 0 && (size_t)ret < len) { + *str = newstr; + } else { /* failed with realloc'ed string, give up */ + free(newstr); + goto fail; + } + } + } + va_end(ap2); + return (ret); + +fail: + *str = NULL; + errno = ENOMEM; + va_end(ap2); + return (-1); +} +#endif + +#ifndef HAVE_ASPRINTF +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> + +int asprintf(char **str, const char *fmt, ...); + +int asprintf(char **str, const char *fmt, ...) +{ + va_list ap; + int ret; + + *str = NULL; + va_start(ap, fmt); + ret = vasprintf(str, fmt, ap); + va_end(ap); + + return ret; +} +#endif + +#ifndef HAVE_STRCASESTR +#include <ctype.h> + +char *strcasestr (char *h, char *n); + +char *strcasestr (char *h, char *n) +{ + char *hp, *np = n, *match = 0; + + if(!*np) { + return hp; + } + + for (hp = h; *hp; hp++) { + if (toupper(*hp) == toupper(*np)) { + if (!match) { + match = hp; + } + if(!*++np) { + return match; + } + } else { + if (match) { + match = 0; + np = n; + } + } + } + + return NULL; +} +#endif Index: beryl-core/src/Makefile.am =================================================================== --- beryl-core/src/Makefile.am (revision 4388) +++ beryl-core/src/Makefile.am (working copy) @@ -40,6 +40,7 @@ beryl-private.h \ fsp.h \ library.c \ + compat.c \ blog.c Index: beryl-core/configure.ac =================================================================== --- beryl-core/configure.ac (revision 4388) +++ beryl-core/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-core],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([beryl-core],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) @@ -90,6 +90,7 @@ xfixes \ xdamage \ xrandr \ +xrender >= 0.8.4 \ ice \ sm \ xinerama \ @@ -99,6 +100,14 @@ AC_SUBST(BERYL_REQUIRES) PKG_CHECK_MODULES(GLIB, "glib-2.0") +AC_CHECK_FUNC(va_copy, [ AC_DEFINE(HAVE_VA_COPY, 1, [Define if the 'va_copy' function is available.]) ]) + +AC_CHECK_FUNC(vasprintf, [ AC_DEFINE(HAVE_VASPRINTF, 1, [Define if the 'vasprintf' function is available.]) ]) + +AC_CHECK_FUNC(asprintf, [ AC_DEFINE(HAVE_ASPRINTF, 1, [Define if the 'asprintf' function is available.]) ]) + +AC_CHECK_FUNC(strcasestr, [ AC_DEFINE(HAVE_STRCASESTR, 1, [Define if the 'strcasestr' function is available.]) ]) + AC_ARG_ENABLE(gconf, [ --disable-gconf Disable GConf backend for libberylsettings], [beryl_gconf=$enableval],[beryl_gconf=yes]) Index: heliodor/configure.ac =================================================================== --- heliodor/configure.ac (revision 4388) +++ heliodor/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([heliodor],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([heliodor],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: beryl-settings-bindings/configure.ac =================================================================== --- beryl-settings-bindings/configure.ac (revision 4388) +++ beryl-settings-bindings/configure.ac (working copy) @@ -1,5 +1,5 @@ AC_PREREQ(2.57) -AC_INIT([beryl-settings-bindings],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([beryl-settings-bindings],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) Index: emerald/themer/compat.c =================================================================== --- emerald/themer/compat.c (revision 0) +++ emerald/themer/compat.c (revision 0) @@ -0,0 +1,75 @@ +/* Copyright (c) 2007 Albert Lee <trisk at acm.jhu.edu>. + * Copyright (c) 2006 Ulrich Spoerlein <q at galgenberg.net>. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#ifndef HAVE_STRVERSCMP +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int strverscmp(const char *s1, const char *s2); + +int strverscmp(const char *s1, const char *s2) +{ + static const char *digits = "0123456789"; + char *t1, *t2; + int ret; + long n1, n2; + size_t p1, p2; + + p1 = strcspn(s1, digits); + p2 = strcspn(s2, digits); + while (p1 == p2 && s1[p1] != '\0' && s2[p2] != '\0') { + /* Different prefix */ + if ((ret = strncmp(s1, s2, p1)) != 0) + return ret; + + s1 += p1; + s2 += p2; + n1 = strtol(s1, &t1, 10); + n2 = strtol(s2, &t2, 10); + + if (n1 < n2) + return -1; + else if (n1 > n2) + return 1; + + /* One number is "shorter", e.g., "07" vs "007" */ + if (t1-s1 < t2-s2) + return 1; + else if (t1-s1 > t2-s2) + return -1; + + /* Numbers are equal or not present, try with next ones. */ + s1 = t1; + s2 = t2; + p1 = strcspn(s1, digits); + p2 = strcspn(s2, digits); + } + + return strcmp(s1, s2); +} +#endif Index: emerald/themer/Makefile.am =================================================================== --- emerald/themer/Makefile.am (revision 4388) +++ emerald/themer/Makefile.am (working copy) @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -emerald_theme_manager_SOURCES = main.c +emerald_theme_manager_SOURCES = main.c compat.c emerald_theme_manager_LDADD = $(EMERALD_LIBS) ../libengine/libemeraldengine.la bin_PROGRAMS = emerald-theme-manager Index: emerald/configure.ac =================================================================== --- emerald/configure.ac (revision 4388) +++ emerald/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([emerald],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([emerald],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version]) @@ -48,6 +48,8 @@ LIBS="$LIBS $EMERALD_LIBS" AC_CHECK_FUNCS(wnck_window_has_name) +AC_CHECK_FUNC(strverscmp, [ AC_DEFINE(HAVE_STRVERSCMP, 1, [Define if the 'strverscmp' function is available.]) ]) + AC_ARG_ENABLE(mime-update, [ --enable-mime-update], [case "${enableval}" in Index: beryl-settings/configure.ac =================================================================== --- beryl-settings/configure.ac (revision 4388) +++ beryl-settings/configure.ac (working copy) @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -AC_INIT([beryl-settings],esyscmd(. ./VERSION;echo -n $VERSION), [livinglatexkali at gmail.com]) +AC_INIT([beryl-settings],esyscmd(. ./VERSION;echo $VERSION | tr -d "\n"), [livinglatexkali at gmail.com]) AC_DEFINE_UNQUOTED(VERSION,"$VERSION",[Version])
