unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Noweb+icon and a new package for Unicon
@ 2023-03-09 18:00 Peter Kourzanov
  0 siblings, 0 replies; only message in thread
From: Peter Kourzanov @ 2023-03-09 18:00 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 378 bytes --]

Hi all,
I would like to contribute a patch for noweb package spec, together with a
new package for Unicon. It latter builds a compiler for the former's
Icon-based tools, which - as a result - run much faster.

Unicorn is useful to have in its own right, I guess.

Heard on IRC that its best to send a patch here (also have a wip-unicon
branch on savannah).

Kind regards,
Peter

[-- Attachment #1.2: Type: text/html, Size: 521 bytes --]

[-- Attachment #2: guix-unicon-noweb.patch --]
[-- Type: text/plain, Size: 11332 bytes --]

diff --git a/gnu/packages/noweb.scm b/gnu/packages/noweb.scm
index d218d8cc68..32f971386b 100644
--- a/gnu/packages/noweb.scm
+++ b/gnu/packages/noweb.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2023 Peter Kourzanov <peter.kourzanov@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,7 +23,13 @@ (define-module (gnu packages noweb)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix licenses)
-  #:use-module (gnu packages perl))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages tex)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages unicon))
 
 (define-public noweb
   (package
@@ -109,3 +116,85 @@ (define-public noweb
     (license
      (list bsd-2                        ; dual-licenced under this and…
            (fsf-free "https://www.cs.tufts.edu/~nr/noweb/#copyright")))))
+
+(define-public noweb-icon
+  (package
+    (name "noweb-icon")
+    (version "master")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nrnrnr/noweb")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1pi6a4j240czxx5zifify316v392c690f2kdyfa3mbnm7svm6bkn"))
+       (patches (search-patches "noweb.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'bind-early
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin")))
+               (substitute* (list "src/lib/nwmtime"
+                                  "src/shell/htmltoc")
+                 (("exec perl ")
+                  (format #f "exec ~a " (which "perl"))))
+               (substitute* "src/shell/noweb"
+                 ((" cpif ")
+                  (format #f " ~a/cpif " bin)))
+               #t)))
+        (replace 'build
+          (lambda* (#:key outputs inputs build-targets #:allow-other-keys)
+            (let* ((inc1 (assoc-ref inputs "freetype"))
+                    (e1 (getenv "C_INCLUDE_PATH"))
+                    (e2 (getenv "CPLUS_INCLUDE_PATH")))
+                (setenv "C_INCLUDE_PATH"
+                  (string-append inc1 "/include/freetype2"
+                    (if e1 (string-append ":" e1)  "")))
+                (setenv "CPLUS_INCLUDE_PATH"
+                  (string-append inc1 "/include/freetype2" 
+                    (if e2 (string-append ":" e2) "")))
+                (invoke "make" "boot")
+                (invoke "make" "all")
+          )))
+         (add-before 'install 'pre-install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/share/texmf/tex/latex"))
+               #t)))
+         (replace 'configure
+           (lambda _
+             ;; Jump in the source.
+             (chdir "src")
+             #t)))
+       #:make-flags (let ((out (assoc-ref %outputs "out")))
+                      (list (string-append "GITVERSION=master")
+                            (string-append "CFLAGS=-O3")
+                            (string-append "LIBSRC=icon")
+                            (string-append "ICONC=iconc")
+                            (string-append "BIN=" out "/bin")
+                            (string-append "LIB=" out "/lib")
+                            (string-append "MAN=" out "/share/man")
+                            (string-append "TEXINPUTS=" out
+                                           "/share/texmf/tex/latex")))
+       #:tests? #f))                              ; no tests
+    (native-inputs (list unicon freetype texlive-bin gawk coreutils diffutils))
+    (inputs (list perl))
+    (home-page "https://www.cs.tufts.edu/~nr/noweb/")
+    (synopsis "(faster version of the) Literate programming tool")
+    (description
+     "Noweb is designed to meet the needs of literate programmers while
+remaining as simple as possible.  Its primary advantages are simplicity,
+extensibility, and language-independence—especially noticeable when compared
+with other literate-programming tools.  noweb uses 5 control sequences to
+WEB's 27.  The noweb manual is only 4 pages; an additional page explains how
+to customize its LaTeX output.  noweb works “out of the box” with any
+programming language, and supports TeX, LaTeX, HTML, and troff back ends.
+This version is compiled with (un)Icon support, giving better performance.")
+    (license
+     (list bsd-2                        ; dual-licenced under this and…
+           (fsf-free "https://www.cs.tufts.edu/~nr/noweb/#copyright")))))
diff --git a/gnu/packages/patches/noweb.patch b/gnu/packages/patches/noweb.patch
new file mode 100644
index 0000000000..e8bcb326f2
--- /dev/null
+++ b/gnu/packages/patches/noweb.patch
@@ -0,0 +1,30 @@
+diff --git a/src/Makefile b/src/Makefile
+index 389f296..fc15721 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -10,7 +10,10 @@ LIBSRC=awk
+ # If you are lucky enough to have an Icon compiler icont, use ICONC=iconc
+ ICONC=icont
+ ICONT=icont
++
++ifeq ($(GITVERSION),)
+ GITVERSION=`./gitversion`
++endif
+ 
+ # BIN is where the commands (notangle, noweave, nountangle, noroots) land
+ # LIB is where the pieces of the pipes (nt, markup, unmarkup) are stored
+diff --git a/src/c/Makefile b/src/c/Makefile
+index ed7b72f..78af774 100644
+--- a/src/c/Makefile
++++ b/src/c/Makefile
+@@ -93,8 +93,8 @@ fakepretty: $(FPOBJS)
+ 	$(CC) $(CFLAGS) -o $@ $(FPOBJS)
+ 
+ 
+-gitversion.c: ../gitversion ../../.git/refs/heads/master
+-	echo 'const char gitversion[] = "'"$$(../gitversion -prefix)"'";' > $@
++gitversion.c: #../gitversion ../../.git/refs/heads/master
++	echo 'const char gitversion[] = "'"$$GITVERSION"'";' > $@
+ 
+ 
+ columns.o:      columns.h
diff --git a/gnu/packages/patches/unicon.patch b/gnu/packages/patches/unicon.patch
new file mode 100644
index 0000000000..c327221cd3
--- /dev/null
+++ b/gnu/packages/patches/unicon.patch
@@ -0,0 +1,13 @@
+diff --git a/src/h/config.h b/src/h/config.h
+index bd4bc0bd..dd444101 100644
+--- a/src/h/config.h
++++ b/src/h/config.h
+@@ -800,7 +800,7 @@ Deliberate Syntax Error
+ #endif					/* LibSuffix */
+ 
+ #ifndef CComp
+-   #define CComp "cc"
++   #define CComp "gcc"
+ #endif					/* CComp */
+ 
+ #ifndef COpts
diff --git a/gnu/packages/unicon.scm b/gnu/packages/unicon.scm
new file mode 100644
index 0000000000..9b9376ee39
--- /dev/null
+++ b/gnu/packages/unicon.scm
@@ -0,0 +1,101 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2023 Peter Kourzanov <peter.kourzanov@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages unicon)
+#:use-module (guix gexp)
+#:use-module (guix git)
+#:use-module (guix packages)
+#:use-module (guix download)
+#:use-module (guix git-download)
+#:use-module (guix git-authenticate)
+#:use-module (guix build-system gnu)
+#:use-module (gnu packages)
+#:use-module (gnu packages base)
+#:use-module (gnu packages bash)
+#:use-module (gnu packages autotools)
+#:use-module (gnu packages databases)
+#:use-module (gnu packages xiph)
+#:use-module (gnu packages audio)
+#:use-module (gnu packages xorg)
+#:use-module (gnu packages gl)
+#:use-module (gnu packages tls)
+#:use-module (gnu packages image)
+#:use-module (gnu packages video)
+#:use-module (gnu packages sdl)
+#:use-module (gnu packages dbm)
+#:use-module (gnu packages fontutils)
+#:use-module ((guix licenses) #:prefix lic:)
+)
+
+(define-public unicon
+  (package
+    (name "unicon")
+    (version "master")
+    (source (git-checkout
+              (url "https://git.code.sf.net/p/unicon/unicon")
+              (branch version)))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:tests? #f
+           #:phases #~(modify-phases %standard-phases
+               (add-after 'unpack 'patches
+                 (lambda* (#:key inputs #:allow-other-keys)
+		             (let ((patch (assoc-ref inputs "patch")))
+                    (invoke "patch" "-p1" "--force" "-i" patch)
+                   )))
+               (add-before 'configure 'adjust-includes
+                 (lambda* (#:key inputs #:allow-other-keys)
+                  (let* ((inc1 (assoc-ref inputs "freetype"))
+                         (inc2 (assoc-ref inputs "libsmpeg"))
+                         (inc3 (assoc-ref inputs "sdl"))
+                         (e1 (getenv "C_INCLUDE_PATH"))
+                         (e2 (getenv "CPLUS_INCLUDE_PATH")) 
+                         )
+                  (setenv "C_INCLUDE_PATH"
+                    (string-append inc1 "/include/freetype2:"
+                                   inc2 "/include/smpeg:"
+                                   inc3 "/include/SDL"
+                      (if e1 (string-append ":" e1)  "")))
+                  (setenv "CPLUS_INCLUDE_PATH"
+                    (string-append inc1 "/include/freetype2:" 
+                                   inc2 "/include/smpeg:"
+                                   inc3 "/include/SDL"
+                      (if e2 (string-append ":" e2) "")))
+                  )))
+              (replace 'build
+                (lambda* (#:key outputs inputs build-targets #:allow-other-keys)
+                  (invoke "make" "-s")
+                ))
+        )))
+    (native-inputs `(("bash" ,bash) 
+                     ("which" ,which) 
+                     ("libtool" ,libtool) 
+                     ("autoconf" ,autoconf) 
+                     ("automake" ,automake) 
+                     ("patch" ,(search-patch "unicon.patch"))))
+    (inputs (list gdbm))
+    (propagated-inputs (list unixodbc libvorbis libogg freealut openal libxft mesa libx11 openssl libjpeg-turbo libpng libxfont freeglut ftgl freetype sdl libsmpeg))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "C_INCLUDE_PATH")
+            (files '("include/freetype2" "include/libsmpeg" "include/SDL")))))
+    (synopsis "an Extended Dialect of Icon")
+    (description "Unicon is a very high level, goal-directed, object-oriented, general purpose applications language.")
+    (home-page "http://unicon.org/")
+    (license lic:gpl2)))
\ No newline at end of file

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-11  8:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 18:00 Noweb+icon and a new package for Unicon Peter Kourzanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).