~emersion/go-drm

7e4974e174c464f47874d45ecca5ef0e1b1c6829 — Simon Ser 3 months ago a6c0a22
Search drm_fourcc.h in all libdrm cflags
1 files changed, 12 insertions(+), 4 deletions(-)

M fourcc.py
M fourcc.py => fourcc.py +12 -4
@@ 10,10 10,18 @@ pkg_config = os.getenv("PKG_CONFIG", "pkg-config")

version = subprocess.check_output([pkg_config, "libdrm", "--modversion"]).decode().strip()
cflags = subprocess.check_output([pkg_config, "libdrm", "--cflags-only-I"]).decode().strip().split()
if not cflags[0].startswith("-I"):
	raise Exception("Expected one include dir for libdrm")
libdrm_include = cflags[0][2:]
fourcc_include = libdrm_include + "/drm_fourcc.h"

found = False
for flag in cflags:
	if not flag.startswith("-I"):
		raise Exception("Expected an include dir for libdrm")
	libdrm_include = flag[2:]
	fourcc_include = libdrm_include + "/drm_fourcc.h"
	if os.path.exists(fourcc_include):
		found = True
		break
if not found:
	raise Exception("Failed to find drm_fourcc.h in libdrm -I cflags")

ident_list = []
with open(fourcc_include) as input_file: