| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (define-module (gnu packages mingw)
|
| 24 | #:use-module ((guix licenses) #:prefix license:)
|
| 25 | #:use-module (gnu packages)
|
| 26 | #:use-module (gnu packages cross-base)
|
| 27 | #:use-module (guix build-system gnu)
|
| 28 | #:use-module (guix gexp)
|
| 29 | #:use-module (guix memoization)
|
| 30 | #:use-module (guix packages)
|
| 31 | #:use-module (guix download)
|
| 32 | #:export (make-mingw-w64))
|
| 33 |
|
| 34 | (define* (make-mingw-w64/implementation machine
|
| 35 | #:key
|
| 36 | xgcc
|
| 37 | xbinutils
|
| 38 | with-winpthreads?)
|
| 39 | "Return a mingw-w64 for targeting MACHINE. If XGCC or XBINUTILS is specified,
|
| 40 | use that gcc or binutils when cross-compiling. If WITH-WINPTHREADS? is
|
| 41 | specified, recurse and return a mingw-w64 with support for winpthreads."
|
| 42 | (let* ((triplet (string-append machine "-" "w64-mingw32")))
|
| 43 | (package
|
| 44 | (name (string-append "mingw-w64" "-" machine
|
| 45 | (if with-winpthreads? "-winpthreads" "")))
|
| 46 | (version "13.0.0")
|
| 47 | (source
|
| 48 | (origin
|
| 49 | (method url-fetch)
|
| 50 | (uri (string-append
|
| 51 | "mirror://sourceforge/mingw-w64/mingw-w64/"
|
| 52 | "mingw-w64-release/mingw-w64-v" version ".tar.bz2"))
|
| 53 | (sha256
|
| 54 | (base32 "1bwchaannz49ckg295diyvp4k3sk3p3fwidgv9kvzvf4ylm85zjs"))))
|
| 55 | (native-inputs `(("xgcc-core" ,(if xgcc xgcc (cross-gcc triplet)))
|
| 56 | ("xbinutils" ,(if xbinutils xbinutils
|
| 57 | (cross-binutils triplet)))
|
| 58 | ,@(if with-winpthreads?
|
| 59 | `(("xlibc" ,(make-mingw-w64
|
| 60 | machine
|
| 61 | #:xgcc xgcc
|
| 62 | #:xbinutils xbinutils)))
|
| 63 | '())))
|
| 64 | (build-system gnu-build-system)
|
| 65 | (search-paths
|
| 66 | (list (search-path-specification
|
| 67 | (variable "CROSS_C_INCLUDE_PATH")
|
| 68 | (files `("include" ,(string-append triplet "/include"))))
|
| 69 | (search-path-specification
|
| 70 | (variable "CROSS_LIBRARY_PATH")
|
| 71 | (files
|
| 72 | `("lib" "lib64"
|
| 73 | ,(string-append triplet "/lib")
|
| 74 | ,(string-append triplet "/lib64"))))))
|
| 75 | (arguments
|
| 76 | (list #:parallel-build? #f |
| 77 | #:tests? #f |
| 78 | #:strip-binaries? #f
|
| 79 | #:configure-flags
|
| 80 | #~(list #$(string-append "--host=" triplet)
|
| 81 | #$@(if with-winpthreads?
|
| 82 | #~("--with-libraries=winpthreads")
|
| 83 | #~())
|
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | "--with-default-msvcrt=msvcrt")
|
| 91 | #:make-flags #~'("DEFS=-DHAVE_CONFIG_H -D__MINGW_HAS_DXSDK=1")
|
| 92 | #:phases
|
| 93 | #~(modify-phases %standard-phases
|
| 94 | (add-before 'configure 'setenv
|
| 95 | (lambda _
|
| 96 | (let ((xgcc-core #+(this-package-native-input
|
| 97 | "xgcc-core"))
|
| 98 | (mingw-headers (string-append
|
| 99 | (getcwd) "/mingw-w64-headers")))
|
| 100 | (setenv "CPP"
|
| 101 | (string-append
|
| 102 | xgcc-core "/bin/" #$triplet "-cpp"))
|
| 103 | (setenv "CROSS_C_INCLUDE_PATH"
|
| 104 | (string-append
|
| 105 | mingw-headers
|
| 106 | ":" mingw-headers "/include"
|
| 107 | ":" mingw-headers "/crt"
|
| 108 | ":" mingw-headers "/defaults/include"
|
| 109 | ":" mingw-headers "/direct-x/include"))
|
| 110 | #$@(if with-winpthreads?
|
| 111 | #~((let ((xlibc #+(this-package-native-input
|
| 112 | "xlibc")))
|
| 113 | (setenv "CROSS_LIBRARY_PATH"
|
| 114 | (string-append
|
| 115 | xlibc "/lib" ":"
|
| 116 | xlibc "/" #$triplet "/lib"))))
|
| 117 | #~())))))))
|
| 118 | (home-page "https://mingw-w64.org")
|
| 119 | (synopsis "Minimalist GNU for Windows")
|
| 120 | (description
|
| 121 | "Minimalist GNU for Windows (@dfn{MinGW}) is a complete software
|
| 122 | development environment for creating native Microsoft Windows applications.
|
| 123 |
|
| 124 | It includes a set of Windows-specific header files and static import libraries
|
| 125 | which enable the use of the Windows API. It does not rely on any third-party C
|
| 126 | runtime dynamic-link libraries (@dfn{DLL}s).
|
| 127 |
|
| 128 | Mingw-w64 is an advancement of the original mingw.org project and provides
|
| 129 | several new APIs such as DirectX and DDK, and 64-bit support.")
|
| 130 | (license license:fdl1.3+))))
|
| 131 |
|
| 132 | (define make-mingw-w64
|
| 133 | (memoize make-mingw-w64/implementation))
|
| 134 |
|
| 135 | (define-public mingw-w64-i686-sans-winpthreads
|
| 136 | (make-mingw-w64 "i686"))
|
| 137 |
|
| 138 | (define-public mingw-w64-x86_64-sans-winpthreads
|
| 139 | (make-mingw-w64 "x86_64"))
|
| 140 |
|
| 141 | (define-public mingw-w64-i686-winpthreads
|
| 142 | (make-mingw-w64 "i686"
|
| 143 | #:with-winpthreads? #t))
|
| 144 |
|
| 145 | (define-public mingw-w64-x86_64-winpthreads
|
| 146 | (make-mingw-w64 "x86_64"
|
| 147 | #:with-winpthreads? #t))
|
| 148 |
|
| 149 | (define-public mingw-w64-i686 mingw-w64-i686-winpthreads)
|
| 150 | (define-public mingw-w64-x86_64 mingw-w64-x86_64-winpthreads)
|
| 151 | (define-public mingw-w64 mingw-w64-i686)
|
| 152 |
|
| 153 | (define-public mingw-w64-tools
|
| 154 | (package
|
| 155 | (name "mingw-w64-tools")
|
| 156 | (version "13.0.0")
|
| 157 | (source
|
| 158 | (origin
|
| 159 | (method url-fetch)
|
| 160 | (uri (string-append
|
| 161 | "mirror://sourceforge/mingw-w64/mingw-w64/"
|
| 162 | "mingw-w64-release/mingw-w64-v" version ".tar.bz2"))
|
| 163 | (sha256
|
| 164 | (base32 "1bwchaannz49ckg295diyvp4k3sk3p3fwidgv9kvzvf4ylm85zjs"))))
|
| 165 | (build-system gnu-build-system)
|
| 166 | (arguments
|
| 167 | (list
|
| 168 | #:modules '((guix build gnu-build-system)
|
| 169 | (guix build utils)
|
| 170 | (srfi srfi-1))
|
| 171 | #:phases
|
| 172 | #~(append
|
| 173 | (modify-phases %standard-phases
|
| 174 | (add-after 'unpack 'cd-gendef
|
| 175 | (lambda _
|
| 176 | (chdir "mingw-w64-tools/gendef"))))
|
| 177 | (modify-phases %standard-phases
|
| 178 | (replace 'unpack
|
| 179 | (lambda _
|
| 180 | (chdir "../genidl"))))
|
| 181 | (modify-phases %standard-phases
|
| 182 | (replace 'unpack
|
| 183 | (lambda _
|
| 184 | (chdir "../genpeimg"))))
|
| 185 | (append-map
|
| 186 | (lambda (target)
|
| 187 | (modify-phases %standard-phases
|
| 188 | (replace 'unpack
|
| 189 | (lambda _
|
| 190 | (chdir "../widl")
|
| 191 | (false-if-exception
|
| 192 | (delete-file-recursively "../build"))))
|
| 193 | (replace 'configure
|
| 194 | (lambda args
|
| 195 | (apply (assoc-ref %standard-phases 'configure)
|
| 196 | (append args (list #:out-of-source? #t
|
| 197 | #:configure-flags
|
| 198 | `("--target" ,target
|
| 199 | "--program-prefix"
|
| 200 | ,(string-append target "-")))))))))
|
| 201 | '("i686-w64-mingw32" "x86_64-w64-mingw32")))))
|
| 202 | (home-page "https://mingw-w64.org")
|
| 203 | (synopsis "Tools of Minimalist GNU for Windows")
|
| 204 | (description "This package provides the tools of Minimalist GNU for
|
| 205 | Windows, a complete software development environment for creating native
|
| 206 | Microsoft Windows applications.")
|
| 207 | (license (list license:gpl3+ |
| 208 | license:lgpl2.1+)))) |