drop the old Makefile and update the docs

This commit is contained in:
Eric Engestrom 2019-12-24 10:33:54 +00:00 committed by Harry Jeffery
parent 2dd0c1469e
commit 04ef9440fb
9 changed files with 36 additions and 319 deletions

View file

@ -22,21 +22,9 @@ packages:
sources: sources:
- https://git.sr.ht/~exec64/imv - https://git.sr.ht/~exec64/imv
tasks: tasks:
- configure: | - gcc: |
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: |
CC=gcc meson imv build_gcc -D auto_features=enabled CC=gcc meson imv build_gcc -D auto_features=enabled
CC=gcc ninja -C build_gcc test CC=gcc ninja -C build_gcc test
- meson_clang: | - clang: |
CC=clang meson imv build_clang -D auto_features=enabled CC=clang meson imv build_clang -D auto_features=enabled
CC=clang ninja -C build_clang test CC=clang ninja -C build_clang test

View file

@ -22,27 +22,16 @@ packages:
sources: sources:
- https://git.sr.ht/~exec64/imv - https://git.sr.ht/~exec64/imv
tasks: tasks:
- configure: | - dummy: |
cd imv true
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
#FIXME: #FIXME:
# the old meson package in debian has a bug and crashes with # the old meson package in debian has a bug and crashes with
# our meson.build; re-enable this once debian packages a version # our meson.build; re-enable this once debian packages a version
# newer than 0.49.2 # 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 meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled
# CC=gcc ninja -C build_gcc test # 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 meson imv build_clang -D auto_features=enabled -D libnsgif=disabled
# CC=clang ninja -C build_clang test # CC=clang ninja -C build_clang test

View file

@ -22,23 +22,10 @@ packages:
sources: sources:
- https://git.sr.ht/~exec64/imv - https://git.sr.ht/~exec64/imv
tasks: tasks:
- configure: | # libnsgif isn't packaged by fedora
cd imv - gcc: |
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: |
CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled
CC=gcc ninja -C build_gcc test 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 meson imv build_clang -D auto_features=enabled -D libnsgif=disabled
CC=clang ninja -C build_clang test CC=clang ninja -C build_clang test

View file

@ -1,6 +1,5 @@
image: freebsd/latest image: freebsd/latest
packages: packages:
- devel/gmake
- devel/icu - devel/icu
- devel/meson - devel/meson
- devel/pkgconf - devel/pkgconf
@ -19,12 +18,6 @@ packages:
sources: sources:
- https://git.sr.ht/~exec64/imv - https://git.sr.ht/~exec64/imv
tasks: tasks:
- make: |
cd imv
sed -i -e 's/BACKEND_\(.*\)=no/BACKEND_\1=yes/' config.mk
cat config.mk
gmake
gmake check
- meson: | - meson: |
meson imv build -D auto_features=enabled -D c_link_args='-L/usr/local/lib' meson imv build -D auto_features=enabled -D c_link_args='-L/usr/local/lib'
ninja -C build test ninja -C build test

View file

@ -22,23 +22,10 @@ packages:
sources: sources:
- https://git.sr.ht/~exec64/imv - https://git.sr.ht/~exec64/imv
tasks: tasks:
- configure: | # libnsgif isn't packaged by ubuntu
cd imv - gcc: |
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: |
CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled CC=gcc meson imv build_gcc -D auto_features=enabled -D libnsgif=disabled
CC=gcc ninja -C build_gcc test 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 meson imv build_clang -D auto_features=enabled -D libnsgif=disabled
CC=clang ninja -C build_clang test CC=clang ninja -C build_clang test

187
Makefile
View file

@ -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."

View file

@ -3,20 +3,23 @@
This document is a quick summary of all you need to know to package imv for This document is a quick summary of all you need to know to package imv for
your favourite operating system. 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, 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 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. 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 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 by passing `-D windows=wayland` to `meson`, in which case only that
without the need for a launcher script to select between the two. 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 Alternatively, you could provide separate packages for X11 and Wayland that
act as alternatives to each other. 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 imv supports multiple "backends" in a plugin style architecture. Each backend
provides support for different image formats using different underlying 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 imv is published under the MIT license, but its backends may have different
licensing requirements. licensing requirements.
You can configure the backends to use in [config.mk](config.mk). Sensible By default, the libraries available are detected and support for them is
defaults are pre-configured to provide maximum coverage with the least overlap automatically enabled, but you can enable or disable specific ones by
and fewest dependencies. 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 Once your backends have been configured and you've confirmed the library
each backend uses is installed, you can simply follow the Installation section each backend uses is installed, you can simply follow the Installation section
of the [README](README.md) to build imv. 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 the resulting binary and man pages in your operating system's native
package format. package format.

View file

@ -133,21 +133,21 @@ Installation
| libpng | | Optional. Provides PNG support. | | libpng | | Optional. Provides PNG support. |
| libjpeg-turbo | | Optional. Provides JPEG support. | | libjpeg-turbo | | Optional. Provides JPEG support. |
| librsvg | >=v2.44 | Optional. Provides SVG 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 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 when building `imv`. You can find a summary of which backends are available
control which ones `imv` is built with in [config.mk](config.mk) in [meson_options.txt](meson_options.txt)
$ $EDITOR config.mk $ meson builddir/
$ make $ ninja -C builddir/
# make install # ninja -C builddir/ install
Macro `PREFIX` controls installation prefix. If more control over installation `--prefix` controls installation prefix. If more control over installation
paths is required, macros `BINPREFIX`, `MANPREFIX` and `DATAPREFIX` are paths is required, `--bindir`, `--mandir` and `--datadir` are
available. Eg. to install `imv` to home directory, run: available. Eg. to install `imv` to home directory, run:
$ BINPREFIX=~/bin PREFIX=~/.local make install $ meson --bindir=~/bin --prefix=~/.local
License License
------- -------

View file

@ -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