more configs work now
``` make LIBC=gnu LINK=dynamic make LIBC=musl LINK=dynamic CC=musl-gcc make LIBC=musl LINK=static CC=musl-gcc ```
This commit is contained in:
parent
4d9c9e2ac4
commit
7b33084a3e
|
@ -36,7 +36,6 @@ THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
|||
REPO_ROOT := $(realpath $(THIS_DIR)/..)
|
||||
CARGO_OBJDIR := cargo/$(RUST_TARGET)/$(_profile)
|
||||
|
||||
# TODO: check if override is needed
|
||||
_rust_cli_profile := $(if $(filter $(_profile),debug),dev,$(_profile))
|
||||
|
||||
# TODO: `make LINK=static` fails with linker error "undefined reference to `_dl_find_object'" in libgcc_eh.a
|
||||
|
@ -57,7 +56,7 @@ CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
|
|||
CFLAGS += -Wall -Wextra -pedantic -fwhole-program -fPIE -pie
|
||||
_no_debug_cflags := -ffunction-sections -fdata-sections -Wl,--gc-sections
|
||||
size_optimized_CFLAGS += -Oz \
|
||||
-fwrapv -fomit-frame-pointer -fno-stack-protector\
|
||||
-fwrapv -fomit-frame-pointer -fno-stack-protector \
|
||||
-fno-unroll-loops \
|
||||
-fno-unwind-tables -fno-asynchronous-unwind-tables \
|
||||
-fmerge-all-constants \
|
||||
|
@ -85,16 +84,16 @@ endif
|
|||
size_optimized_RUSTFLAGS += -Zlocation-detail=none \
|
||||
-Zfmt-debug=none \
|
||||
-C link-arg=-z,norelro \
|
||||
-C panic=abort
|
||||
#-C link-arg=--hash-style=gnu
|
||||
musl_RUSTFLAGS += --crate-type=staticlib -Ctarget-feature=-crt-static
|
||||
-C panic=abort \
|
||||
-C link-arg=-Wl,--hash-style=gnu
|
||||
static_RUSTFLAGS += --crate-type=staticlib -Ctarget-feature=+crt-static
|
||||
|
||||
RUSTFLAGS += $($(_libc)_RUSTFLAGS) $($(_profile)_RUSTFLAGS) $($(_link_type)_RUSTFLAGS)
|
||||
ifneq ($(_profile), debug)
|
||||
RUSTFLAGS += -C link-arg=-s -C link-arg=-Wl,--gc-sections
|
||||
endif
|
||||
|
||||
# TODO: wildcard does not work with VPATH
|
||||
# ADD NEW EXAMPLES HERE
|
||||
_c_src := src/announce.c src/brightness_tester.c src/header_logger.c \
|
||||
src/moving_line.c src/random_stuff.c src/wiping_clear.c
|
||||
_programs := $(basename $(notdir $(_c_src)))
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1748037224,
|
||||
"narHash": "sha256-92vihpZr6dwEMV6g98M5kHZIttrWahb9iRPBm1atcPk=",
|
||||
"lastModified": 1748302896,
|
||||
"narHash": "sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL+qwTFM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f09dede81861f3a83f7f06641ead34f02f37597f",
|
||||
"rev": "7848cd8c982f7740edf76ddb3b43d234cb80fc4d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.11",
|
||||
"ref": "nixos-25.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
50
flake.nix
50
flake.nix
|
@ -2,7 +2,7 @@
|
|||
description = "Flake for the servicepoint library.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
@ -31,37 +31,41 @@
|
|||
{
|
||||
devShells = forAllSystems (
|
||||
{ pkgs, system }:
|
||||
let
|
||||
toolchain = pkgs.symlinkJoin {
|
||||
name = "rust-toolchain";
|
||||
paths = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
rustPlatform.rustcSrc
|
||||
rustPlatform.rustLibSrc
|
||||
rustfmt
|
||||
clippy
|
||||
cargo-expand
|
||||
cargo-tarpaulin
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell rec {
|
||||
buildInputs = with pkgs; [
|
||||
packages = with pkgs; [
|
||||
toolchain
|
||||
gcc
|
||||
gdb
|
||||
gnumake
|
||||
pkg-config
|
||||
xe
|
||||
xz
|
||||
libgcc
|
||||
libunwind
|
||||
pkgsStatic.gcc
|
||||
pkgsStatic.libgcc
|
||||
pkgsStatic.musl
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
(pkgs.symlinkJoin {
|
||||
name = "rust-toolchain";
|
||||
paths = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
rustPlatform.rustcSrc
|
||||
rustfmt
|
||||
clippy
|
||||
cargo-expand
|
||||
cargo-tarpaulin
|
||||
];
|
||||
})
|
||||
gcc
|
||||
gdb
|
||||
pkgsStatic.gcc
|
||||
gnumake
|
||||
pkg-config
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
||||
RUST_BACKTRACE = 1;
|
||||
RUST_LOG = "all";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue