mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
app/internal: use pkg-config for finding system headers and libraries
I've resisted relying on pkg-config in the hope that hard-coded include and library paths would suffice. However, apart from having to work around some distro-specific differences, building with hardcoded include paths fails when building on a buildroot: x86_64-buildroot-linux-gnu-gcc: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/include/wayland' (see #91) Andri mentions a workaround (prefixing paths with "="), but that doesn't seem to work on the BSDs. Let's see how pkg-config fares. It's an extra dependency, but it promises to keep us isolated from the varying paths on Linux distrobutions. Updates #91 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -12,8 +12,9 @@ import (
|
||||
)
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lwayland-egl
|
||||
#cgo CFLAGS: -I/usr/include/wayland -DMESA_EGL_NO_X11_HEADERS
|
||||
#cgo linux pkg-config: egl wayland-egl
|
||||
#cgo freebsd openbsd LDFLAGS: -lwayland-egl
|
||||
#cgo CFLAGS: -DMESA_EGL_NO_X11_HEADERS
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <wayland-client.h>
|
||||
|
||||
@@ -40,7 +40,8 @@ import (
|
||||
//go:generate sed -i "1s;^;// +build linux,!android,!nowayland freebsd\\n\\n;" wayland_text_input.c
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lwayland-client -lwayland-cursor
|
||||
#cgo linux pkg-config: wayland-client wayland-cursor
|
||||
#cgo freebsd openbsd LDFLAGS: -lwayland-client -lwayland-cursor
|
||||
#cgo freebsd CFLAGS: -I/usr/local/include
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/lib
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ package window
|
||||
/*
|
||||
#cgo openbsd CFLAGS: -I/usr/X11R6/include -I/usr/local/include
|
||||
#cgo openbsd LDFLAGS: -L/usr/X11R6/lib -L/usr/local/lib
|
||||
#cgo LDFLAGS: -lX11 -lxkbcommon -lxkbcommon-x11 -lX11-xcb
|
||||
#cgo freebsd openbsd LDFLAGS: -lX11 -lxkbcommon -lxkbcommon-x11 -lX11-xcb
|
||||
#cgo linux pkg-config: x11 xkbcommon xkbcommon-x11 x11-xcb
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
Reference in New Issue
Block a user