* +libnl

* added configure

* fixes

* fixed url

ofc, it's a string formatting issue

* bison & flex

bison & flex. only linux

* Write permission

chmod +w

* Update package.yml

* Update package.yml

* Add test

* Update package.yml

* Update package.yml

* ugh

file names

* double ugh

./fixture.c

* Permission

* odd compiler error

* Update package.yml

---------

Co-authored-by: Jacob Heider <jacob@tea.xyz>
This commit is contained in:
Sanchit Ram Arvind 2023-05-23 08:25:56 +05:30 committed by GitHub
parent c90d84ce65
commit cbe7856889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,29 @@
#include <netlink/netlink.h>
#include <netlink/route/link.h>
#include <linux/netlink.h>
int main(int argc, char *argv[]) {
struct rtnl_link *link;
struct nl_sock *sk;
int err;
sk = nl_socket_alloc();
if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) {
nl_perror(err, "Unable to connect socket");
return err;
}
link = rtnl_link_alloc();
rtnl_link_set_name(link, "my_bond");
if ((err = rtnl_link_delete(sk, link)) < 0) {
nl_perror(err, "Unable to delete link");
return err;
}
rtnl_link_put(link);
nl_close(sk);
return 0;
}

View file

@ -0,0 +1,44 @@
distributable:
url: https://github.com/thom311/libnl/releases/download/libnl{{version.major}}_{{version.minor}}_{{version.patch}}/libnl-{{version}}.tar.gz
strip-components: 1
display-name: libnl
versions:
github: thom311/libnl
strip: /^libnl/
platforms:
- linux
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
gnu.org/bison: '*'
github.com/westes/flex: '*'
script:
- ./configure $ARGS
- make --jobs {{ hw.concurrency }} install
- |
cd "{{prefix}}/include"
mv libnl3/* .
rmdir libnl3
ln -s . linl3
env:
ARGS:
- --prefix="{{prefix}}"
- --disable-silent-rules
test:
dependencies:
tea.xyz/gx/cc: c99
script:
- gcc ./fixture.c -lnl-3 -lnl-route-3 -o test
- (./test 2>&1 || true) | grep "$OUT"
- nl-route-list | grep "$OUT2"
env:
OUT: "Unable to delete link: Operation not permitted"
OUT2: inet 127.0.0.1