summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8059dea742f235f7b9df404e0fd27245262894a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Maintainer: taotieren <admin@taotieren.com>

pkgbase=libethercat
pkgname=(libethercat{,-tools})
_tagname=0.7.7-rev0
pkgver="${_tagname//-/_}"
pkgrel=2
pkgdesc="EtherCAT master library. This library is used to build a deterministic fieldbus network with EtherCAT components."
arch=($CARCH)
url="https://github.com/robert-burger/libethercat"
license=('LGPL-3.0-only')
groups=()
replaces=()
depends=(
    glibc
    libosal)
makedepends=(
    cmake
    git
    pkgconf
)
checkdepends=()
optdepends=()
source=("${pkgbase}::git+${url}.git#tag=${_tagname}")
sha256sums=('7f5c6974195ad9134bfb55f5179f3e74a1c61145dcadf7edcd2b1de88682ee3b')
options=()

build() {
    cd "${srcdir}/${pkgbase}/"

    # see:https://wiki.archlinux.org/title/CMake_package_guidelines
    # gcc build
    #     cmake -DCMAKE_BUILD_TYPE=Release \
    cmake -DCMAKE_BUILD_TYPE=None \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DBUILD_SHARED_LIBS=ON \
        -DECAT_DEVICE="sock_raw+sock_raw_mmaped" \
        -Wno-dev \
        -B build

     cmake --build build
}

check() {
    cd "${srcdir}/${pkgbase}"
    ctest --test-dir build --output-on-failure
}

package_libethercat() {
    provides=(${pkgname}
        libethercat.so)
    conflicts=(${pkgname}
        libethercat.so)

    DESTDIR="${pkgdir}" cmake --install "${srcdir}"/${pkgbase}/build

    #cd "${srcdir}/${pkgname}/build"
    #make DESTDIR=${pkgdir} install
}

package_libethercat-tools() {
    provides=(${pkgname} eepromtool ethercatdiag example-with-dc foe-tool)
    conflicts=(${pkgname} eepromtool ethercatdiag example-with-dc foe-tool)
    depends+=(libethercat.so)

    cd "${srcdir}/${pkgbase}/build"
    install -Dvm755 -t ${pkgdir}/usr/bin eepromtool
    install -Dvm755 -t ${pkgdir}/usr/bin ethercatdiag
    install -Dvm755 example_with_dc ${pkgdir}/usr/bin/example-with-dc
    install -Dvm755 foe_tool ${pkgdir}/usr/bin/foe-tool
}