Fixed crosscompilation

This commit is contained in:
Sebastian 2023-11-06 16:54:19 +01:00
parent 7af794ee17
commit fc6c3f9157
5 changed files with 30 additions and 61 deletions

View file

@ -2,6 +2,7 @@ PROGNAME=dump1090
RTLSDR ?= yes RTLSDR ?= yes
BLADERF ?= yes BLADERF ?= yes
PKG_CONFIG ?= pkg-config
CPPFLAGS += -DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\" CPPFLAGS += -DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\"
@ -21,13 +22,13 @@ ifeq ($(RTLSDR), yes)
LIBS_SDR += -L$(RTLSDR_PREFIX)/lib -lrtlsdr -lusb-1.0 LIBS_SDR += -L$(RTLSDR_PREFIX)/lib -lrtlsdr -lusb-1.0
endif endif
else else
CFLAGS += $(shell pkg-config --cflags librtlsdr) CFLAGS += $(shell $(PKG_CONFIG) --cflags librtlsdr)
# some packaged .pc files are massively broken, try to handle it # some packaged .pc files are massively broken, try to handle it
RTLSDR_LFLAGS := $(shell pkg-config --libs-only-L librtlsdr) RTLSDR_LFLAGS := $(shell $(PKG_CONFIG) --libs-only-L librtlsdr)
ifeq ($(RTLSDR_LFLAGS),-L) ifeq ($(RTLSDR_LFLAGS),-L)
LIBS_SDR += $(shell pkg-config --libs-only-l --libs-only-other librtlsdr) LIBS_SDR += $(shell $(PKG_CONFIG) --libs-only-l --libs-only-other librtlsdr)
else else
LIBS_SDR += $(shell pkg-config --libs librtlsdr) LIBS_SDR += $(shell $(PKG_CONFIG) --libs librtlsdr)
endif endif
endif endif
endif endif
@ -35,8 +36,8 @@ endif
ifeq ($(BLADERF), yes) ifeq ($(BLADERF), yes)
SDR_OBJ += sdr_bladerf.o SDR_OBJ += sdr_bladerf.o
CPPFLAGS += -DENABLE_BLADERF CPPFLAGS += -DENABLE_BLADERF
CFLAGS += $(shell pkg-config --cflags libbladeRF) CFLAGS += $(shell $(PKG_CONFIG) --cflags libbladeRF)
LIBS_SDR += $(shell pkg-config --libs libbladeRF) LIBS_SDR += $(shell $(PKG_CONFIG) --libs libbladeRF)
endif endif
all: dump1090 view1090 all: dump1090 view1090

View file

@ -2,7 +2,6 @@
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, pkg-config , pkg-config
, libbladeRF
, libusb1 , libusb1
, ncurses , ncurses
, rtl-sdr , rtl-sdr
@ -19,7 +18,6 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ buildInputs = [
libbladeRF
libusb1 libusb1
ncurses ncurses
rtl-sdr rtl-sdr
@ -29,7 +27,7 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang
"-Wno-implicit-function-declaration -Wno-int-conversion"; "-Wno-implicit-function-declaration -Wno-int-conversion";
buildFlags = [ "dump1090" ]; buildFlags = [ "BLADERF=no" "dump1090" ];
doCheck = true; doCheck = true;

View file

@ -18,41 +18,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
} }
} }
}, },

View file

@ -1,6 +1,5 @@
{ {
description = "A flake for dump1090 with DL0XK patches."; description = "A flake for dump1090 with DL0XK patches.";
inputs = { inputs = {
# Pointing to the current stable release of nixpkgs. You can # Pointing to the current stable release of nixpkgs. You can
# customize this to point to an older version or unstable if you # customize this to point to an older version or unstable if you
@ -10,25 +9,29 @@
# #
# nixpkgs.url = "github:NixOS/nixpkgs/unstable"; # nixpkgs.url = "github:NixOS/nixpkgs/unstable";
nixpkgs.url = "github:NixOS/nixpkgs/23.05"; nixpkgs.url = "github:NixOS/nixpkgs/23.05";
utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, utils }:
outputs = inputs@{ self, nixpkgs, ... }:
let let
systems = utils.lib.system; lib = nixpkgs.lib;
in
utils.lib.eachSystem [ systems.x86_64-linux systems.aarch64-linux systems.armv6l-linux ] allSystems = [ "x86_64-linux" "aarch64-linux" "armv6l-linux" ];
(system:
let crossPkgs-aarch64-linux = import nixpkgs { localSystem = "x86_64-linux"; crossSystem = "aarch64-linux"; };
pkgs = nixpkgs.legacyPackages.${system}; crossPkgs-armv6l-linux = import nixpkgs { localSystem = "x86_64-linux"; crossSystem = "armv6l-linux"; };
in in
{ {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
formatter = pkgs.nixpkgs-fmt; packages = {
x86_64-linux = {
defaultPackage = pkgs.callPackage ./default.nix { }; default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix { };
} cross-aarch64-linux = crossPkgs-aarch64-linux.callPackage ./default.nix { };
); cross-armv6l-linux = crossPkgs-armv6l-linux.callPackage ./default.nix { };
};
aarch64-linux.default = nixpkgs.legacyPackages.aarch64-linux.callPackage ./default.nix { };
armv6l-linux.default = nixpkgs.legacyPackages.armv6l-linux.callPackage ./default.nix { };
};
};
} }

1
result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/6czbzhsdidalrmwmxqh5xdvd6ma8ynp2-dump1090-afg-armv6l-unknown-linux-gnueabihf-1.0