From f6c5e9a5ef486c5018dbd2323277197800200f0e Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 27 Sep 2023 19:54:29 -0300 Subject: [PATCH] ctx: unstable-2023-06-05 -> unstable-2023-09-03 --- ...targets.patch => 0001-fix-detections.diff} | 121 ++++++++---------- .../terminal-emulators/ctx/default.nix | 41 +++--- 2 files changed, 73 insertions(+), 89 deletions(-) rename pkgs/applications/terminal-emulators/ctx/{0001-Make-arch-detection-optional-and-fix-targets.patch => 0001-fix-detections.diff} (57%) diff --git a/pkgs/applications/terminal-emulators/ctx/0001-Make-arch-detection-optional-and-fix-targets.patch b/pkgs/applications/terminal-emulators/ctx/0001-fix-detections.diff similarity index 57% rename from pkgs/applications/terminal-emulators/ctx/0001-Make-arch-detection-optional-and-fix-targets.patch rename to pkgs/applications/terminal-emulators/ctx/0001-fix-detections.diff index 5e4297ea7040..d2580d0fde1d 100644 --- a/pkgs/applications/terminal-emulators/ctx/0001-Make-arch-detection-optional-and-fix-targets.patch +++ b/pkgs/applications/terminal-emulators/ctx/0001-fix-detections.diff @@ -1,18 +1,53 @@ -From 5c41e49b79ef85e7e23748fbeeaf65df8b769263 Mon Sep 17 00:00:00 2001 -From: Tobias Mayer -Date: Sat, 10 Jun 2023 14:17:16 +0200 -Subject: [PATCH] Make arch detection optional and fix targets - ---- - Makefile | 6 +++--- - configure.sh | 22 +++++++++++++--------- - 2 files changed, 16 insertions(+), 12 deletions(-) - -diff --git a/Makefile b/Makefile -index d21c53bf..fe982b24 100644 ---- a/Makefile -+++ b/Makefile -@@ -205,8 +205,8 @@ stuff/%.o: stuff/%.c ctx.h stuff/*.h stuff/*.inc Makefile build.conf +diff -Naur --no-dereference ctx-source-old/configure.sh ctx-source-new/configure.sh +--- ctx-source-old/configure.sh 1969-12-31 21:00:01.000000000 -0300 ++++ ctx-source-new/configure.sh 2023-09-27 19:26:05.403569888 -0300 +@@ -42,15 +42,18 @@ + ENABLE_SWITCH_DISPATCH=1 + + pkg-config sdl2 && HAVE_SDL=1 +-pkg-config babl && HAVE_BABL=1 ++ ++pkg-config babl-0.1 && { HAVE_BABL=1; BABL_NAME=babl-0.1; } ++if [ $HAVE_BABL != 1 ]; then ++ pkg-config babl && { HAVE_BABL=1; BABL_NAME=babl; } ++fi ++ + pkg-config libcurl && HAVE_LIBCURL=1 + pkg-config alsa && HAVE_ALSA=1 + pkg-config libdrm && HAVE_KMS=1 + #pkg-config harfbuzz && HAVE_HARFBUZZ=1 + +- +- +-ARCH=`uname -m` ++: "${ARCH:="$(uname -m)"}" + + case "$ARCH" in + "x86_64") HAVE_SIMD=1 ;; +@@ -224,8 +227,8 @@ + if [ $HAVE_BABL = 1 ];then + echo "#define CTX_BABL 1 " >> local.conf + echo "#define CTX_ENABLE_CM 1 " >> local.conf +- echo "CTX_CFLAGS+= `pkg-config babl --cflags`" >> build.conf +- echo "CTX_LIBS+= `pkg-config babl --libs` " >> build.conf ++ echo "CTX_CFLAGS+= `pkg-config "${BABL_NAME}" --cflags`" >> build.conf ++ echo "CTX_LIBS+= `pkg-config "${BABL_NAME}" --libs` " >> build.conf + else + echo "#define CTX_BABL 0 " >> local.conf + echo "#define CTX_ENABLE_CM 0 " >> local.conf +@@ -335,7 +338,7 @@ + #echo "Generating build.deps" + #make build.deps 2>/dev/null + +-echo -n "configuration summary, architecture $(arch)" ++echo -n "configuration summary, architecture $ARCH" + [ $HAVE_SIMD = 1 ] && echo " SIMD multi-pass" + echo "" + echo "Backends:" +diff -Naur --no-dereference ctx-source-old/Makefile ctx-source-new/Makefile +--- ctx-source-old/Makefile 1969-12-31 21:00:01.000000000 -0300 ++++ ctx-source-new/Makefile 2023-09-27 19:37:23.779830320 -0300 +@@ -206,8 +206,8 @@ libctx.a: itk.o deps.o $(CTX_OBJS) build.conf Makefile $(AR) rcs $@ $(CTX_OBJS) deps.o itk.o libctx.so: $(CTX_OBJS) deps.o itk.o build.conf Makefile @@ -23,64 +58,10 @@ index d21c53bf..fe982b24 100644 ctx: main.c ctx.h build.conf Makefile $(TERMINAL_OBJS) $(MEDIA_HANDLERS_OBJS) libctx.a $(CCC) main.c $(TERMINAL_OBJS) $(MEDIA_HANDLERS_OBJS) -o $@ $(CFLAGS) libctx.a $(LIBS) $(CTX_CFLAGS) $(OFLAGS_LIGHT) -lpthread $(CTX_LIBS) -@@ -276,5 +276,5 @@ itk/w3c-constants.h: itk/css.h Makefile squoze/squoze +@@ -277,5 +277,5 @@ for a in `cat itk/css.h | tr ';' ' ' | tr ',' ' ' | tr ')' ' '|tr ':' ' ' | tr '{' ' ' | tr ' ' '\n' | grep 'SQZ_[a-z][0-9a-zA-Z_]*'| sort | uniq`;do b=`echo $$a|tail -c+5|tr '_' '-'`;echo "#define $$a `./squoze/squoze -33 $$b`u // \"$$b\"";done \ >> $@ echo '#endif' >> $@ -static.inc: static/* static/*/* tools/gen_fs.sh +static.inc: static/* tools/gen_fs.sh ./tools/gen_fs.sh static > $@ -diff --git a/configure.sh b/configure.sh -index ad388a5d..fd9d3b96 100755 ---- a/configure.sh -+++ b/configure.sh -@@ -43,16 +43,20 @@ ENABLE_FAST_FILL_RECT=1 - ENABLE_SWITCH_DISPATCH=1 - - pkg-config sdl2 && HAVE_SDL=1 --pkg-config babl && HAVE_BABL=1 --pkg-config cairo && HAVE_CAIRO=1 --pkg-config libcurl && HAVE_LIBCURL=1 --pkg-config alsa && HAVE_ALSA=1 --pkg-config libdrm && HAVE_KMS=1 -+# https://github.com/GNOME/gimp/blob/828a8a7fe7ecd1825387f37a42922bc50fa32be9/meson.build#L349 -+pkg-config babl-0.1 && { HAVE_BABL=1; BABL_NAME=babl-0.1; } -+if [ $HAVE_BABL != 1 ];then -+ pkg-config babl && { HAVE_BABL=1; BABL_NAME=babl; } -+fi -+pkg-config cairo && HAVE_CAIRO=1 -+pkg-config libcurl && HAVE_LIBCURL=1 -+pkg-config alsa && HAVE_ALSA=1 -+pkg-config libdrm && HAVE_KMS=1 - #pkg-config harfbuzz && HAVE_HARFBUZZ=1 - - - --ARCH=`uname -m` -+: "${ARCH:="$(uname -m)"}" - - case "$ARCH" in - "x86_64") HAVE_SIMD=1 ;; -@@ -229,8 +233,8 @@ echo >> build.conf - if [ $HAVE_BABL = 1 ];then - echo "#define CTX_BABL 1 " >> local.conf - echo "#define CTX_ENABLE_CM 1 " >> local.conf -- echo "CTX_CFLAGS+= `pkg-config babl --cflags`" >> build.conf -- echo "CTX_LIBS+= `pkg-config babl --libs` " >> build.conf -+ echo "CTX_CFLAGS+= `pkg-config "$BABL_NAME" --cflags`" >> build.conf -+ echo "CTX_LIBS+= `pkg-config "$BABL_NAME" --libs` " >> build.conf - else - echo "#define CTX_BABL 0 " >> local.conf - echo "#define CTX_ENABLE_CM 0 " >> local.conf -@@ -348,7 +352,7 @@ echo "LIBS=$LIBS" >> build.conf - #echo "Generating build.deps" - #make build.deps 2>/dev/null - --echo -n "configuration summary, architecture $(arch)" -+echo -n "configuration summary, architecture $ARCH" - [ $HAVE_SIMD = 1 ] && echo " SIMD multi-pass" - echo "" - echo "Backends:" --- -2.40.1 - diff --git a/pkgs/applications/terminal-emulators/ctx/default.nix b/pkgs/applications/terminal-emulators/ctx/default.nix index 47f0fd702fa3..b329fd221247 100644 --- a/pkgs/applications/terminal-emulators/ctx/default.nix +++ b/pkgs/applications/terminal-emulators/ctx/default.nix @@ -1,42 +1,42 @@ { lib , stdenv , fetchgit -, pkg-config -, xxd , SDL2 , alsa-lib , babl , bash -, cairo , curl , libdrm # Not documented +, pkg-config +, xxd , enableFb ? false , nixosTests }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "ctx"; - version = "unstable-2023-06-05"; + version = "unstable-2023-09-03"; src = fetchgit { name = "ctx-source"; # because of a dash starting the directory url = "https://ctx.graphics/.git/"; - rev = "2eb3886919d0a0b8c305e4f9e18428dad5e73ca0"; - sha256 = "sha256-PLUyGArxLU742IKIgpzxdBdc94mWWSkHNFoXGW8L/Zo="; + rev = "1bac18c152eace3ca995b3c2b829a452085d46fb"; + hash = "sha256-fOcQJ2XCeomdtAUmy0A+vU7Vt325OSwrb1+ccW+gZ38="; }; patches = [ - ./0001-Make-arch-detection-optional-and-fix-targets.patch + # Many problematic things fixed - it should be upstreamed somehow: + # - babl changed its name in pkg-config files + # - arch detection made optional + # - LD changed to CCC + # - remove inexistent reference to static/*/* + ./0001-fix-detections.diff ]; postPatch = '' patchShebangs ./tools/gen_fs.sh ''; - strictDeps = true; - - env.ARCH = stdenv.hostPlatform.parsed.cpu.arch; - nativeBuildInputs = [ pkg-config xxd @@ -47,11 +47,14 @@ stdenv.mkDerivation { alsa-lib babl bash # for ctx-audioplayer - cairo curl libdrm ]; + strictDeps = true; + + env.ARCH = stdenv.hostPlatform.parsed.cpu.arch; + configureScript = "./configure.sh"; configureFlags = lib.optional enableFb "--enable-fb"; configurePlatforms = []; @@ -64,16 +67,16 @@ stdenv.mkDerivation { passthru.tests.test = nixosTests.terminal-emulators.ctx; - meta = with lib; { + meta = { homepage = "https://ctx.graphics/"; description = "Vector graphics terminal"; - longDescription= '' + longDescription = '' ctx is an interactive 2D vector graphics, audio, text- canvas and terminal, with escape sequences that enable a 2D vector drawing API using a vector graphics protocol. ''; - license = licenses.gpl3Plus; - maintainers = with maintainers; [ AndersonTorres]; - platforms = platforms.unix; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ AndersonTorres ]; + platforms = lib.platforms.unix; }; -} +})