Skip to content

Commit

Permalink
Fix cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
helmutg authored and jepler committed Apr 29, 2024
1 parent c7b54e6 commit f48c7b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ CC = gcc
RM = rm -f
AR = ar
RANLIB = ranlib
PKG_CONFIG ?= pkg-config

OWNERSHIP ?= --owner root --group root

Expand All @@ -46,25 +47,25 @@ CFLAGS ?= -O0 -g -Wall -Wextra -Werror
CFLAGS += -std=c99

ifeq ($(TARGET),linux)
$(shell which pkg-config > /dev/null)
$(shell which $(PKG_CONFIG) > /dev/null)
ifeq ($(.SHELLSTATUS), 1)
$(error "can't find pkg-config")
endif

$(shell pkg-config --exists libpci > /dev/null)
$(shell $(PKG_CONFIG) --exists libpci > /dev/null)
ifeq ($(.SHELLSTATUS), 1)
$(error "pkg-config can't find libpci")
endif

$(shell pkg-config --exists libmd > /dev/null)
$(shell $(PKG_CONFIG) --exists libmd > /dev/null)
ifeq ($(.SHELLSTATUS), 1)
$(error "pkg-config can't find libmd")
endif

LIBPCI_CFLAGS := $(shell pkg-config --cflags libpci)
LIBPCI_LDFLAGS := $(shell pkg-config --libs libpci)
LIBMD_CFLAGS := $(shell pkg-config --cflags libmd)
LIBMD_LDFLAGS := $(shell pkg-config --libs libmd)
LIBPCI_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpci)
LIBPCI_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpci)
LIBMD_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmd)
LIBMD_LDFLAGS := $(shell $(PKG_CONFIG) --libs libmd)
BIN = mesaflash
LDFLAGS = -lm $(LIBPCI_LDFLAGS) $(LIBMD_LDFLAGS)
CFLAGS += -D_GNU_SOURCE $(LIBPCI_CFLAGS) $(LIBMD_CFLAGS) -D_FILE_OFFSET_BITS=64
Expand Down
7 changes: 7 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
DPKG_EXPORT_BUILDTOOLS=1
include /usr/share/dpkg/buildtools.mk
include /usr/share/dpkg/pkg-info.mk

# Makefile uses uname, which is wrong for cross builds.
MESAFLASH_IO:=$(if $(wildcard /usr/include/$(DEB_HOST_MULTIARCH)/asm/io.h),1,0)
export MESAFLASH_IO

%:
dh $@

Expand Down

0 comments on commit f48c7b9

Please sign in to comment.