Skip to content

Commit

Permalink
Merge pull request #78 from LinuxCNC/fix-cross-build
Browse files Browse the repository at this point in the history
Fix cross build
  • Loading branch information
jepler authored May 10, 2024
2 parents c7b54e6 + bd632ed commit 61f7eb4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install deps
run: |
Expand All @@ -42,12 +42,13 @@ jobs:
test-package:
strategy:
fail-fast: false
matrix:
os: ["buster", "bullseye", "testing", "unstable"]
os: ["buster", "bullseye", "stable", "testing", "unstable"]
cpu: ["i386", "amd64", "armhf", "aarch64"]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -67,15 +68,15 @@ jobs:
head debian/changelog
- name: Build Debian package
uses: dawidd6/action-debian-package@v1
uses: dawidd6/action-debian-package@v1.6.0
with:
source_directory: .
artifacts_directory: output
os_distribution: ${{ matrix.os }}
cpu_architecture: ${{ matrix.cpu }}

- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: output
name: debs-${{ matrix.os }}-${{ matrix.cpu }}
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 61f7eb4

Please sign in to comment.