+++ /dev/null
-CC ?= gcc
-CXX ?= g++
-CXXFLAGS ?= -O2 -g -Wall -std=gnu++17
-CPPFLAGS=-ITurboPFor-Integer-Compression/
-LDFLAGS ?=
-INSTALL ?= install
-PREFIX ?= /usr/local
-URING_LIBS = $(shell pkg-config --libs liburing)
-
-ifeq ($(URING_LIBS),)
- CPPFLAGS += -DWITHOUT_URING
-endif
-
-all: plocate plocate-build
-
-plocate: plocate.o io_uring_engine.o
- $(CXX) -o $@ $^ -lzstd $(URING_LIBS) $(LDFLAGS)
-
-plocate-build: plocate-build.o
- $(CXX) -o $@ $^ -lzstd $(LDFLAGS)
-
-clean:
- $(RM) plocate.o plocate-build.o io_uring_engine.o bench.o plocate plocate-build bench
- ! [ -d TurboPFor-Integer-Compression/ ] || ( cd TurboPFor-Integer-Compression/ && $(MAKE) clean )
-
-install: all
- $(INSTALL) -m 2755 -g mlocate plocate $(PREFIX)/bin/
- $(INSTALL) -m 0755 plocate-build $(PREFIX)/sbin/
- $(INSTALL) -m 0755 update-plocate.sh /etc/cron.daily/plocate
-
-bench.o: bench.cpp turbopfor.h
-
-TurboPFor-Integer-Compression/libic.a:
- cd TurboPFor-Integer-Compression/ && $(MAKE)
-
-bench: bench.o io_uring_engine.o TurboPFor-Integer-Compression/libic.a
- $(CXX) -o $@ $^ $(URING_LIBS) $(LDFLAGS)
-
-.PHONY: clean install
and making a much faster index. Does not support querying by regex,
case-insensitivity or really any options.
-Alpha stage; file format is subject to change. To build, run make.
+Alpha stage; file format is subject to change. To build, run
+
+ meson obj
+ cd obj
+ ninja
If you wish to run some tests of the TurboPFor implementation against
the reference implementation, you can run:
git clone https://github.com/powturbo/TurboPFor-Integer-Compression
- make -j8 bench
+ ( cd TurboPFor-Integer-Compression && make -j8 )
+ cd obj
+ ninja reconfigure
+ ninja bench
Copyright 2020 Steinar H. Gunderson <steinar+git@gunderson.no>.
Licensed under the GNU General Public License, either version 2,
--- /dev/null
+project('plocate', 'cpp', default_options: ['buildtype=debugoptimized','cpp_std=c++17'], version: '1.0.0-pre')
+
+cxx = meson.get_compiler('cpp')
+uringdep = dependency('liburing', required: false)
+zstddep = dependency('libzstd')
+
+if not uringdep.found()
+ add_project_arguments('-DWITHOUT_URING', language: 'cpp')
+endif
+
+executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp'],
+ dependencies: [uringdep, zstddep],
+ install: true,
+ install_mode: ['rwxr-sr-x', 'root', 'mlocate'])
+executable('plocate-build', 'plocate-build.cpp',
+ dependencies: [zstddep],
+ install: true,
+ install_dir: get_option('sbindir'))
+
+install_data('update-plocate.sh',
+ install_dir: '/etc/cron.daily',
+ rename: 'plocate')
+
+# Requires having TurboPFor checked out, so not built by default.
+# Unless you have a recent Meson, there's no apparently good way
+# of calling into that directory to run make, and we're not
+# replicating their build system, so it has to be manual.
+pfordir = meson.source_root() + '/TurboPFor-Integer-Compression'
+if run_command('[', '-r', pfordir + '/libic.a', ']').returncode() == 0
+ turbopfordep = declare_dependency(
+ include_directories: include_directories('TurboPFor-Integer-Compression'),
+ dependencies: meson.get_compiler('cpp').find_library('ic', dirs: pfordir))
+ executable('bench', ['bench.cpp', 'io_uring_engine.cpp'],
+ dependencies: [uringdep, turbopfordep],
+ build_by_default: false,
+ install: false)
+endif