Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / mingw.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
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 mingw)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages base)
23 #:use-module (gnu packages cross-base)
24 #:use-module (gnu packages gcc)
25 #:use-module (gnu packages compression)
26 #:use-module (gnu packages multiprecision)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix utils)
31 #:use-module (ice-9 match))
32
33 (define %mingw-triplet
34 "i686-w64-mingw32")
35
36 (define-public mingw-w64
37 (package
38 (name "mingw-w64")
39 (version "5.0-rc2")
40 (source (origin
41 (method url-fetch)
42 (uri (string-append
43 "https://sourceforge.net/projects/mingw-w64/files/mingw-w64/"
44 "mingw-w64-release/mingw-w64-v" version ".tar.bz2"))
45 (sha256
46 (base32 "0imdary8j07if8ih73pfgxiclpf2ax8h3mz8mxln07i8sbbd30c9"))
47 (patches (search-patches "mingw-w64-5.0rc2-gcc-4.9.3.patch"))))
48 (native-inputs `(("xgcc-core" ,(cross-gcc %mingw-triplet))
49 ("xbinutils" ,(cross-binutils %mingw-triplet))))
50 (build-system gnu-build-system)
51 (search-paths
52 (list (search-path-specification
53 (variable "CROSS_C_INCLUDE_PATH")
54 (files '("include" "i686-w64-mingw32/include")))
55 (search-path-specification
56 (variable "CROSS_LIBRARY_PATH")
57 (files
58 '("lib" "lib64" "i686-w64-mingw32/lib" "i686-w64-mingw32/lib64")))))
59 (arguments
60 `(#:configure-flags '("--host=i686-w64-mingw32")
61 #:phases
62 (modify-phases %standard-phases
63 (add-before 'configure 'setenv
64 (lambda* (#:key inputs #:allow-other-keys)
65 (let ((xgcc-core (assoc-ref inputs "xgcc-core"))
66 (mingw-headers (string-append (getcwd) "/mingw-w64-headers")))
67 (setenv "CPP"
68 (string-append xgcc-core "/bin/i686-w64-mingw32-cpp"))
69 (setenv "CROSS_C_INCLUDE_PATH"
70 (string-append
71 mingw-headers
72 ":" mingw-headers "/include"
73 ":" mingw-headers "/crt"
74 ":" mingw-headers "/defaults/include"
75 ":" mingw-headers "/direct-x/include"))))))
76 #:make-flags (list "DEFS=-DHAVE_CONFIG_H -D__MINGW_HAS_DXSDK=1")
77 #:tests? #f ; compiles and includes glibc headers
78 #:strip-binaries? #f))
79 (home-page "http://mingw.org")
80 (synopsis "Minimalist GNU for Windows")
81 (description "MinGW provides a complete Open Source programming tool set
82 which is suitable for the development of native MS-Windows applications, and
83 which does not depend on any 3rd-party C-Runtime dlls.")
84 (license license:fdl1.3+)))