guix-more/more/packages/binary.scm

binary.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (gnu packages binary)
20
  #:use-module ((guix licenses) #:prefix license:)
21
  #:use-module (gnu packages)
22
  #:use-module (guix packages)
23
  #:use-module (guix download)
24
  #:use-module (guix utils)
25
  #:use-module (guix build-system gnu)
26
  #:use-module (guix build-system python))
27
28
(define-public python-pyelftools
29
  (package
30
    (name "python-pyelftools")
31
    (version "0.24")
32
    (source (origin
33
              (method url-fetch)
34
              (uri (string-append "https://github.com/eliben/pyelftools/archive/v"
35
                                  version ".tar.gz"))
36
              (file-name (string-append name "-" version ".tar.gz"))
37
              (sha256
38
               (base32
39
                "1iw47b20brg0ah86s9a2dn1f70qfmdv20p04q131vmnwa9g066f4"))))
40
    (build-system python-build-system)
41
    (home-page "https://github.com/eliben/pyelftools")
42
    (synopsis "Parsing and analyzing ELF files and DWARF debugging information")
43
    (description
44
      "Python library for parsing and analyzing ELF files and DWARF debugging information.")
45
    (license license:public-domain)))
46
47
(define-public python2-pyelftools
48
  (package-with-python2 python-pyelftools))
49
50
(define-public capstone
51
  (package
52
    (name "capstone")
53
    (version "3.0.4")
54
    (source (origin
55
              (method url-fetch)
56
              (uri (string-append "https://github.com/aquynh/capstone/archive/"
57
                                  version ".tar.gz"))
58
              (file-name (string-append name "-" version ".tar.gz"))
59
              (sha256
60
               (base32
61
                "1whl5c8j6vqvz2j6ay2pyszx0jg8d3x8hq66cvgghmjchvsssvax"))))
62
    (build-system gnu-build-system)
63
    (arguments
64
     `(#:tests? #f
65
       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
66
                          "CC=gcc")
67
       #:phases
68
       (modify-phases %standard-phases
69
         (delete 'configure))))
70
    (home-page "http://www.capstone-engine.org")
71
    (synopsis "Disassembler")
72
    (description
73
     "Capstone can disassemble machine code for many supported architectures
74
such as x86, x86_64, arm, arm64, mips, ppc, sparc, sysz and xcore.  It provides
75
bindings for Python, Java, OCaml and more.")
76
    (license (list license:bsd-3 license:expat))))
77
78
;; This package has a timestamp embedded in
79
;; lib/python3.5/site-packages/capstone/__pycache__/__iti__.cpython-35.pyc
80
(define-public python-capstone
81
  (package
82
    (inherit capstone)
83
    (name "python-capstone")
84
    (propagated-inputs
85
     `(("capstone" ,capstone)))
86
    (build-system python-build-system)
87
    (arguments
88
     `(#:tests? #f
89
       #:phases
90
       (modify-phases %standard-phases
91
         (add-after 'unpack 'chdir-and-fix-setup-py
92
           (lambda _
93
             (chdir "bindings/python")
94
             (substitute* "setup.py" (("data_files=.*") ""))
95
             (substitute* "capstone/__init__.py"
96
               (("_lib_path =.*")
97
                (string-append "_lib_path = '"
98
                               (assoc-ref %build-inputs "capstone")
99
                               "/lib'\n")))
100
             #t)))))))
101
102
(define-public python2-capstone
103
  (package-with-python2 python-capstone))
104