From 04ef9440fb079736020d796142de18008da3ba62 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Tue, 24 Dec 2019 10:33:54 +0000 Subject: drop the old Makefile and update the docs --- .builds/archlinux.yml | 16 +---- .builds/debian.yml | 21 ++---- .builds/fedora.yml | 19 +---- .builds/freebsd.yml | 7 -- .builds/ubuntu.yml | 19 +---- Makefile | 187 -------------------------------------------------- PACKAGERS.md | 23 ++++--- README.md | 18 ++--- config.mk | 45 ------------ 9 files changed, 36 insertions(+), 319 deletions(-) delete mode 100644 Makefile delete mode 100644 config.mk diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml index 1dc2585..4038414 100644 --- a/.builds/archlinux.yml +++ b/.builds/archlinux.yml @@ -22,21 +22,9 @@ packages: sources: - https://git.sr.ht/~exec64/imv tasks: - - configure: | - cd imv - sed -i -e 's/BACKEND_\(.*\)=no/BACKEND_\1=yes/' config.mk - cat config.mk - - make_gcc: | - cd imv - CC=gcc BUILDDIR=gcc make - CC=gcc BUILDDIR=gcc make check - - make_clang: | - cd imv - CC=clang BUILDDIR=clang make - CC=clang BUILDDIR=clang make check - - meson_gcc: | + - gcc: | CC=gcc meson imv build_gcc -D auto_features=enabled CC=gcc ninja -C build_gcc test - - meson_clang: | + - clang: | CC=clang meson imv build_clang -D auto_features=enabled CC=clang ninja -C build_clang test diff --git a/.builds/debian.yml b/.builds/debian.yml index 2a379ac..08bc065 100644 --- a/.builds/debian.yml +++ b/.builds/debian.yml @@ -22,27 +22,16 @@ packages: sources: - https://git.sr.ht/~exec64/imv tasks: - - configure: | - cd imv - sed -i -e 's/BACKEND_\(.*\)=no/BACKEND_\1=yes/' config.mk - # libnsgif isn't packaged by debian - sed -i -e 's/BACKEND_LIBNSGIF=yes/BACKEND_LIBNSGIF=no/' config.mk - cat config.mk - - make_gcc: | - cd imv - CC=gcc BUILDDIR=gcc make - CC=gcc BUILDDIR=gcc make check - - make_clang: | - cd imv - CC=clang BUILDDIR=clang make - CC=clang BUILDDIR=clang make check + - dummy: | + true #FIXME: # the old meson package in debian has a bug and crashes with # our meson.build; re-enable this once debian packages a version # newer than 0.49.2 -# - meson_gcc: | + # libnsgif isn't packaged by debian +# - gcc: | # CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled # CC=gcc ninja -C build_gcc test -# - meson_clang: | +# - clang: | # CC=clang meson imv build_clang -D auto_features=enabled -D libnsgif=disabled # CC=clang ninja -C build_clang test diff --git a/.builds/fedora.yml b/.builds/fedora.yml index 2dea9c8..7e275ed 100644 --- a/.builds/fedora.yml +++ b/.builds/fedora.yml @@ -22,23 +22,10 @@ packages: sources: - https://git.sr.ht/~exec64/imv tasks: - - configure: | - cd imv - sed -i -e 's/BACKEND_\(.*\)=no/BACKEND_\1=yes/' config.mk - # libnsgif isn't packaged by fedora - sed -i -e 's/BACKEND_LIBNSGIF=yes/BACKEND_LIBNSGIF=no/' config.mk - cat config.mk - - make_gcc: | - cd imv - CC=gcc BUILDDIR=gcc make - CC=gcc BUILDDIR=gcc make check - - make_clang: | - cd imv - CC=clang BUILDDIR=clang make - CC=clang BUILDDIR=clang make check - - meson_gcc: | + # libnsgif isn't packaged by fedora + - gcc: | CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled CC=gcc ninja -C build_gcc test - - meson_clang: | + - clang: | CC=clang meson imv build_clang -D auto_features=enabled -D libnsgif=disabled CC=clang ninja -C build_clang test diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 513652b..97193d7 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -1,6 +1,5 @@ image: freebsd/latest packages: - - devel/gmake - devel/icu - devel/meson - devel/pkgconf @@ -19,12 +18,6 @@ packages: sources: - https://git.sr.ht/~exec64/imv tasks: - - make: | - cd imv - sed -i -e 's/BACKEND_\(.*\)=no/BACKEND_\1=yes/' config.mk - cat config.mk - gmake - gmake check - meson: | meson imv build -D auto_features=enabled -D c_link_args='-L/usr/local/lib' ninja -C build test diff --git a/.builds/ubuntu.yml b/.builds/ubuntu.yml index 534573a..cc35286 100644 --- a/.builds/ubuntu.yml +++ b/.builds/ubuntu.yml @@ -22,23 +22,10 @@ packages: sources: - https://git.sr.ht/~exec64/imv tasks: - - configure: | - cd imv - sed -i -e 's/BACKEND_\(.*\)=no/BACKEND_\1=yes/' config.mk - # libnsgif isn't packaged by ubuntu - sed -i -e 's/BACKEND_LIBNSGIF=yes/BACKEND_LIBNSGIF=no/' config.mk - cat config.mk - - make_gcc: | - cd imv - CC=gcc BUILDDIR=gcc make - CC=gcc BUILDDIR=gcc make check - - make_clang: | - cd imv - CC=clang BUILDDIR=clang make - CC=clang BUILDDIR=clang make check - - meson_gcc: | + # libnsgif isn't packaged by ubuntu + - gcc: | CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled CC=gcc ninja -C build_gcc test - - meson_clang: | + - clang: | CC=clang meson imv build_clang -D auto_features=enabled -D libnsgif=disabled CC=clang ninja -C build_clang test diff --git a/Makefile b/Makefile deleted file mode 100644 index e5acdde..0000000 --- a/Makefile +++ /dev/null @@ -1,187 +0,0 @@ -.PHONY: all imv debug clean check install uninstall doc - -include config.mk - -PREFIX ?= /usr -BINPREFIX ?= $(PREFIX)/bin -MANPREFIX ?= $(PREFIX)/share/man -DATAPREFIX ?= $(PREFIX)/share -CONFIGPREFIX ?= /etc - -INSTALL_DATA ?= install -m 0644 -INSTALL_MAN ?= install -m 0644 -INSTALL_PROGRAM ?= install -m 0755 -INSTALL_SCRIPT ?= install -m 0755 - -override CFLAGS += -std=c99 -W -Wall -Wpedantic -Wextra $(shell pkg-config --cflags pangocairo) -override CPPFLAGS += -D_XOPEN_SOURCE=700 -override LIBS := -lGL -lpthread -lxkbcommon $(shell pkg-config --libs pangocairo) $(shell pkg-config --libs icu-io) - -BUILDDIR ?= build -TARGET_WAYLAND = $(BUILDDIR)/imv-wayland -TARGET_X11 = $(BUILDDIR)/imv-x11 -TARGET_MSG = $(BUILDDIR)/imv-msg - -ifeq ($(WINDOWS),wayland) - TARGETS := $(TARGET_WAYLAND) $(TARGET_MSG) -else ifeq ($(WINDOWS),x11) - TARGETS := $(TARGET_X11) $(TARGET_MSG) -else ifeq ($(WINDOWS),all) - TARGETS := $(TARGET_WAYLAND) $(TARGET_X11) $(TARGET_MSG) -endif - -SOURCES := src/main.c - -SOURCES += src/binds.c -SOURCES += src/bitmap.c -SOURCES += src/canvas.c -SOURCES += src/commands.c -SOURCES += src/console.c -SOURCES += src/image.c -SOURCES += src/imv.c -SOURCES += src/ini.c -SOURCES += src/ipc.c -SOURCES += src/ipc_common.c -SOURCES += src/keyboard.c -SOURCES += src/list.c -SOURCES += src/log.c -SOURCES += src/navigator.c -SOURCES += src/source.c -SOURCES += src/viewport.c - -WL_SOURCES = src/wl_window.c src/xdg-shell-protocol.c -WL_LIBS = -lwayland-client -lwayland-egl -lEGL -lrt - -X11_SOURCES = src/x11_window.c -X11_LIBS = -lX11 -lGL -lGLU -lxcb -lxkbcommon-x11 - -MSG_SOURCES = src/imv_msg.c src/ipc_common.c -MSG_LIBS = - -# Add backends to build as configured -ifeq ($(BACKEND_FREEIMAGE),yes) - SOURCES += src/backend_freeimage.c - override CPPFLAGS += -DIMV_BACKEND_FREEIMAGE - override LIBS += -lfreeimage -endif - -ifeq ($(BACKEND_LIBTIFF),yes) - SOURCES += src/backend_libtiff.c - override CPPFLAGS += -DIMV_BACKEND_LIBTIFF - override LIBS += -ltiff -endif - -ifeq ($(BACKEND_LIBPNG),yes) - SOURCES += src/backend_libpng.c - override CPPFLAGS += -DIMV_BACKEND_LIBPNG - override LIBS += -lpng -endif - -ifeq ($(BACKEND_LIBJPEG),yes) - SOURCES += src/backend_libjpeg.c - override CPPFLAGS += -DIMV_BACKEND_LIBJPEG - override LIBS += -lturbojpeg -endif - -ifeq ($(BACKEND_LIBRSVG),yes) - SOURCES += src/backend_librsvg.c - override CPPFLAGS += -DIMV_BACKEND_LIBRSVG $(shell pkg-config --cflags librsvg-2.0) - override LIBS += $(shell pkg-config --libs librsvg-2.0) -endif - -ifeq ($(BACKEND_LIBNSGIF),yes) - SOURCES += src/backend_libnsgif.c - override CPPFLAGS += -DIMV_BACKEND_LIBNSGIF $(shell pkg-config --cflags libnsgif) - override LIBS += $(shell pkg-config --libs libnsgif) -endif - - -TEST_SOURCES := test/list.c test/navigator.c - -OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES)) -WL_OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(WL_SOURCES)) -X11_OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(X11_SOURCES)) -MSG_OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(MSG_SOURCES)) - -TESTS := $(patsubst test/%.c,$(BUILDDIR)/test_%,$(TEST_SOURCES)) - -VERSION != git describe --dirty --always --tags 2> /dev/null || echo v4.1.0 - -override CPPFLAGS += -DIMV_VERSION=\""$(VERSION)"\" - -TFLAGS ?= -g $(CFLAGS) $(CPPFLAGS) $(shell pkg-config --cflags cmocka) -TLIBS := $(LIBS) $(shell pkg-config --libs cmocka) - -all: imv doc - -imv: $(TARGETS) - -$(TARGET_WAYLAND): $(OBJECTS) $(WL_OBJECTS) - $(CC) -o $@ $^ $(LIBS) $(WL_LIBS) $(LDFLAGS) - -$(TARGET_X11): $(OBJECTS) $(X11_OBJECTS) - $(CC) -o $@ $^ $(LIBS) $(X11_LIBS) $(LDFLAGS) - -$(TARGET_MSG): $(MSG_OBJECTS) - $(CC) -o $@ $^ $(MSG_LIBS) $(LDFLAGS) - -debug: CFLAGS += -DDEBUG -g -pg -debug: $(TARGETS) - -$(OBJECTS): | $(BUILDDIR) - -$(BUILDDIR): - mkdir -p $(BUILDDIR) - -$(BUILDDIR)/%.o: src/%.c Makefile - $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< - -$(BUILDDIR)/test_%: test/%.c src/dummy_window.c $(filter-out src/main.c, $(SOURCES)) - $(CC) -o $@ -Isrc $(TFLAGS) $^ $(LDFLAGS) $(TLIBS) - -check: $(BUILDDIR) $(TESTS) - for t in $(TESTS); do $$t; done - -clean: - $(RM) -Rf $(BUILDDIR) - $(RM) doc/imv.1 doc/imv-msg.1 doc/imv.5 - -doc: doc/imv.1 doc/imv-msg.1 doc/imv.5 - -doc/%: doc/%.txt - a2x --no-xmllint --doctype manpage --format manpage $< - -install: $(TARGETS) doc - mkdir -p $(DESTDIR)$(BINPREFIX) -ifeq ($(WINDOWS),wayland) - $(INSTALL_PROGRAM) $(TARGET_WAYLAND) $(DESTDIR)$(BINPREFIX)/imv -else ifeq ($(WINDOWS),x11) - $(INSTALL_PROGRAM) $(TARGET_X11) $(DESTDIR)$(BINPREFIX)/imv -else ifeq ($(WINDOWS),all) - $(INSTALL_PROGRAM) $(TARGET_WAYLAND) $(DESTDIR)$(BINPREFIX)/imv-wayland - $(INSTALL_PROGRAM) $(TARGET_X11) $(DESTDIR)$(BINPREFIX)/imv-x11 - $(INSTALL_SCRIPT) files/imv $(DESTDIR)$(BINPREFIX)/imv -endif - $(INSTALL_PROGRAM) $(TARGET_MSG) $(DESTDIR)$(BINPREFIX)/imv-msg - mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - $(INSTALL_MAN) doc/imv.1 $(DESTDIR)$(MANPREFIX)/man1/imv.1 - $(INSTALL_MAN) doc/imv-msg.1 $(DESTDIR)$(MANPREFIX)/man1/imv-msg.1 - mkdir -p $(DESTDIR)$(MANPREFIX)/man5 - $(INSTALL_MAN) doc/imv.5 $(DESTDIR)$(MANPREFIX)/man5/imv.5 - mkdir -p $(DESTDIR)$(DATAPREFIX)/applications - $(INSTALL_DATA) files/imv.desktop $(DESTDIR)$(DATAPREFIX)/applications/imv.desktop - mkdir -p $(DESTDIR)$(CONFIGPREFIX) - $(INSTALL_DATA) files/imv_config $(DESTDIR)$(CONFIGPREFIX)/imv_config - -uninstall: -ifeq ($(WINDOWS),all) - $(RM) $(DESTDIR)$(BINPREFIX)/imv-wayland - $(RM) $(DESTDIR)$(BINPREFIX)/imv-x11 -endif - $(RM) $(DESTDIR)$(BINPREFIX)/imv - $(RM) $(DESTDIR)$(BINPREFIX)/imv-msg - $(RM) $(DESTDIR)$(MANPREFIX)/man1/imv.1 - $(RM) $(DESTDIR)$(MANPREFIX)/man1/imv-msg.1 - $(RM) $(DESTDIR)$(MANPREFIX)/man5/imv.5 - $(RM) $(DESTDIR)$(DATAPREFIX)/applications/imv.desktop - @echo "$(DESTDIR)$(CONFIGPREFIX)/imv_config has not been removed. Please remove it manually." diff --git a/PACKAGERS.md b/PACKAGERS.md index aaa08b1..11c8fc0 100644 --- a/PACKAGERS.md +++ b/PACKAGERS.md @@ -3,20 +3,23 @@ This document is a quick summary of all you need to know to package imv for your favourite operating system. -## 1. Select window systems to support +## Configuring `imv` + +### 1. Select window systems to support Your options here are Wayland or X11, or both. By default both are included, with a separate binary for each being built. `/usr/bin/imv` will be a script that checks for a Wayland compositor before running the appropriate binary. If you only care about one of these, you can specify to build only one of these -in [config.mk](config.mk), in which case only that binary shall be packaged -without the need for a launcher script to select between the two. +by passing `-D windows=wayland` to `meson`, in which case only that +binary shall be packaged without the need for a launcher script to +select between the two. Alternatively, you could provide separate packages for X11 and Wayland that act as alternatives to each other. -## 2. Select backends to include +### 2. Select backends to include imv supports multiple "backends" in a plugin style architecture. Each backend provides support for different image formats using different underlying @@ -26,17 +29,19 @@ formats you need support for, and your licensing requirements. imv is published under the MIT license, but its backends may have different licensing requirements. -You can configure the backends to use in [config.mk](config.mk). Sensible -defaults are pre-configured to provide maximum coverage with the least overlap -and fewest dependencies. +By default, the libraries available are detected and support for them is +automatically enabled, but you can enable or disable specific ones by +passing `-D freeimage=enabled` or `-D libtiff=disabled`. +You can also make sure all the backends are enabled by passing +`-D auto_features=enabled`. -## 3. $ make && make install +## Building `imv` Once your backends have been configured and you've confirmed the library each backend uses is installed, you can simply follow the Installation section of the [README](README.md) to build imv. -## 4. Package +## Packaging `imv` Package the resulting binary and man pages in your operating system's native package format. diff --git a/README.md b/README.md index dacabcb..ba3e42e 100644 --- a/README.md +++ b/README.md @@ -133,21 +133,21 @@ Installation | libpng | | Optional. Provides PNG support. | | libjpeg-turbo | | Optional. Provides JPEG support. | | librsvg | >=v2.44 | Optional. Provides SVG support. | -| libnsgif | | Optional. Provides GIF support. | +| libnsgif | | Optional. Provides animated GIF support. | Dependencies are determined by which backends and window systems are enabled -when building `imv`. You can find a summary of which backends are available and -control which ones `imv` is built with in [config.mk](config.mk) +when building `imv`. You can find a summary of which backends are available +in [meson_options.txt](meson_options.txt) - $ $EDITOR config.mk - $ make - # make install + $ meson builddir/ + $ ninja -C builddir/ + # ninja -C builddir/ install -Macro `PREFIX` controls installation prefix. If more control over installation -paths is required, macros `BINPREFIX`, `MANPREFIX` and `DATAPREFIX` are +`--prefix` controls installation prefix. If more control over installation +paths is required, `--bindir`, `--mandir` and `--datadir` are available. Eg. to install `imv` to home directory, run: - $ BINPREFIX=~/bin PREFIX=~/.local make install + $ meson --bindir=~/bin --prefix=~/.local License ------- diff --git a/config.mk b/config.mk deleted file mode 100644 index a9c5941..0000000 --- a/config.mk +++ /dev/null @@ -1,45 +0,0 @@ -# Configure window system to use - -#Choices: -# all - Build both, determine which to use at runtime -# wayland - Only provide Wayland support -# x11 - Only provide X11 support -WINDOWS=all - -# Configure available backends: - -# FreeImage http://freeimage.sourceforge.net -# provides: png, jpg, animated gif, raw, psd, bmp, tiff, webp, etc. -# depends: libjpeg, openexr, openjpeg2, libwebp, libraw, jxrlib -# license: FIPL v1.0 -BACKEND_FREEIMAGE=yes - -# libtiff -# provides: tiff -# depends: libjpeg zlib xz zstd -# license: MIT -BACKEND_LIBTIFF=no - -# libpng http://www.libpng.org/pub/png/libpng.html -# provides: png -# depends: zlib -# license: libpng license -BACKEND_LIBPNG=no - -# libjpeg-turbo https://libjpeg-turbo.org/ -# provides: jpeg -# depends: none -# license: modified bsd -BACKEND_LIBJPEG=no - -# librsvg https://wiki.gnome.org/Projects/LibRsvg -# provides: svg -# depends: gdk-pixbuf2 pango libcroco -# license: LGPL -BACKEND_LIBRSVG=yes - -# libnsgif https://www.netsurf-browser.org/projects/libnsgif/ -# provides: animated gif -# depends: none -# license: MIT -BACKEND_LIBNSGIF=no -- cgit v1.2.3