[PATCH] gnu: Add tk-img.

  • Open
  • quality assurance status badge
Details
3 participants
  • cage
  • Ludovic Courtès
  • Maxim Cournoyer
Owner
unassigned
Submitted by
cage
Severity
normal
C
(address . guix-patches@gnu.org)
637de43ce6edf9cebaf84d3b456901a184e6de82.1691242776.git.cage-dev@twistfold.it
Hi!

Note that this patch suffers for some problems:

- the package will skips the test (it complains "tk" can not be found");

- the manpages will not be installed as make installs exit with an error code because the script 'dtplite' can not be found (seems a TCL script according to README);

- the license seems X11 to me, but i am unsure (see the last paragraph in the file: "license.terms".

Any suggestion to improve the patch is appreciated! :)

Bye!
C.

---
gnu/packages/tcl.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (50 lines)
diff --git a/gnu/packages/tcl.scm b/gnu/packages/tcl.scm
index b69dba2254..5bfcc63f96 100644
--- a/gnu/packages/tcl.scm
+++ b/gnu/packages/tcl.scm
@@ -509,3 +509,43 @@ (define-public go-github.com-nsf-gothic
(description "Gothic contains Go bindings for Tcl/Tk. The package contains
only one type and one function that can be used to create a Tk interpreter.")
(license license:expat))))
+
+
+
+(define-public tk-img
+ (package
+ (name "tk-img")
+ (version "1.4.14")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "mirror://sourceforge/tkimg/tkimg/1.4/tkimg%20"
+ version
+ "/Img-" version "-Source.tar.gz"))
+ (file-name (string-append "tkimg-" version ".tar.gz"))
+ (sha256
+ (base32 "08dvb8bfkxr919wp6fq14cfb9lz1v59jx1la4a6j4ks636wb243m"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (invoke "make" "install-libraries"))))
+ #:configure-flags
+ #~(list
+ (string-append "--exec-prefix=" #$output)
+ (string-append "--with-tcl="
+ (assoc-ref %build-inputs "tcl") "/lib")
+ (string-append "--with-tk="
+ (assoc-ref %build-inputs "tk") "/lib"))))
+ (native-inputs
+ (list tcl
+ tk))
+ (home-page "https://sourceforge.net/projects/tkimg/")
+ (synopsis "The Img package adds several image formats to Tcl/Tk.")
+ (description
+ "The Img package adds several image formats to Tcl/Tk.")
+ (license license:public-domain)))

base-commit: 42ae42cf41e8f5e88422e30d801251a3427d7f3b
--
2.34.0
M
M
Maxim Cournoyer wrote on 5 Sep 2023 16:21
(name . cage)(address . cage-dev@twistfold.it)(address . 65097@debbugs.gnu.org)
87msy0k8ex.fsf@gmail.com
Hi!

cage <cage-dev@twistfold.it> writes:

Toggle quote (6 lines)
> Hi!
>
> Note that this patch suffers for some problems:
>
> - the package will skips the test (it complains "tk" can not be found");

It'd be best to say so in the package, with a XXX comment (meaning
subpar/hackish/dirty) like:

#:tests #f ;tests fails with "tk" can not be found error

Toggle quote (57 lines)
> - the manpages will not be installed as make installs exit with an error code because the script 'dtplite' can not be found (seems a TCL script according to README);
>
> - the license seems X11 to me, but i am unsure (see the last paragraph in the file: "license.terms".
>
> Any suggestion to improve the patch is appreciated! :)
>
> Bye!
> C.
>
> ---
> gnu/packages/tcl.scm | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/gnu/packages/tcl.scm b/gnu/packages/tcl.scm
> index b69dba2254..5bfcc63f96 100644
> --- a/gnu/packages/tcl.scm
> +++ b/gnu/packages/tcl.scm
> @@ -509,3 +509,43 @@ (define-public go-github.com-nsf-gothic
> (description "Gothic contains Go bindings for Tcl/Tk. The package contains
> only one type and one function that can be used to create a Tk interpreter.")
> (license license:expat))))
> +
> +
> +
> +(define-public tk-img
> + (package
> + (name "tk-img")
> + (version "1.4.14")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (string-append
> + "mirror://sourceforge/tkimg/tkimg/1.4/tkimg%20"
> + version
> + "/Img-" version "-Source.tar.gz"))
> + (file-name (string-append "tkimg-" version ".tar.gz"))
> + (sha256
> + (base32 "08dvb8bfkxr919wp6fq14cfb9lz1v59jx1la4a6j4ks636wb243m"))))
> + (build-system gnu-build-system)
> + (arguments
> + (list #:tests? #f
> + #:phases
> + #~(modify-phases %standard-phases
> + (replace 'install
> + (lambda* (#:key outputs #:allow-other-keys)
> + (invoke "make" "install-libraries"))))
> + #:configure-flags
> + #~(list
> + (string-append "--exec-prefix=" #$output)
> + (string-append "--with-tcl="
> + (assoc-ref %build-inputs "tcl") "/lib")
> + (string-append "--with-tk="
> + (assoc-ref %build-inputs "tk") "/lib"))))
> + (native-inputs
> + (list tcl
> + tk))

I'd format on a single line since there are less than 5 dependencies
(that's what 'guix style' does).

Toggle quote (3 lines)
> + (synopsis "The Img package adds several image formats to Tcl/Tk.")

Synopsis shouldn't be complete sentence but just a very terse expression
saying what the package *is*, e.g. "Image library for Tcl/Tk". Debian
uses "Extended image format support for Tcl/Tk".

Toggle quote (3 lines)
> + (description
> + "The Img package adds several image formats to Tcl/Tk.")

Description should be more generous; here I'd enumerate the specific
image formats it adds. Debian uses:

Toggle snippet (5 lines)
Img is a package to enhance Tk by providing support for various image
formats such as XPM, GIF (transparency supported, but not LZW), PNG,
JPEG, TIFF, and PostScript.

It lacks some according to the home page [0]:

BMP, GIF, ICO, JPEG, PCX, PNG, PPM, PS, SGI, SUN, TGA, TIFF, XBM, XPM


Toggle quote (2 lines)
> + (license license:public-domain)))

According to Debian's copyright file (which can be found in
the licenses used is a mix of the tcl license and public-domain. I'd
use (license (list license:tcl/tk
license:public-domain))

Reading the last paragraph of license.terms:

Toggle snippet (13 lines)
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.

I'm not too sure what that really means, even after reading the clauses
[1, 2].


Although, taking it from a high level, it seems like it implies
additional restrictions for the US government, which is incompatible
with the free software and thus, the FSDG, which means we cannot
distribute this package.

I'd be happy to proven wrong, I am not a lawyer.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Sep 2023 16:22
(name . cage)(address . cage-dev@twistfold.it)(address . 65097@debbugs.gnu.org)
87il8ok8dh.fsf@gmail.com
Hi again,

cage <cage-dev@twistfold.it> writes:

Toggle quote (12 lines)
> Hi!
>
> Note that this patch suffers for some problems:
>
> - the package will skips the test (it complains "tk" can not be found");
>
> - the manpages will not be installed as make installs exit with an error code because the script 'dtplite' can not be found (seems a TCL script according to README);
>
> - the license seems X11 to me, but i am unsure (see the last paragraph in the file: "license.terms".
>
> Any suggestion to improve the patch is appreciated! :)

One last thing, the source of tk-img carries many 'contrib' sources;
they should be removed in a snippet to ensure only Guix-provided system
libraries are used instead.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 5 Sep 2023 16:43
(name . cage)(address . cage-dev@twistfold.it)(address . 65097@debbugs.gnu.org)
877cp4k7el.fsf_-_@gmail.com
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

[...]

Toggle quote (21 lines)
> Reading the last paragraph of license.terms:
>
> GOVERNMENT USE: If you are acquiring this software on behalf of the
> U.S. government, the Government shall have only "Restricted Rights"
> in the software and related documentation as defined in the Federal
> Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
> are acquiring the software on behalf of the Department of Defense, the
> software shall be classified as "Commercial Computer Software" and the
> Government shall have only "Restricted Rights" as defined in Clause
> 252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
> authors grant the U.S. Government and others acting in its behalf
> permission to use and distribute the software in accordance with the
> terms specified in this license.
>
> I'm not too sure what that really means, even after reading the clauses
> [1, 2].
>
> [1] https://www.acquisition.gov/far/52.227-19#FAR_52_227_19__d3451e77
> [2]
> https://www.acquisition.gov/dfars/252.227-7013-rights-technical-data%E2%80%94other-commercial-products-and-commercial-services.

That's probably fine actually, given that's the same license text as the
license.terms found in the tcl/tk project itself.

I'd use just (license license:tcl/tk) then.

--
Thanks,
Maxim
C
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
ZPdhKeY/wJgF6/Gi@shimizu.casa.net
On Tue, Sep 05, 2023 at 10:21:26AM -0400, you wrote:
Toggle quote (2 lines)
> Hi!

Hi!

[…]

Thank you very much for your accurate review of this patch!

I am going to address the issues you highlighted in your messages and
updating the patch.

I have just a question:

Toggle quote (7 lines)
> > the package will skips the test (it complains "tk" can not be found");

> It'd be best to say so in the package, with a XXX comment (meaning
> subpar/hackish/dirty) like:
>
> #:tests #f ;tests fails with "tk" can not be found error

I am OK with this change but I would rather prefer to not skip the
tests, if possible; do you have any suggestions about making the build
environment find the tk executable?

Thanks again for your help!
C.
C
[PATCH] gnu: Add tk-img.
(address . 65097@debbugs.gnu.org)(address . maxim.cournoyer@gmail.com)
2a54087d189965c4a6ee73d8b24b3b594bb0d5f4.1694008299.git.cage-dev@twistfold.it
Hi!

With this patch I tried to address all the issues that was pointed out
(hope they are fine :)) except one:

Toggle quote (4 lines)
> One last thing, the source of tk-img carries many 'contrib' sources;
> they should be removed in a snippet to ensure only Guix-provided system
> libraries are used instead.

Because I was not able to find out the contribs sources.

Also, for the record, the problem with tests is not that the Tk (as I
erroneously thought) executable can not be found but that, for some
reasons, the tcl script seems to fails to resolve Tk as dependency:

$ tclsh

% package require Tk → raise an error

the same line works on my other system (Debian)

Bye!
C.

---
gnu/packages/tcl.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (57 lines)
diff --git a/gnu/packages/tcl.scm b/gnu/packages/tcl.scm
index b69dba2254..22602c177a 100644
--- a/gnu/packages/tcl.scm
+++ b/gnu/packages/tcl.scm
@@ -36,6 +36,7 @@ (define-module (gnu packages tcl)
#:use-module (gnu packages)
#:use-module (gnu packages image)
#:use-module (gnu packages fontutils)
+ #:use-module (gnu packages ghostscript)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages tls)
@@ -509,3 +510,42 @@ (define-public go-github.com-nsf-gothic
(description "Gothic contains Go bindings for Tcl/Tk. The package contains
only one type and one function that can be used to create a Tk interpreter.")
(license license:expat))))
+
+(define-public tk-img
+ (package
+ (name "tk-img")
+ (version "1.4.14")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "mirror://sourceforge/tkimg/tkimg/1.4/tkimg%20"
+ version
+ "/Img-" version "-Source.tar.gz"))
+ (file-name (string-append "tkimg-" version ".tar.gz"))
+ (sha256
+ (base32 "08dvb8bfkxr919wp6fq14cfb9lz1v59jx1la4a6j4ks636wb243m"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f ; tests fails because the tcl shell can not find Tk ("package require Tk" fails)
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (invoke "make" "install-libraries"))))
+ #:configure-flags
+ #~(list
+ (string-append "--exec-prefix=" #$output)
+ (string-append "--with-tcl="
+ (assoc-ref %build-inputs "tcl") "/lib")
+ (string-append "--with-tk="
+ (assoc-ref %build-inputs "tk") "/lib"))))
+ (native-inputs
+ (list tcl tk ghostscript))
+ (home-page "https://sourceforge.net/projects/tkimg/")
+ (synopsis "Increase the number bitmap file formats supported by TK.")
+ (description
+ "The Img package adds supports for several image formats to TCl/TK; notably JPEG, ICO, BMP, TGA and PostScript (using an external PostScript interpreter).")
+ (license (license:non-copyleft
+ "file://license.terms"
+ "See license.terms in the distribution."))))

base-commit: 42ae42cf41e8f5e88422e30d801251a3427d7f3b
--
2.34.0
M
M
Maxim Cournoyer wrote on 6 Sep 2023 18:06
(name . cage)(address . cage-dev@twistfold.it)(address . 65097@debbugs.gnu.org)
87il8n5lrd.fsf@gmail.com
Hi!

cage <cage-dev@twistfold.it> writes:

Toggle quote (11 lines)
> Hi!
>
> With this patch I tried to address all the issues that was pointed out
> (hope they are fine :)) except one:
>
>> One last thing, the source of tk-img carries many 'contrib' sources;
>> they should be removed in a snippet to ensure only Guix-provided system
>> libraries are used instead.
>
> Because I was not able to find out the contribs sources.

(assuming the source is a gzipped tarball)

If you './pre-inst-env guix build --source tk-img', then unpack it to
/tmp with 'tar xf /gnu/store...-cage.tar.gz -C /tmp', you should then be
able to look at what it contains, e.g.

find /tmp/cage-x.y.z/ -name '*contrib*'

Toggle quote (8 lines)
> Also, for the record, the problem with tests is not that the Tk (as I
> erroneously thought) executable can not be found but that, for some
> reasons, the tcl script seems to fails to resolve Tk as dependency:
>
> $ tclsh
>
> % package require Tk → raise an error

Oh! So it seems we have a bigger problem to resolve first :-)

Thanks for your investigations.

--
Maxim
C
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
ZPi6CUwSeQv8LPa2@shimizu.casa.net
On Wed, Sep 06, 2023 at 12:06:46PM -0400, You wrote:
Toggle quote (2 lines)
> Hi!

Hi!

[...]

Toggle quote (10 lines)
> > Because I was not able to find out the contribs sources.
>
> (assuming the source is a gzipped tarball)
>
> If you './pre-inst-env guix build --source tk-img', then unpack it to
> /tmp with 'tar xf /gnu/store...-cage.tar.gz -C /tmp', you should then be
> able to look at what it contains, e.g.
>
> find /tmp/cage-x.y.z/ -name '*contrib*'

So they were hiding under the "compat" directory! :D

I have learnt a new (to me) guix switch ("--source"), thanks!

Toggle quote (12 lines)
> > Also, for the record, the problem with tests is not that the Tk (as I
> > erroneously thought) executable can not be found but that, for some
> > reasons, the tcl script seems to fails to resolve Tk as dependency:
> >
> > $ tclsh
> >
> > % package require Tk → raise an error
>
> Oh! So it seems we have a bigger problem to resolve first :-)
>
> Thanks for your investigations.

My pleasure, I am happy if I can give a contribution to guix, even if can be only
minimal.

Bye!
C.
L
L
Ludovic Courtès wrote on 14 Sep 2023 23:28
control message for bug #65097
(address . control@debbugs.gnu.org)
87jzss4f7v.fsf@gnu.org
tags 65097 + moreinfo
quit
C
failed attempt
(address . 65097@debbugs.gnu.org)
ZVY3tGNOE6WUOAmN@shimizu.casa.net
Hi!

I was not able to remove the bundled libraries and make the library
builds. Moreover I lost interest in this solution as i managed,
someway, to support more bitmap file format, in my code, using other
libraries.

Thanks for your help anyway and sorry if I did not not succeed.

Bye!
C.
?