gnu: libidn: Update to 1.30.
[jackhill/guix/guix.git] / gnu / packages / wicd.scm
CommitLineData
10b60c04
MW
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
3;;; Copyright © 2015 Pierre-Antoine Rault <par@rigelk.eu>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages wicd)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system python)
24 #:use-module (guix licenses)
25 #:use-module (guix utils)
7747c4ca 26 #:use-module (gnu packages)
10b60c04
MW
27 #:use-module (gnu packages glib)
28 #:use-module (gnu packages gtk)
800d8d40 29 #:use-module (gnu packages gnome)
10b60c04
MW
30 #:use-module (gnu packages gettext)
31 #:use-module (gnu packages linux)
32 #:use-module (gnu packages admin)
33 #:use-module (gnu packages python))
34
35(define-public wicd
36 (package
37 (name "wicd")
38 (version "1.7.3")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "https://launchpad.net/wicd/"
43 (version-major+minor version) "/" version
44 "/+download/wicd-" version ".tar.gz"))
45 (sha256
7747c4ca
MW
46 (base32 "00c4rq753bhg64rv1v9yl834ssq7igyy7cz3swp287b5n5bqiqwi"))
47 (patches (list (search-patch "wicd-urwid-1.3.patch")))))
10b60c04
MW
48 (build-system python-build-system)
49 (native-inputs `(("gettext" ,gnu-gettext)))
50 (inputs `(("dbus" ,dbus)
51 ("dbus-glib" ,dbus-glib)
52 ("python2-dbus" ,python2-dbus)
53 ("python2-pygtk" ,python2-pygtk)
54 ("python2-urwid" ,python2-urwid)
55 ("python2-babel" ,python2-babel)
56 ("wireless-tools" ,wireless-tools)
57 ("wpa-supplicant" ,wpa-supplicant)
58 ("net-tools" ,net-tools)
59 ("isc-dhcp" ,isc-dhcp)
800d8d40
MW
60 ("iproute" ,iproute)
61 ("hicolor-icon-theme" ,hicolor-icon-theme)))
10b60c04
MW
62 (arguments
63 `(#:python ,python-2
64 #:tests? #f ; test suite requires networking
65 #:phases
66 (alist-cons-before
67 'build 'configure
68 (lambda* (#:key inputs outputs #:allow-other-keys)
69 (let ((out (assoc-ref outputs "out"))
70 (python (assoc-ref inputs "python")))
71 (define (which* cmd)
72 (cond ((string=? cmd "ping")
73 "/run/setuid-programs/ping")
74 ((which cmd)
75 => identity)
76 (else
77 (format (current-error-port)
78 "WARNING: Unable to find absolute path for ~s~%"
79 cmd)
80 #f)))
81 (substitute* "setup.py"
82 ;; The handling of unrecognized distros in setup.py is
83 ;; broken. Work around the problem.
84 (("\\('init=', " all)
85 (string-append "#" all))
86 ;; Inhibit attempts to install in /var or /etc.
87 (("\\(wpath\\.(log|etc|networks|.*scripts), " all)
88 (string-append "#" all)))
89
90 ;; Patch references to subprograms with absolute pathnames.
91 (substitute* "wicd/wnettools.py"
92 (("(misc\\.Run\\(\\[?[\"'])([^\"' ]*)" all pre cmd)
93 (string-append pre (which* cmd)))
94 (("(self\\._find_program_path|misc\\.find_path)\\([\"']([^\"']*)[\"']\\)"
95 all dummy cmd)
96 (let ((pathname (which* cmd)))
97 (if pathname
98 (string-append "'" pathname "'")
99 "None")))
100 (("([\"'])(ifconfig|route|wpa_cli|wpa_supplicant|iwconfig|iwpriv|iwlist|ping)"
101 all open-quote cmd)
102 (string-append open-quote (which* cmd))))
103
104 ;; setup.py cannot cope without LANG
105 (setenv "LANG" "C")
106
107 (let ((params
108 (list
109 (string-append "--python=" python "/bin/python")
110 "--no-install-init"
111 "--no-install-docs"
112 "--no-install-acpi"
113 "--no-install-pmutils"
114 "--no-install-kde"
115 "--no-install-gnome-shell-extensions"
116
117 "--distro=guixsd"
118 "--wicdgroup=netdev"
119 "--loggroup=root"
120 "--logperms=0640"
121
122 ;; XXX setup.py configure asks us to pass --init=,
123 ;; but if we do it says "no such option 'init'".
124 ;; (string-append "--init=" out "/etc/init.d")
125
126 (string-append "--initfile=" out "/etc/init.d/wicd")
127 (string-append "--lib=" out "/lib/wicd")
128 (string-append "--share=" out "/share/wicd")
129
130 "--etc=/etc/wicd"
131 "--scripts=/etc/wicd/scripts"
132 "--pmutils=/etc/pm-utils/sleep.d"
133
134 (string-append "--encryption="
135 out "/etc/encryption/templates")
136 (string-append "--bin=" out "/bin")
137 (string-append "--sbin=" out "/sbin")
138 (string-append "--daemon=" out "/share/wicd/daemon")
139 (string-append "--backends=" out "/share/wicd/backends")
140 (string-append "--curses=" out "/share/wicd/curses")
141 (string-append "--gtk=" out "/share/wicd/gtk")
142 (string-append "--cli=" out "/share/wicd/cli")
143 (string-append "--gnome-shell-extensions="
144 out "/share/gnome-shell-extensions")
145 (string-append "--icons=" out "/share/icons/hicolor")
146 (string-append "--pixmaps=" out "/share/pixmaps")
800d8d40 147 (string-append "--images=" out "/share/icons")
10b60c04
MW
148 (string-append "--dbus=" out "/etc/dbus-1/system.d")
149 (string-append "--dbus-service="
150 out "/share/dbus-1/system-services")
151 (string-append "--systemd=" out "/lib/systemd/system")
152 (string-append "--logrotate=" out "/etc/logrotate.d")
153 (string-append "--desktop=" out "/share/applications")
154 (string-append "--translations=" out "/share/locale")
155 (string-append "--autostart=" out "/etc/xdg/autostart")
156 (string-append "--docdir=" out "/share/doc/wicd")
157 (string-append "--mandir=" out "/share/man")
158 (string-append "--kdedir=" out "/share/autostart"))))
159 (format #t
160 "running ~s with command ~s and parameters ~s~%"
161 "python setup.py" "configure" params)
162 (zero? (apply system* "python" "setup.py" "configure" params)))))
163 (alist-cons-after
800d8d40
MW
164 'install 'post-install
165 (lambda* (#:key inputs outputs #:allow-other-keys)
166 (let ((out (assoc-ref outputs "out")))
167 ;; wicd's installer tries to put dhclient.conf.template.default
168 ;; in /etc/wicd/other, which is not available in the build
169 ;; environment, so here we install it manually in the output
170 ;; directory.
171 (let ((dest-dir (string-append out "/etc/wicd"))
172 (name "dhclient.conf.template.default"))
173 (mkdir-p dest-dir)
174 (copy-file (string-append "other/" name)
175 (string-append dest-dir "/" name)))
176
177 ;; Copy index.theme from hicolor-icon-theme. This is needed to
178 ;; allow wicd-gtk to find its icons.
179 (let ((hicolor (assoc-ref inputs "hicolor-icon-theme"))
180 (name "/share/icons/hicolor/index.theme"))
181 (copy-file (string-append hicolor name)
182 (string-append out name)))
10b60c04
MW
183 #t))
184 %standard-phases))))
185 (synopsis "Network connection manager")
186 (description "Wicd is a network manager that aims to simplify wired and
187wireless networking.")
188 (home-page "https://launchpad.net/wicd")
189 (license gpl2+)))