aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile58
-rw-r--r--TODO2
-rw-r--r--mk/method-linux-drm=yes.mk1
-rw-r--r--mk/method-x-randr=yes.mk1
-rw-r--r--mk/method-x-vidmode=yes.mk1
6 files changed, 54 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 0664eb9..499a750 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,5 +8,7 @@
*.so.*
*.dll
*.dylib
+*.pc
+*.librarian
/config.h
/test
diff --git a/Makefile b/Makefile
index c8338f5..161893f 100644
--- a/Makefile
+++ b/Makefile
@@ -24,12 +24,20 @@ include mk/$(OS).mk
QUARTZ_CORE_GRAPHICS_METHOD = $(QUARTZ_CG_METHOD)
-include mk/method-x-randr=$(X_RANDR_METHOD).mk
-include mk/method-x-vidmode=$(X_VIDMODE_METHOD).mk
-include mk/method-linux-drm=$(LINUX_DRM_METHOD).mk
-include mk/method-w32-gdi=$(W32_GDI_METHOD).mk
-include mk/method-quartz-cg=$(QUARTZ_CORE_GRAPHICS_METHOD).mk
-include mk/method-dummy=$(DUMMY_METHOD).mk
+X_RANDR_CONF = mk/method-x-randr=$(X_RANDR_METHOD).mk
+X_VIDMODE_CONF = mk/method-x-vidmode=$(X_VIDMODE_METHOD).mk
+LINUX_DRM_CONF = mk/method-linux-drm=$(LINUX_DRM_METHOD).mk
+W32_GDI_CONF = mk/method-w32-gdi=$(W32_GDI_METHOD).mk
+QUARTZ_CG_CONF = mk/method-quartz-cg=$(QUARTZ_CORE_GRAPHICS_METHOD).mk
+DUMMY_CONF = mk/method-dummy=$(DUMMY_METHOD).mk
+
+include $(X_RANDR_CONF)
+include $(X_VIDMODE_CONF)
+include $(LINUX_DRM_CONF)
+include $(W32_GDI_CONF)
+include $(QUARTZ_CG_CONF)
+include $(DUMMY_CONF)
+METHOD_CONFS = $(X_RANDR_CONF) $(X_VIDMODE_CONF) $(LINUX_DRM_CONF) $(W32_GDI_CONF) $(QUARTZ_CG_CONF) $(DUMMY_CONF)
# Need to do it this way since += is not in the POSIX make
HDR_METHODS = $(HDR_X_RANDR) $(HDR_X_VIDMODE) $(HDR_LINUX_DRM)\
@@ -44,6 +52,8 @@ CFLAGS_METHODS = $(CFLAGS_X_RANDR) $(CFLAGS_X_VIDMODE) $(CFLAGS_LINUX_DRM)
$(CFLAGS_W32_GDI) $(CFLAGS_QUARTZ_GC) $(CFLAGS_DUMMY)
LDFLAGS_METHODS = $(LDFLAGS_X_RANDR) $(LDFLAGS_X_VIDMODE) $(LDFLAGS_LINUX_DRM)\
$(LDFLAGS_W32_GDI) $(LDFLAGS_QUARTZ_GC) $(LDFLAGS_DUMMY)
+DEPS_METHODS = $(DEPS_X_RANDR) $(DEPS_X_VIDMODE) $(DEPS_LINUX_DRM)\
+ $(DEPS_W32_GDI) $(DEPS_QUARTZ_GC) $(DEPS_DUMMY)
OBJ_PUBLIC =\
@@ -153,7 +163,7 @@ HDR =\
MAN7 = libgamma.7
-all: libgamma.a libgamma.$(LIBEXT) test
+all: libgamma.a libgamma.$(LIBEXT) test libgamma.pc libgamma.librarian
$(OBJ): $(@:.o=.c) $(HDR)
$(LOBJ): $(@:.lo=.c) $(HDR)
@@ -165,6 +175,30 @@ config.h: FORCE
printf '\n' >> $@~
if ! test -f $@ || ! test "$$(cat < $@)" = "$$(cat < $@~)"; then mv -- $@~ $@; fi
+libgamma.pc: config.h Makefile $(METHOD_CONFS)
+ printf '%s\n'\
+ prefix="$(PREFIX)"\
+ libdir='$${prefix}/lib'\
+ includedir='$${prefix}/include'\
+ ''\
+ 'Name: libgamma'\
+ 'Description: Display server abstraction layer for gamma ramps'\
+ 'Version: $(LIB_VERSION)'\
+ > $@
+ printf '%s\n'\
+ 'Cflags: -I$${includedir}'\
+ 'Libs: -L$${libdir} -lgamma'\
+ "Libs.private: $$(pkg-config --libs $(DEPS_METHODS)) $(LDFLAGS_QUARTZ_GC)"\
+ >> $@
+
+libgamma.librarian: config.h Makefile $(METHOD_CONFS)
+ printf '%s\n'\
+ "CPPFLAGS -I$(PREFIX)/include"\
+ "LDFLAGS -L$(PREFIX)/lib -lgamma $(LDFLAGS_QUARTZ_GC)"\
+ "static LDFLAGS -L$(PREFIX)/lib -lgamma"\
+ "deps $(DEPS_METHODS)"\
+ > $@
+
libgamma.a: $(OBJ)
-rm -f -- $@
$(AR) -rc $@ $(OBJ)
@@ -185,15 +219,19 @@ test.o: test.c libgamma.h
test: test.o libgamma.a
$(CC) -o $@ test.o libgamma.a $(LDFLAGS_METHODS) $(LDFLAGS)
-install: libgamma.a libgamma.$(LIBEXT)
+install: libgamma.a libgamma.$(LIBEXT) libgamma.pc libgamma.librarian
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib/"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include/"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/share/pkgconfig/"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/share/librarian/"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7/"
cp -- libgamma.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libgamma.$(LIBMINOREXT)"
ln -sf -- libgamma.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libgamma.$(LIBMAJOREXT)"
ln -sf -- libgamma.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libgamma.$(LIBEXT)"
cp -- libgamma.a "$(DESTDIR)$(PREFIX)/lib/"
cp -- libgamma.h "$(DESTDIR)$(PREFIX)/include/"
+ cp -- libgamma.pc "$(DESTDIR)$(PREFIX)/share/pkgconfig/"
+ cp -- libgamma.librarian "$(DESTDIR)$(PREFIX)/share/librarian/libgamma=$(LIB_VERSION)"
cp -- $(MAN7) "$(DESTDIR)$(MANPREFIX)/man7/"
uninstall:
@@ -202,10 +240,12 @@ uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgamma.$(LIBEXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libgamma.a"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libgamma.h"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/share/pkgconfig/libgamma.pc"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/share/librarian/libgamma=$(LIB_VERSION)"
-cd -- "$(DESTDIR)$(MANPREFIX)/man7/" && rm -f -- $(MAN7)
clean:
- -rm -f -- *.o *.lo *.su *.a *.$(LIBEXT) test config.h
+ -rm -f -- *.o *.lo *.su *.a *.$(LIBEXT) *.pc *.librarian test config.h
.SUFFIXES:
.SUFFIXES: .lo .o .c
diff --git a/TODO b/TODO
index 86f245e..7a8f583 100644
--- a/TODO
+++ b/TODO
@@ -7,6 +7,4 @@ Unsupported display servers:
Add hotplug support.
-Generate librarian and pkg-config files.
-
Replace use of atoi and atoll.
diff --git a/mk/method-linux-drm=yes.mk b/mk/method-linux-drm=yes.mk
index fcb8515..3867bf6 100644
--- a/mk/method-linux-drm=yes.mk
+++ b/mk/method-linux-drm=yes.mk
@@ -3,6 +3,7 @@ PARAMS_LINUX_DRM = LIBGAMMA_METHOD_LINUX_DRM linux_drm 16 ramps16
CPPFLAGS_LINUX_DRM = -DHAVE_LIBGAMMA_METHOD_LINUX_DRM
CFLAGS_LINUX_DRM = $$(pkg-config --cflags libdrm)
LDFLAGS_LINUX_DRM = $$(pkg-config --libs libdrm)
+DEPS_LINUX_DRM = libdrm
OBJ_LINUX_DRM =\
libgamma_linux_drm_method_capabilities.o\
diff --git a/mk/method-x-randr=yes.mk b/mk/method-x-randr=yes.mk
index 97add0d..0690df5 100644
--- a/mk/method-x-randr=yes.mk
+++ b/mk/method-x-randr=yes.mk
@@ -3,6 +3,7 @@ PARAMS_X_RANDR = LIBGAMMA_METHOD_X_RANDR x_randr 16 ramps16
CPPFLAGS_X_RANDR = -DHAVE_LIBGAMMA_METHOD_X_RANDR
CFLAGS_X_RANDR = $$(pkg-config --cflags xcb xcb-randr)
LDFLAGS_X_RANDR = $$(pkg-config --libs xcb xcb-randr)
+DEPS_X_RANDR = xcb xcb-randr
OBJ_X_RANDR =\
libgamma_x_randr_method_capabilities.o\
diff --git a/mk/method-x-vidmode=yes.mk b/mk/method-x-vidmode=yes.mk
index 8225a96..29181c1 100644
--- a/mk/method-x-vidmode=yes.mk
+++ b/mk/method-x-vidmode=yes.mk
@@ -3,6 +3,7 @@ PARAMS_X_VIDMODE = LIBGAMMA_METHOD_X_VIDMODE x_vidmode 16 ramps16
CPPFLAGS_X_VIDMODE = -DHAVE_LIBGAMMA_METHOD_X_VIDMODE
CFLAGS_X_VIDMODE = $$(pkg-config --cflags x11 xxf86vm)
LDFLAGS_X_VIDMODE = $$(pkg-config --libs x11 xxf86vm)
+DEPS_X_VIDMODE = x11 xxf86vm
OBJ_X_VIDMODE =\
libgamma_x_vidmode_method_capabilities.o\