clean: init at 3.1

This also fixes a build regression incurred by GCC 14 that led to the
previous derivation being removed in 41068ae0c69c.
This commit is contained in:
Benedikt Rips 2025-03-26 10:53:34 +01:00
parent 3e3afe5174
commit e9b6f129ae
No known key found for this signature in database
GPG Key ID: ED7FCB814CB6C157
4 changed files with 123 additions and 1 deletions

View File

@ -0,0 +1,21 @@
The clean command line compiler clm uses timestamps of dcl, icl, abc and o files
to decide what must be rebuild. However as for chroot builds, all of the
library files will have equal timestamps, this leads to clm trying to rebuild
the library modules distributed with the Clean installation every time a user
compiles any file, which fails ue to the absence of write permission on the Nix
store.
This patch changes the freshness check to use less than instead of less than or
equal to in order to avoid this.
--- b/src/clm/clm.c
+++ a/src/clm/clm.c
@@ -250,7 +250,7 @@
|| (t1.dwHighDateTime==t2.dwHighDateTime && (unsigned)(t1.dwLowDateTime)<=(unsigned)(t2.dwLowDateTime)))
#else
typedef unsigned long FileTime;
-# define FILE_TIME_LE(t1,t2) (t1<=t2)
+# define FILE_TIME_LE(t1,t2) (t1<t2)
#endif
typedef struct project_node {

View File

@ -0,0 +1,22 @@
--- a/src/RuntimeSystem/scon.c
+++ b/src/RuntimeSystem/scon.c
@@ -858,6 +858,8 @@
int execution_aborted;
int return_code;
+extern void abc_main (void);
+
int main (int argc,char **argv)
{
int arg_n;
--- a/src/clm/cachingcompiler.h
+++ b/src/clm/cachingcompiler.h
@@ -1,6 +1,7 @@
Clean (:: *Thread :== Int)
int start_caching_compiler (CleanCharArray compiler_path);
Clean (start_caching_compiler :: {#Char} Thread -> (Int, Thread))
+int start_caching_compiler_with_args (CleanCharArray coc_path, char** cocl_argv, int cocl_argv_size);
int call_caching_compiler (CleanCharArray args);
Clean (call_caching_compiler :: {#Char} Thread -> (Int, Thread))
int stop_caching_compiler (void);

View File

@ -0,0 +1,80 @@
{
binutils,
fetchurl,
gcc,
lib,
runCommand,
stdenv,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "clean";
version = "3.1";
src =
if stdenv.hostPlatform.system == "i686-linux" then
(fetchurl {
url = "https://ftp.cs.ru.nl/Clean/Clean31/linux/clean3.1_32_boot.tar.gz";
sha256 = "Ls0IKf+o7yhRLhtSV61jzmnYukfh5x5fogHaP5ke/Ck=";
})
else if stdenv.hostPlatform.system == "x86_64-linux" then
(fetchurl {
url = "https://ftp.cs.ru.nl/Clean/Clean31/linux/clean3.1_64_boot.tar.gz";
sha256 = "Gg5CVZjrwDBtV7Vuw21Xj6Rn+qN1Mf6B3ls6r/16oBc=";
})
else
throw "Architecture not supported";
hardeningDisable = [ "pic" ];
patches = [
./chroot-build-support-do-not-rebuild-equal-timestamps.patch
./declare-functions-explicitly-for-gcc14.patch
];
postPatch = ''
substituteInPlace Makefile \
--replace-fail 'INSTALL_DIR = $(CURRENTDIR)' "INSTALL_DIR = $out"
substituteInPlace src/clm/clm.c \
--replace-fail /usr/bin/as ${binutils}/bin/as \
--replace-fail /usr/bin/gcc ${gcc}/bin/gcc
'';
buildFlags = [ "-C src/" ];
# do not strip libraries and executables since all symbols since they are
# required as is for compilation. Especially the labels of unused section need
# to be kept.
dontStrip = true;
passthru.tests.compile-hello-world = runCommand "compile-hello-world" { } ''
cat >HelloWorld.icl <<EOF
module HelloWorld
Start = "Hello, world!"
EOF
${finalAttrs.finalPackage}/bin/clm HelloWorld -o hello-world
touch $out
'';
meta = {
description = "General purpose, state-of-the-art, pure and lazy functional programming language";
longDescription = ''
Clean is a general purpose, state-of-the-art, pure and lazy functional
programming language designed for making real-world applications. Some
of its most notable language features are uniqueness typing, dynamic typing,
and generic functions.
'';
homepage = "http://wiki.clean.cs.ru.nl/Clean";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [
bmrips
erin
];
platforms = [
"i686-linux"
"x86_64-linux"
];
mainProgram = "clean";
};
})

View File

@ -436,7 +436,6 @@ mapAliases {
citra = throw "citra has been removed from nixpkgs, as it has been taken down upstream"; # added 2024-03-04
citra-nightly = throw "citra-nightly has been removed from nixpkgs, as it has been taken down upstream"; # added 2024-03-04
citra-canary = throw "citra-canary has been removed from nixpkgs, as it has been taken down upstream"; # added 2024-03-04
clean = throw "'clean' has been removed from nixpkgs, as it is unmaintained and broken"; # Added 2025-05-18
cloog = throw "cloog has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-09-13
cloog_0_18_0 = throw "cloog_0_18_0 has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-09-13
cloogppl = throw "cloogppl has been removed from Nixpkgs, as it is unmaintained and obsolete"; # Added 2024-09-13