summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f317aca9ca06e5c2359fe5e16887d1e8d2695f81 (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
# Maintainer: Mohammad Mostafa Farzan <m2_farzan@yahoo.com>
# Acknowledgment: This work is hugely based on `ros2-arch-deps` AUR
# package, maintained by T. Borgert.

pkgname=ros2-git
pkgver=r216.0e58b2b
pkgrel=1
pkgdesc="A set of software libraries and tools for building robot applications (Rolling Distro)"
url="https://docs.ros.org/en/rolling/"
arch=('any')
license=('Apache')
depends=('ros2-arch-deps'
         'gmock'
         'sip4'
         # AUR
         'foonathan_memory'
         )
source=("ros2::git+https://github.com/ros2/ros2#branch=master"
        "mimick_vendor.patch"
        "yaml_cpp_vendor.patch")
sha256sums=('SKIP'
            'SKIP'
            'SKIP')

install=ros2-git.install

pkgver() {
  cd $srcdir/ros2
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    # Check locale
    locale | grep LANG | grep UTF-8
    if [[ $? -ne 0 ]]; then
        printf "Locale must support UTF-8. See https://wiki.archlinux.org/index.php/locale
        or https://wiki.archlinux.org/index.php/locale ."
        exit 1
    fi

    # Create required symlinks (see https://wiki.archlinux.org/index.php/ROS)
    sudo mkdir -p /usr/share/sip
    sudo ln -sf /usr/lib/python3.9/site-packages/PyQt5 /usr/share/sip/.
    sudo ln -sf /usr/lib/python3.9/site-packages/PyQt5/bindings/* /usr/share/sip/PyQt5/.

    # Clone the repos
    mkdir -p $srcdir/ros2/src
    vcs import $srcdir/ros2/src < $srcdir/ros2/ros2.repos

    # Fix some issues in the code (TODO: Gradually move to upstream)
    ## mimick_vendor:
    patch --forward $srcdir/ros2/src/ros2/mimick_vendor/CMakeLists.txt mimick_vendor.patch || true
    ## yaml_cpp_vendor:
    patch --forward $srcdir/ros2/src/ros2/yaml_cpp_vendor/CMakeLists.txt yaml_cpp_vendor.patch || true
}

build() {
    colcon build --merge-install
}

package() {
    mkdir -p $pkgdir/opt/ros2/rolling
    cp -r $srcdir/install/* $pkgdir/opt/ros2/rolling/
}