gnu: mingw-w64: Update to 6.0.0.
[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 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019 Carl Dong <contact@carldong.me>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages mingw)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages base)
25 #:use-module (gnu packages cross-base)
26 #:use-module (gnu packages gcc)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages multiprecision)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix utils)
33 #:use-module (ice-9 match))
34
35 (define-public (make-mingw-w64 machine)
36 (let ((triplet (string-append machine "-" "w64-mingw32")))
37 (package
38 (name (string-append "mingw-w64" "-" machine))
39 (version "6.0.0")
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 "1w28mynv500y03h92nh87rgw3fnp82qwnjbxrrzqkmr63q812pl0"))
47 (patches (search-patches "mingw-w64-6.0.0-gcc.patch"))))
48 (native-inputs `(("xgcc-core" ,(cross-gcc triplet))
49 ("xbinutils" ,(cross-binutils triplet))))
50 (build-system gnu-build-system)
51 (search-paths
52 (list (search-path-specification
53 (variable "CROSS_C_INCLUDE_PATH")
54 (files `("include" ,(string-append triplet "/include"))))
55 (search-path-specification
56 (variable "CROSS_LIBRARY_PATH")
57 (files
58 `("lib" "lib64"
59 ,(string-append triplet "/lib")
60 ,(string-append triplet "/lib64"))))))
61 (arguments
62 `(#:configure-flags '(,(string-append "--host=" triplet))
63 #:phases
64 (modify-phases %standard-phases
65 (add-before 'configure 'setenv
66 (lambda* (#:key inputs #:allow-other-keys)
67 (let ((xgcc-core (assoc-ref inputs "xgcc-core"))
68 (mingw-headers (string-append (getcwd) "/mingw-w64-headers")))
69 (setenv "CPP"
70 (string-append xgcc-core ,(string-append "/bin/" triplet "-cpp")))
71 (setenv "CROSS_C_INCLUDE_PATH"
72 (string-append
73 mingw-headers
74 ":" mingw-headers "/include"
75 ":" mingw-headers "/crt"
76 ":" mingw-headers "/defaults/include"
77 ":" mingw-headers "/direct-x/include"))))))
78 #:make-flags (list "DEFS=-DHAVE_CONFIG_H -D__MINGW_HAS_DXSDK=1")
79 #:tests? #f ; compiles and includes glibc headers
80 #:strip-binaries? #f))
81 (home-page "https://mingw-w64.org")
82 (synopsis "Minimalist GNU for Windows")
83 (description
84 "Minimalist GNU for Windows (@dfn{MinGW}) is a complete software
85 development environment for creating native Microsoft Windows applications.
86
87 It includes a set of Windows-specific header files and static import libraries
88 which enable the use of the Windows API. It does not rely on any third-party C
89 runtime dynamic-link libraries (@dfn{DLL}s).
90
91 Mingw-w64 is an advancement of the original mingw.org project and provides
92 several new APIs such as DirectX and DDK, and 64-bit support.")
93 (license license:fdl1.3+))))
94
95 (define-public mingw-w64-i686
96 (make-mingw-w64 "i686"))
97
98 (define-public mingw-w64-x86_64
99 (make-mingw-w64 "x86_64"))
100
101 (define-public mingw-w64 mingw-w64-i686)