#!/bin/bash

URL=https://github.com/libbpf/libbpf.git

unset CDPATH
cd $1
rm -rf libbpf
git clone --depth=1 ${URL}
cd libbpf
git fetch --depth=1 origin $2 || {
    echo "commit $2 does not exists in ${URL}"
    exit 1
}
git checkout $2

# This is needed because we haven't built libbpf yet
# and this is where the headers will end up
mkdir src/usr
mkdir src/usr/include
