From: Quentin Glidic <[email protected]>

We provide them all in our pkg-config file for usage by external
modules.
Also use pkg-prefixed directories

Signed-off-by: Quentin Glidic <[email protected]>
---
 clients/Makefile.am      |  2 +-
 clients/desktop-shell.c  |  4 ++--
 configure.ac             | 32 ++++++++++++++++++++++++++++++++
 data/Makefile.am         |  4 +---
 man/Makefile.am          |  2 +-
 shared/Makefile.am       |  2 +-
 shared/frame.c           |  8 ++++----
 src/Makefile.am          |  9 ++++-----
 src/compositor-wayland.c |  2 +-
 src/compositor-x11.c     |  2 +-
 src/weston.pc.in         |  8 ++++++--
 src/xwayland/Makefile.am |  4 ++--
 12 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/clients/Makefile.am b/clients/Makefile.am
index 4f9dc48..0b6b5ea 100644
--- a/clients/Makefile.am
+++ b/clients/Makefile.am
@@ -25,7 +25,7 @@ libexec_PROGRAMS =                            \
 
 AM_CFLAGS = $(GCC_CFLAGS)
 AM_CPPFLAGS =                                  \
-       -DDATADIR='"$(datadir)"'                \
+       -DPKGDATADIR='"$(pkgdatadir)"'          \
        -DBINDIR='"$(bindir)"'                  \
        $(CLIENT_CFLAGS) $(CAIRO_EGL_CFLAGS)
 
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 8c97104..3081b98 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -1054,7 +1054,7 @@ background_create(struct desktop *desktop)
        s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
        weston_config_section_get_string(s, "background-image",
                                         &background->image,
-                                        DATADIR "/weston/pattern.png");
+                                        PKGDATADIR "/pattern.png");
        weston_config_section_get_uint(s, "background-color",
                                       &background->color, 0xff002244);
 
@@ -1272,7 +1272,7 @@ panel_add_launchers(struct panel *panel, struct desktop 
*desktop)
        if (count == 0) {
                /* add default launcher */
                panel_add_launcher(panel,
-                                  DATADIR "/weston/terminal.png",
+                                  PKGDATADIR "/terminal.png",
                                   BINDIR "/weston-terminal");
        }
 }
diff --git a/configure.ac b/configure.ac
index 2bb7c9c..0fa1766 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,38 @@ LT_INIT([disable-static])
 AC_ARG_VAR([WESTON_NATIVE_BACKEND],
            [Set the native backend to use, if Weston is not running under 
Wayland nor X11. @<:@default=drm-backend.so@:>@])
 
+
+#
+# Directories
+#
+
+# package-specific dirs
+# Autotools define them for us already,
+# but we do that here for configure substitution
+pkglibdir='${libdir}/'${PACKAGE}
+pkglibexecdir='${libexecdir}/'${PACKAGE}
+pkgincludedir='${includedir}/'${PACKAGE}
+pkgdatadir='${datadir}/'${PACKAGE}
+AC_SUBST([pkglibdir])
+AC_SUBST([pkglibexecdir])
+AC_SUBST([pkgincludedir])
+AC_SUBST([pkgdatadir])
+
+# pkg-config files
+# We prefer the system-provided value if available,
+# and fallback to a well-known value
+m4_ifdef([PKG_INSTALLDIR], [
+               PKG_INSTALLDIR()
+       ], [
+               pkgconfigdir='${libdir}/pkgconfig'
+               AC_SUBST([pkgconfigdir])
+       ])
+
+# weston specific dirs
+moduledir='${pkglibdir}/plugins'
+AC_SUBST([moduledir])
+
+
 PKG_PROG_PKG_CONFIG()
 
 AC_CHECK_FUNC([dlopen], [],
diff --git a/data/Makefile.am b/data/Makefile.am
index a7cc944..f6f05f9 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,6 +1,4 @@
-westondatadir = $(datadir)/weston
-
-dist_westondata_DATA =                         \
+dist_pkgdata_DATA =                            \
        wayland.svg                             \
        $(wayland_icon_png)                     \
        pattern.png                             \
diff --git a/man/Makefile.am b/man/Makefile.am
index e4abd8c..37174e2 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -6,7 +6,7 @@ endif
 
 MAN_SUBSTS = \
        -e 's|__weston_native_backend__|$(WESTON_NATIVE_BACKEND)|g' \
-       -e 's|__weston_modules_dir__|$(pkglibdir)|g' \
+       -e 's|__weston_modules_dir__|$(moduledir)|g' \
        -e 's|__version__|$(PACKAGE_VERSION)|g'
 
 SUFFIXES = .1 .5 .7 .man
diff --git a/shared/Makefile.am b/shared/Makefile.am
index 31fab5f..432d6d9 100644
--- a/shared/Makefile.am
+++ b/shared/Makefile.am
@@ -10,7 +10,7 @@ libshared_la_SOURCES =                                \
        os-compatibility.h
 
 libshared_cairo_la_CFLAGS =                    \
-       -DDATADIR='"$(datadir)"'                \
+       -DPKGDATADIR='"$(pkgdatadir)"'          \
        $(GCC_CFLAGS)                           \
        $(COMPOSITOR_CFLAGS)                    \
        $(PIXMAN_CFLAGS)                        \
diff --git a/shared/frame.c b/shared/frame.c
index fc85950..1aad0be 100644
--- a/shared/frame.c
+++ b/shared/frame.c
@@ -291,7 +291,7 @@ frame_create(struct theme *t, int32_t width, int32_t 
height, uint32_t buttons,
        wl_list_init(&frame->pointers);
        wl_list_init(&frame->touches);
 
-       button = frame_button_create(frame, DATADIR "/weston/icon_window.png",
+       button = frame_button_create(frame, PKGDATADIR "/icon_window.png",
                                     FRAME_STATUS_MENU,
                                     FRAME_BUTTON_CLICK_DOWN);
        if (!button)
@@ -299,7 +299,7 @@ frame_create(struct theme *t, int32_t width, int32_t 
height, uint32_t buttons,
 
        if (buttons & FRAME_BUTTON_CLOSE) {
                button = frame_button_create(frame,
-                                            DATADIR "/weston/sign_close.png",
+                                            PKGDATADIR "/sign_close.png",
                                             FRAME_STATUS_CLOSE,
                                             FRAME_BUTTON_ALIGN_RIGHT |
                                             FRAME_BUTTON_DECORATED);
@@ -309,7 +309,7 @@ frame_create(struct theme *t, int32_t width, int32_t 
height, uint32_t buttons,
 
        if (buttons & FRAME_BUTTON_MAXIMIZE) {
                button = frame_button_create(frame,
-                                            DATADIR 
"/weston/sign_maximize.png",
+                                            PKGDATADIR "/sign_maximize.png",
                                             FRAME_STATUS_MAXIMIZE,
                                             FRAME_BUTTON_ALIGN_RIGHT |
                                             FRAME_BUTTON_DECORATED);
@@ -319,7 +319,7 @@ frame_create(struct theme *t, int32_t width, int32_t 
height, uint32_t buttons,
 
        if (buttons & FRAME_BUTTON_MINIMIZE) {
                button = frame_button_create(frame,
-                                            DATADIR 
"/weston/sign_minimize.png",
+                                            PKGDATADIR "/sign_minimize.png",
                                             FRAME_STATUS_MINIMIZE,
                                             FRAME_BUTTON_ALIGN_RIGHT |
                                             FRAME_BUTTON_DECORATED);
diff --git a/src/Makefile.am b/src/Makefile.am
index 4224495..7bbc7ba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ bin_PROGRAMS = weston                           \
 
 AM_CPPFLAGS =                                  \
        -I$(top_srcdir)/shared                  \
-       -DDATADIR='"$(datadir)"'                \
+       -DPKGDATADIR='"$(pkgdatadir)"'          \
        -DMODULEDIR='"$(moduledir)"'            \
        -DLIBEXECDIR='"$(libexecdir)"'          \
        -DIN_WESTON
@@ -95,18 +95,17 @@ endif
 
 endif # BUILD_WESTON_LAUNCH
 
-pkgconfigdir = $(libdir)/pkgconfig
+# *dir vars are defined in configure.ac
+
 pkgconfig_DATA = weston.pc
 
-westonincludedir = $(includedir)/weston
-westoninclude_HEADERS =                                \
+pkginclude_HEADERS =                           \
        version.h                               \
        compositor.h                            \
        ../shared/matrix.h                      \
        ../shared/config-parser.h               \
        ../shared/zalloc.h
 
-moduledir = $(libdir)/weston
 module_LTLIBRARIES =                           \
        $(desktop_shell)                        \
        $(tablet_shell)                         \
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 21ce5cb..1068486 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -97,7 +97,7 @@ create_border(struct wayland_compositor *c)
        pixman_image_t *image;
        int32_t edges[4];
 
-       image = load_image(DATADIR "/weston/border.png");
+       image = load_image(PKGDATADIR "/border.png");
        if (!image) {
                weston_log("couldn't load border image\n");
                return;
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 1ccd03c..f9449c4 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -895,7 +895,7 @@ x11_compositor_create_output(struct x11_compositor *c, int 
x, int y,
                            c->atom.wm_class, c->atom.string, 8,
                            sizeof class, class);
 
-       x11_output_set_icon(c, output, DATADIR "/weston/wayland.png");
+       x11_output_set_icon(c, output, PKGDATADIR "/wayland.png");
 
        x11_output_set_wm_protocols(c, output);
 
diff --git a/src/weston.pc.in b/src/weston.pc.in
index 5e61d3d..64509c5 100644
--- a/src/weston.pc.in
+++ b/src/weston.pc.in
@@ -1,9 +1,13 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
-includedir=@includedir@
 libexecdir=@libexecdir@
-pkglibexecdir=${libexecdir}/@PACKAGE@
+includedir=@includedir@
+
+pkglibdir=@pkglibdir@
+pkglibexecdir=@pkglibexecdir@
+
+moduledir=@moduledir@
 
 Name: Weston Plugin API
 Description: Header files for Weston plugin development
diff --git a/src/xwayland/Makefile.am b/src/xwayland/Makefile.am
index cab59c7..2cf5615 100644
--- a/src/xwayland/Makefile.am
+++ b/src/xwayland/Makefile.am
@@ -1,12 +1,12 @@
 AM_CPPFLAGS =                                  \
        -I$(top_srcdir)/shared                  \
        -I$(top_builddir)/src                   \
-       -DDATADIR='"$(datadir)"'                \
+       -DPKGDATADIR='"$(pkgdatadir)"'          \
        -DMODULEDIR='"$(moduledir)"'            \
        -DLIBEXECDIR='"$(libexecdir)"'          \
        -DXSERVER_PATH='"@XSERVER_PATH@"'
 
-moduledir = @libdir@/weston
+# moduledir is defined in configure.ac
 module_LTLIBRARIES = xwayland.la
 
 xwayland = xwayland.la
-- 
1.8.4.1

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to