Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
426 changes: 426 additions & 0 deletions .github/workflows/ci-meson.yml

Large diffs are not rendered by default.

File renamed without changes.
42 changes: 21 additions & 21 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ In order to compile neard you need following software packages:
- GCC compiler
- D-Bus library
- GLib library
- Netlink (libnl) library, version 1 or 2.
- Netlink (libnl) library, version 3, 2, or 1.

neard uses the Meson build system and requires at least version 1.1.

To configure run:
./configure --prefix=/usr
meson setup builddir --prefix=/usr

Configure automatically searches for all required components and packages.
Meson automatically searches for all required components and packages.

To compile and install run:
make && make install
meson compile -C builddir
meson install -C builddir

Configuration and options
=========================

By default all neard plugins and features are built in. They can be
disabled with the following configuration options:

--disable-nfctype1
adjusted with the following configuration options, passed as
-Doption=value to meson setup (or changed later with meson configure):

Disable support for type 1 NFC tags.
-Dnfctypes=nfctype1,nfctype2,nfctype3,nfctype4,nfctype5

--disable-nfctype2
Select which NFC Forum tag types (1 to 5) to support.

Disable support for type 2 NFC tags.
-Dp2p=true|false

--disable-nfctype3
Enable or disable support for peer to peer mode.

Disable support for type 3 NFC tags.
-Dese=true|false

--disable-nfctype4
Enable or disable embedded Secure Element support.

Disable support for type 4 NFC tags.
-Dsystemd=auto|enabled|disabled

--disable-nfctype5
Install the systemd service file.

Disable support for type 5 ISO 15693 tags.
-Dtools=true|false

--disable-p2p
Build testing tools (nfctool, nciattach).

Disable support for peer to peer mode.
-Dtest=true|false

Running ./bootstrap-configure will build the configure script and then
run it, with maintainer mode enabled. bootstrap-configure will configure
neard with all features enabled.
Install test/example scripts.

Bugs and contributing
=====================
Expand Down
39 changes: 39 additions & 0 deletions ci/alpine.meson.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2019-2021 Petr Vorel <petr.vorel@gmail.com>
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
# Copyright (c) 2026 Krzysztof Kozlowski <krzk@kernel.org>
#

set -ex

apk update

PKGS_CC="gcc"
case $CC in
clang*)
# On Alpine v3.14 clang fails without gcc:
# cannot find crtbeginS.o: No such file or directory
PKGS_CC="clang gcc"
;;
esac

# Packages needed by CI
PKGS_MORE="file"

apk add \
binutils \
dbus-dev \
glib-dev \
libnl3-dev \
meson \
musl-dev \
ninja \
pkgconfig \
$PKGS_CC \
$PKGS_MORE

echo "Install finished: $0"
27 changes: 27 additions & 0 deletions ci/archlinux.meson.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
#

set -ex

PKGS_CC="gcc"
case $CC in
clang*)
PKGS_CC="clang"
;;
esac

pacman -Syu --noconfirm \
dbus \
glib2 \
libnl \
meson \
ninja \
pkg-config \
$PKGS_CC

echo "Install finished: $0"
31 changes: 31 additions & 0 deletions ci/debian.meson.cross-compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
# Copyright (c) 2025 Krzysztof Kozlowski <krzk@kernel.org>
#

set -ex

if [ -z "$ARCH" ]; then
echo "missing \$ARCH!" >&2
exit 1
fi

dpkg --add-architecture $ARCH
apt update

apt install -y --no-install-recommends \
libc6-dev-${ARCH}-cross

apt install -y --no-install-recommends \
libdbus-1-dev:${ARCH} \
libglib2.0-dev:${ARCH} \
libnl-3-dev:${ARCH} \
libnl-genl-3-dev:${ARCH} \
gcc-`dpkg-architecture -a ${ARCH} -q DEB_TARGET_GNU_TYPE`

echo "Install finished: $0"
27 changes: 27 additions & 0 deletions ci/debian.meson.i386.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
#

set -ex

dpkg --add-architecture i386
apt update

# gcc-multilib are also needed for clang 32-bit builds
PKGS_CC="gcc-multilib"

apt install -y --no-install-recommends \
linux-libc-dev:i386

apt install -y --no-install-recommends \
libdbus-1-dev:i386 \
libglib2.0-dev:i386 \
libnl-3-dev:i386 \
libnl-genl-3-dev:i386 \
$PKGS_CC

echo "Install finished: $0"
20 changes: 20 additions & 0 deletions ci/debian.meson.sanitizers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
# Copyright (c) 2025 Krzysztof Kozlowski <krzk@kernel.org>
#

set -ex

apt install -y --no-install-recommends \
liblsan0 \
libubsan1

apt install -y --no-install-recommends libasan8 || \
apt install -y --no-install-recommends libasan6 || \
apt install -y --no-install-recommends libasan5

echo "Install finished: $0"
49 changes: 49 additions & 0 deletions ci/debian.meson.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
#

set -ex

apt update

# Some distros (e.g. Ubuntu Hirsute) might pull tzdata which asks questions
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true

# Choose some random place in Europe
echo "tzdata tzdata/Areas select Europe
tzdata tzdata/Zones/Europe select Berlin
" > /tmp/tzdata-preseed.txt
debconf-set-selections /tmp/tzdata-preseed.txt

PKGS_CC="build-essential"
case $CC in
clang*)
PKGS_CC="clang"
;;
esac

apt install -y --no-install-recommends \
file \
libdbus-1-dev \
libglib2.0-dev \
libnl-3-dev \
libnl-genl-3-dev \
meson \
ninja-build \
pkg-config \
python3-pip \
$PKGS_CC

# Meson >= 1.1 is required. If the packaged version is older, install via pip.
MIN_MESON="1.1.0"
MESON_VER=$(meson --version 2>/dev/null || echo "0.0.0")
if dpkg --compare-versions "$MESON_VER" lt "$MIN_MESON"; then
pip3 install "meson>=$MIN_MESON" 2>/dev/null || \
pip3 install --break-system-packages "meson>=$MIN_MESON"
fi

echo "Install finished: $0"
31 changes: 31 additions & 0 deletions ci/fedora.meson.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
# <krzk@kernel.org>
#

set -ex

PKGS_CC="gcc"
case $CC in
clang*)
PKGS_CC="clang"
;;
esac

# Packages needed by CI
PKGS_MORE="file"

dnf -y install \
dbus-devel \
glib2-devel \
libnl3-devel \
meson \
ninja-build \
pkg-config \
$PKGS_CC \
$PKGS_MORE

echo "Install finished: $0"
1 change: 1 addition & 0 deletions ci/ubuntu.meson.cross-compile.sh
1 change: 1 addition & 0 deletions ci/ubuntu.meson.i386.sh
1 change: 1 addition & 0 deletions ci/ubuntu.meson.sanitizers.sh
1 change: 1 addition & 0 deletions ci/ubuntu.meson.sh
4 changes: 4 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install_man('neard.8', 'neard.conf.5')
if opt_tools
install_man('nfctool.1')
endif
9 changes: 9 additions & 0 deletions gdbus/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
gdbus_inc = include_directories('.')

gdbus_sources = files(
'mainloop.c',
'watch.c',
'object.c',
'client.c',
'polkit.c',
)
31 changes: 31 additions & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
include_files = files(
'adapter.h',
'dbus.h',
'device.h',
'log.h',
'ndef.h',
'nfc_copy.h',
'plugin.h',
'setting.h',
'snep.h',
'tag.h',
'tlv.h',
'types.h',
)

version_h_in = files('version.h.in')

install_headers(
'adapter.h',
'device.h',
'log.h',
'ndef.h',
'nfc_copy.h',
'plugin.h',
'setting.h',
'snep.h',
'tag.h',
'tlv.h',
'types.h',
subdir : 'near',
)
Loading
Loading