gnu: Add proxychains-ng.

Message ID 87mvke1ify.fsf@elephly.net
State New
Headers

Commit Message

Ricardo Wurmus Aug. 15, 2016, 9:37 a.m. UTC
  ng0 <ng0@we.make.ritual.n0.is> writes:

> Ricardo Wurmus <rekado@elephly.net> writes:
>
>> ng0 <ng0@we.make.ritual.n0.is> writes:
>>
>>> Ricardo Wurmus <rekado@elephly.net> writes:
>>
>>>> Could you show us the error message in case of using
>>>> “#:configure-flags”?  This really should work, so if it fails I’d like
>>>> to fix this instead of working around it, if possible.
>>
>> […]
>>
>> Thanks.  Looks like you need to set the “prefix” variable in
>> #:make-flags – it is defined in the Makefile (along with “exec_prefix”,
>> which you might also have to override).
>>
>> ~~ Ricardo
>>
>
> I did set prefix and exec_prefix in the make-flags, gets ignored.
> it doesn't work, and I think I tried setting it in the make-flags before.
> I will revert to the original patch and add a comment why it needs to be
> configured like this. Second choice could be to substitute, but
> ./configure --options is shorter and apparently what the application
> wants.

The reason here is that the configure script aborts when it encounters
arguments it doesn’t expect, such as the CONFIG_SHELL argument.  As a
result the “config.mak” file is never created.

I’ve got this to build by making the custom configure script a little
more tolerant.

I also changed the description to be a full sentence.  I’ve upcased
“TCP”, “SOCKS”, and “HTTP”.  The synopsis has also been simplified.

The license was too limited.  The license headers (in the files that
have them) include the “or later” clause, so this is really GPLv2+.

I’ve also added a comment as to why the tests have been disabled.

If this looks okay to you I’ll push it later today.

~~ Ricardo
  

Comments

non such Aug. 15, 2016, 9:57 a.m. UTC | #1
Ricardo Wurmus <rekado@elephly.net> writes:

> ng0 <ng0@we.make.ritual.n0.is> writes:
>
>> Ricardo Wurmus <rekado@elephly.net> writes:
>>
>>> ng0 <ng0@we.make.ritual.n0.is> writes:
>>>
>>>> Ricardo Wurmus <rekado@elephly.net> writes:
>>>
>>>>> Could you show us the error message in case of using
>>>>> “#:configure-flags”?  This really should work, so if it fails I’d like
>>>>> to fix this instead of working around it, if possible.
>>>
>>> […]
>>>
>>> Thanks.  Looks like you need to set the “prefix” variable in
>>> #:make-flags – it is defined in the Makefile (along with “exec_prefix”,
>>> which you might also have to override).
>>>
>>> ~~ Ricardo
>>>
>>
>> I did set prefix and exec_prefix in the make-flags, gets ignored.
>> it doesn't work, and I think I tried setting it in the make-flags before.
>> I will revert to the original patch and add a comment why it needs to be
>> configured like this. Second choice could be to substitute, but
>> ./configure --options is shorter and apparently what the application
>> wants.
>
> The reason here is that the configure script aborts when it encounters
> arguments it doesn’t expect, such as the CONFIG_SHELL argument.  As a
> result the “config.mak” file is never created.
>
> I’ve got this to build by making the custom configure script a little
> more tolerant.
>
> I also changed the description to be a full sentence.  I’ve upcased
> “TCP”, “SOCKS”, and “HTTP”.  The synopsis has also been simplified.
>
> The license was too limited.  The license headers (in the files that
> have them) include the “or later” clause, so this is really GPLv2+.
>
> I’ve also added a comment as to why the tests have been disabled.
>
> If this looks okay to you I’ll push it later today.

It's okay for me. Thanks for looking into this.

> ~~ Ricardo
>
>
> From d2f2d139f4aac52ac0f79e7f81a0be5fad2ad100 Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@we.make.ritual.n0.is>
> Date: Fri, 12 Aug 2016 17:47:41 +0000
> Subject: [PATCH] gnu: Add proxychains-ng.
>
> * gnu/packages/networking.scm (proxychains-ng): New variable.
> ---
>  gnu/packages/networking.scm | 37 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
> index 1275a41..2678739 100644
> --- a/gnu/packages/networking.scm
> +++ b/gnu/packages/networking.scm
> @@ -1,6 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
> -;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
> +;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
>  ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
>  ;;; Copyright © 2015 Stefan Reichör <stefan@xsteve.at>
>  ;;; Copyright © 2016 Raimon Grau <raimonster@gmail.com>
> @@ -8,6 +8,7 @@
>  ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
>  ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
>  ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
> +;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -690,3 +691,37 @@ information by IP Address.")
>    (description "IO::Socket::INET6 is an interface for AF_INET/AF_INET6 domain
>  sockets in Perl.")
>    (license (package-license perl))))
> +
> +(define-public proxychains-ng
> +  (package
> +    (name "proxychains-ng")
> +    (version "4.11")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "https://github.com/rofl0r/" name "/releases/"
> +                                  "download/v" version "/" name "-" version
> +                                  ".tar.bz2"))
> +              (sha256
> +               (base32
> +                "1dkncdzw852488gkh5zhn4b5i03qyj8rgh1wcvcva7yd12c19i6w"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f ; there are no tests
> +       #:make-flags '("CC=gcc")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'fix-configure-script
> +           (lambda _
> +             ;; The configure script is very intolerant to unknown arguments,
> +             ;; such as "CONFIG_SHELL".
> +             (substitute* "configure"
> +               (("\\*\\) break ;;" line)
> +                (string-append "[A-Z]*) shift ;;\n"
> +                               line)))

I'm curious what this substitute does. Could you explain it?

> +             #t)))))
> +    (synopsis "Redirect any TCP connection through a proxy or proxy chain")
> +    (description "Proxychains-ng is a preloader which hooks calls to sockets
> +in dynamically linked programs and redirects them through one or more SOCKS or
> +HTTP proxies.")
> +    (home-page "https://github.com/rofl0r/proxychains-ng")
> +    (license license:gpl2+)))
> -- 
> 2.9.2
>
  
Ricardo Wurmus Aug. 15, 2016, 10:17 a.m. UTC | #2
ng0 <ng0@we.make.ritual.n0.is> writes:

> Ricardo Wurmus <rekado@elephly.net> writes:

>> +       (modify-phases %standard-phases
>> +         (add-after 'unpack 'fix-configure-script
>> +           (lambda _
>> +             ;; The configure script is very intolerant to unknown arguments,
>> +             ;; such as "CONFIG_SHELL".
>> +             (substitute* "configure"
>> +               (("\\*\\) break ;;" line)
>> +                (string-append "[A-Z]*) shift ;;\n"
>> +                               line)))
>
> I'm curious what this substitute does. Could you explain it?

Sure.  We match the line

    *) break ;;

in the configure script and save it as “line”.  This line is the
alternative case in the options parser.  Any option starting with a dash
is processed while any other option leads to “break”.  This means that
upon encountering “CONFIG_SHELL=…” the configure script aborts and
doesn’t even get to setting the prefix.

So what I’m doing is to add an additional case:

    [A-Z]*) shift ;;

which is then followed by the original catch-all case (which leads to
“break”).  The additional case applies whenever an option begins with a
capital letter.  In that case it just throws away the option (“shift”).
“shift” reduces a list by dropping the current element.  This means that
in the next iteration the next list element will be processed.
Eventually this would lead to “break”, thus exiting the loop.

It’s not the prettiest fix, but it works.  It would be nicer if upstream
didn’t do “while true” and relied on “break” to exit the loop.  If they
instead went through the whole list of arguments, ignoring anything they
don’t recognize and only processing those that they expect.  Maybe worth
opening a bug report.

~~ Ricardo
  

Patch

From d2f2d139f4aac52ac0f79e7f81a0be5fad2ad100 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@we.make.ritual.n0.is>
Date: Fri, 12 Aug 2016 17:47:41 +0000
Subject: [PATCH] gnu: Add proxychains-ng.

* gnu/packages/networking.scm (proxychains-ng): New variable.
---
 gnu/packages/networking.scm | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 1275a41..2678739 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -1,6 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Stefan Reichör <stefan@xsteve.at>
 ;;; Copyright © 2016 Raimon Grau <raimonster@gmail.com>
@@ -8,6 +8,7 @@ 
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -690,3 +691,37 @@  information by IP Address.")
   (description "IO::Socket::INET6 is an interface for AF_INET/AF_INET6 domain
 sockets in Perl.")
   (license (package-license perl))))
+
+(define-public proxychains-ng
+  (package
+    (name "proxychains-ng")
+    (version "4.11")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/rofl0r/" name "/releases/"
+                                  "download/v" version "/" name "-" version
+                                  ".tar.bz2"))
+              (sha256
+               (base32
+                "1dkncdzw852488gkh5zhn4b5i03qyj8rgh1wcvcva7yd12c19i6w"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; there are no tests
+       #:make-flags '("CC=gcc")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-configure-script
+           (lambda _
+             ;; The configure script is very intolerant to unknown arguments,
+             ;; such as "CONFIG_SHELL".
+             (substitute* "configure"
+               (("\\*\\) break ;;" line)
+                (string-append "[A-Z]*) shift ;;\n"
+                               line)))
+             #t)))))
+    (synopsis "Redirect any TCP connection through a proxy or proxy chain")
+    (description "Proxychains-ng is a preloader which hooks calls to sockets
+in dynamically linked programs and redirects them through one or more SOCKS or
+HTTP proxies.")
+    (home-page "https://github.com/rofl0r/proxychains-ng")
+    (license license:gpl2+)))
-- 
2.9.2