summaryrefslogtreecommitdiff
path: root/sigils/packages/xorg.scm
blob: 22a44d77ec22847a154ef58d45d0c99b195980c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
(define-module (sigils packages xorg)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module (guix build-system python)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages digest)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages fribidi)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gstreamer)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages haskell-xyz)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages image)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages python-compression)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages video)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages xorg)
  #:use-module (sigils packages upstream))

(define-public xpra
  (package
    (name "xpra")
    (version "6.1.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/Xpra-org/xpra.git")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0sf5xx38x223ykxlbfy73ps442m1bnhkbpavhk4iqydgfr468vbg"))
       (patches (search-patches "xpra-6.0-systemd-run.patch"
                                "xpra-6.1-install_libs.patch"))))
    (build-system python-build-system)
    (inputs
     (list bash-minimal                 ; for wrap-program
           ;; glib
           ;; gobject-introspection
           ;; librsvg
           ;; icu4c
           ;; pixman
           ;; fribidi
           ;; libepoxy
           ;; graphene
           ;; libtiff
           gstreamer
           gst-plugins-base
           libappindicator
           libnotify
           ;; gdk-pixbuf
           python-pyxdg
           python-pyinotify
           cups-minimal
           pulseaudio
           ;; Essential dependencies.
           libjpeg-turbo
           libwebp
           ffmpeg
           libx11
           libxrandr
           libxtst
           libxfixes
           libxkbfile
           libxcomposite
           libxdamage
           libxext
           libxres
           lz4
           xauth
           xorg-server
           xf86-video-dummy
           xf86-input-mouse
           xf86-input-keyboard
           python-pycairo
           python-pygobject
           xxhash
           python-pillow
           ;; Optional dependencies.
           libx264
           x265
           libvpx
           python-rencode               ; For speed.
           python-numpy
           python-pyopengl              ; Drawing acceleration.
           python-pyopengl-accelerate   ; Same.
           libglvnd
           python-paramiko              ; Tunneling over SSH.
           python-dbus                  ; For desktop notifications.
           dbus                         ; For dbus-launch command.
           python-lz4                   ; Faster compression than zlib.
           python-netifaces
           python-pycups))
    ;; original
    (propagated-inputs
     (list gst-plugins-good
           gtk+))
    (native-inputs (list pkg-config pandoc python-cython-3))
    (arguments
     (list
      #:configure-flags #~(list "--without-Xdummy"
                                "--without-Xdummy_wrapper"
                                "--with-opengl"
                                "--without-debug"
                                "--without-strict") ; Ignore compiler warnings.
      #:modules '((guix build python-build-system)
                  (guix build utils))
      ;; Do not run test-cases.  This would rebuild all modules and they seem
      ;; to require python2.
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          ;; Must pass the same flags as 'install, otherwise enabled modules may
          ;; not be built.
          (replace 'build
            (lambda* (#:key configure-flags #:allow-other-keys)
              (apply invoke (append (list "python" "setup.py" "build")
                                    configure-flags))))
          (add-before 'install 'fix-paths
            (lambda* (#:key inputs #:allow-other-keys)
              ;; Fix python executable calls
              (substitute* '("xpra/platform/paths.py")
                (("f\"python\\{vi\\.major\\}\\.\\{vi\\.minor\\}\"")
                 (format #f "~s" (search-input-file inputs "bin/python3"))))
              ;; fix binary paths.
              (substitute* '("xpra/scripts/config.py"
                             "xpra/x11/vfb_util.py")
                (("\"Xvfb\"")
                 (format #f "~s" (search-input-file inputs "bin/Xvfb")))
                (("\"Xorg\"")
                 (format #f "~s" (search-input-file inputs "bin/Xorg")))
                (("\"xauth\"")
                 (format #f "~s" (search-input-file inputs "bin/xauth"))))
              ;; Fix directory of config files.
              (substitute* '("xpra/scripts/config.py"
                             "xpra/platform/posix/paths.py")
                (("\"/etc/xpra/?\"")
                 (string-append "\"" #$output "/etc/xpra/\"")))
              ;; XXX: Stolen from (gnu packages linux)
              (define (append-to-file name body)
                (let ((file (open-file name "a")))
                  (display body file)
                  (close-port file)))
              ;; Add Xorg module paths.
              (append-to-file
               "fs/etc/xpra/xorg.conf"
               (string-append
                "\nSection \"Files\"\nModulePath \""
                #$(this-package-input "xf86-video-dummy") "/lib/xorg/modules,"
                #$(this-package-input "xf86-input-mouse") "/lib/xorg/modules,"
                #$(this-package-input "xf86-input-keyboard") "/lib/xorg/modules,"
                #$(this-package-input "xorg-server") "/lib/xorg/modules\"\n"
                "EndSection\n\n"))
              (substitute* '("xpra/scripts/config.py"
                             "fs/etc/xpra/conf.d/60_server.conf.in"
                             "tests/unittests/unit/server/mixins/notification_test.py")
                ;; The trailing -- is intentional, so we only replace it inside
                ;; a command line.
                (("dbus-launch --")
                 (string-append (search-input-file inputs "/bin/dbus-launch")
                                " --")))
              ;; /run/user does not exist on guix system.
              (substitute* "./xpra/scripts/config.py"
                (("socket-dir.*: \"\",")
                 "socket-dir\"        : \"~/.xpra\","))))
          ;; GTK3 will not be found, if GI can’t find its typelibs.
          (add-after 'install 'wrap-program
            (lambda* (#:key outputs #:allow-other-keys)
              ;; XXX: only export typelibs in inputs
              (wrap-program (search-input-file outputs "bin/xpra")
                `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH")))))))))
    (home-page "https://www.xpra.org/")
    (synopsis "Remote access to individual applications or full desktops")
    (description "Xpra is a persistent remote display server and client for
forwarding applications and desktop screens.  It gives you remote access to
individual applications or full desktops.  On X11, it is also known as
``@command{screen} for X11'': it allows you to run programs, usually on a
remote host, direct their display to your local machine, and then to
disconnect from these programs and reconnect from the same or another machine,
without losing any state.  It can also be used to forward full desktops from
X11 servers, Windows, or macOS.")
    (license license:gpl2+)))