Skip to content

Commit

Permalink
tinycc: 0.9.27-unstable-2022-07-15 -> 0.9.27-unstable-2025-01-06
Browse files Browse the repository at this point in the history
Fix checkPhase by making it instalCheckPhase, since tcc depends on
libtcc1.a, which is build together with it, for its tests.

Create dev, doc and lib outpus. Now the binaries, i. e., tcc and the
cross compilers are what the user gets with tinycc.out.

Make the recipe compliant with nixpkgs-hammer.

Enable parallel building.
  • Loading branch information
onemoresuza committed Jan 19, 2025
1 parent 653cbc0 commit d83bbac
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
3 changes: 3 additions & 0 deletions doc/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
- [`lib.types.enum`](https://nixos.org/manual/nixos/unstable/#sec-option-types-basic): Previously the `functor.payload` was the list of enum values directly. Now it is an attribute set containing the values in the `values` attribute.
- [`lib.types.separatedString`](https://nixos.org/manual/nixos/unstable/#sec-option-types-string): Previously the `functor.payload` was the seperator directly. Now it is an attribute set containing the seperator in the `sep` attribute.

- The `tinycc` package now has the `dev`, `doc` and `lib` outputs, thus,
`tinycc.out` may now only provide the tcc and cross compilers binaries.

- The `virtualisation.hypervGuest.videoMode` option has been removed. Standard tooling can now be used to configure display modes for Hyper-V VMs.

### Deprecations {#sec-nixpkgs-release-25.05-lib-deprecations}
Expand Down
61 changes: 35 additions & 26 deletions pkgs/development/compilers/tinycc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@
texinfo,
which,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "tcc";
version = "0.9.27-unstable-2022-07-15";

src = fetchFromRepoOrCz {
repo = "tinycc";
rev = "af1abf1f45d45b34f0b02437f559f4dfdba7d23c";
hash = "sha256-jY0P2GErmo//YBaz6u4/jj/voOE3C2JaIDRmo0orXN8=";
};
version = "0.9.27-unstable-2025-01-06";

outputs = [
"out"
"dev"
"doc"
"info"
"lib"
"man"
"out"
];

src = fetchFromRepoOrCz {
repo = "tinycc";
rev = "f6385c05308f715bdd2c06336801193a21d69b50";
hash = "sha256-tO3N+NplYy8QUOC2N3x0CO5Ui75j9bQzLSZQF1HQyhY=";
};

nativeBuildInputs = [
copyPkgconfigItems
perl
Expand Down Expand Up @@ -57,24 +59,37 @@ stdenv.mkDerivation (finalAttrs: {
(makePkgconfigItem libtcc-pcitem)
];

postPatch = ''
patchShebangs texi2pod.pl
'';

configureFlags =
[
"--cc=$CC"
"--ar=$AR"
"--crtprefix=${lib.getLib stdenv.cc.libc}/lib"
"--sysincludepaths=${lib.getDev stdenv.cc.libc}/include:{B}/include"
"--libpaths=${lib.getLib stdenv.cc.libc}/lib"
# The first libpath will be the one in which tcc will look for libtcc1.a,
# which is need for its tests.
"--libpaths=$lib/lib/tcc:$lib/lib:${lib.getLib stdenv.cc.libc}/lib"
# build cross compilers
"--enable-cross"
]
++ lib.optionals stdenv.hostPlatform.isMusl [
"--config-musl"
];

enableParallelBuilding = true;

env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=implicit-int"
"-Wno-error=int-conversion"
];

# Test segfault for static build
doInstallCheck =
!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform;

postPatch = ''
patchShebangs texi2pod.pl
'';

preConfigure =
let
# To avoid "malformed 32-bit x.y.z" error on mac when using clang
Expand All @@ -90,19 +105,14 @@ stdenv.mkDerivation (finalAttrs: {
configureFlagsArray+=("--elfinterp=$(< $NIX_CC/nix-support/dynamic-linker)")
'';

env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=implicit-int"
"-Wno-error=int-conversion"
];

# Test segfault for static build
doCheck = !stdenv.hostPlatform.isStatic;
installCheckTarget = "test";

checkTarget = "test";
# https://www.mail-archive.com/tinycc-devel@nongnu.org/msg10142.html
preCheck = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
rm tests/tests2/{108,114}*
'';
preInstallCheck =
lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64)
''
rm tests/tests2/{108,114}*
'';

meta = {
homepage = "https://repo.or.cz/tinycc.git";
Expand Down Expand Up @@ -139,5 +149,4 @@ stdenv.mkDerivation (finalAttrs: {
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
};
})
# TODO: more multiple outputs
# TODO: self-compilation

0 comments on commit d83bbac

Please sign in to comment.