Figure out how to abuse MSYS2 repositories
In the end, all seems to work fairly well on Windows 10.
This commit is contained in:
parent
45dd1a4a86
commit
8ac267c8db
|
@ -348,12 +348,16 @@ if (WIN32)
|
|||
DESTINATION etc)
|
||||
install (DIRECTORY
|
||||
${WIN32_DEPENDS_PATH}/lib/gdk-pixbuf-2.0
|
||||
DESTINATION lib)
|
||||
DESTINATION lib
|
||||
FILES_MATCHING PATTERN "*" PATTERN "*.a" EXCLUDE)
|
||||
install (DIRECTORY
|
||||
${WIN32_DEPENDS_PATH}/share/glib-2.0/schemas
|
||||
DESTINATION share/glib-2.0
|
||||
FILES_MATCHING PATTERN "org.gtk.Settings.*")
|
||||
|
||||
install (DIRECTORY
|
||||
${WIN32_DEPENDS_PATH}/share/icons/Adwaita
|
||||
DESTINATION share/icons OPTIONAL)
|
||||
install (FILES
|
||||
${WIN32_DEPENDS_PATH}/share/icons/hicolor/index.theme
|
||||
DESTINATION share/icons/hicolor)
|
||||
|
|
15
README.adoc
15
README.adoc
|
@ -51,7 +51,7 @@ After _cpack_ finishes making the package, install this file.
|
|||
|
||||
Build from source on Windows
|
||||
----------------------------
|
||||
_Note that with the current method we're stuck with GTK+ 3.10.4 at best._
|
||||
_Note that with the current method we're stuck with GTK+ 3.8.2._
|
||||
|
||||
First install CMake >= 3.1 and MinGW. Add both to your system path. If you want
|
||||
to build an installation package, also install NSIS.
|
||||
|
@ -86,7 +86,6 @@ By default, that is if you specify no generator, both packages are built.
|
|||
|
||||
Cross-compilation for Windows
|
||||
-----------------------------
|
||||
|
||||
The procedure is almost exactly the same as before, including the requirements.
|
||||
Just install MinGW-w64 and let automation take care of the rest.
|
||||
|
||||
|
@ -94,7 +93,17 @@ Just install MinGW-w64 and let automation take care of the rest.
|
|||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../ToolchainDebianMinGWW64.cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../ToolchainCrossMinGWW64.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
$ cpack
|
||||
|
||||
Alternatively, for an unnecessarily bloated MSYS2-based 64-bit build:
|
||||
|
||||
$ sh Win64Depends.cmake
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../ToolchainCrossWin64.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
$ cpack
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
set (CMAKE_SYSTEM_NAME "Windows")
|
||||
set (CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
set (CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc")
|
||||
set (CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++")
|
||||
set (CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
|
||||
|
||||
# Not needed to crosscompile an installation package
|
||||
#set (CMAKE_CROSSCOMPILING_EMULATOR "wine")
|
||||
|
||||
set (CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh -e
|
||||
# Win64Depends.sh: download dependencies from MSYS2 for cross-compilation
|
||||
# Dependencies: AWK, sed, cURL, bsdtar, wine64
|
||||
repository=https://repo.msys2.org/mingw/mingw64/
|
||||
|
||||
status() {
|
||||
echo "$(tput bold)-- $*$(tput sgr0)"
|
||||
}
|
||||
|
||||
# TODO: Try to verify checksums, it will be relatively low-effort.
|
||||
dbsync() {
|
||||
status Fetching repository DB
|
||||
[ -f db.tsv ] || curl -# "$repository/mingw64.db" | bsdtar -xOf- | awk '
|
||||
function flush() { print f["%NAME%"] f["%FILENAME%"] f["%DEPENDS%"] }
|
||||
NR > 1 && $0 == "%FILENAME%" { flush(); for (i in f) delete f[i] }
|
||||
{ if (/^[^%]/) f[field] = f[field] $0 "\t"; else field = $0 }
|
||||
END { flush() }
|
||||
' > db.tsv
|
||||
}
|
||||
|
||||
fetch() {
|
||||
status Resolving "$@"
|
||||
mkdir -p packages
|
||||
awk -F'\t' 'function get(name, i, a) {
|
||||
if (visited[name]++ || !(name in filenames)) return
|
||||
print filenames[name]
|
||||
split(deps[name], a)
|
||||
for (i in a) get(a[i])
|
||||
} BEGIN { while ((getline < "db.tsv") > 0) {
|
||||
filenames[$1] = $2; deps[$1] = ""
|
||||
for (i = 3; i <= NF; i++) { gsub(/[<=>].*/, "", $i)
|
||||
deps[$1] = deps[$1] $i FS }
|
||||
} for (i = 0; i < ARGC; i++) get(ARGV[i]) }' "$@" | while IFS= read -r name
|
||||
do
|
||||
status Fetching "$name"
|
||||
[ -f "packages/$name" ] || curl -#o "packages/$name" "$repository/$name"
|
||||
done
|
||||
}
|
||||
|
||||
extract() {
|
||||
status Extracting packages
|
||||
for subdir in *
|
||||
do [ -d "$subdir" -a "$subdir" != packages ] && rm -rf -- "$subdir"
|
||||
done
|
||||
for i in packages/*
|
||||
do bsdtar -xf "$i" --strip-components 1 mingw64
|
||||
done
|
||||
}
|
||||
|
||||
configure() {
|
||||
status Configuring packages
|
||||
glib-compile-schemas share/glib-2.0/schemas
|
||||
wine64 bin/gdk-pixbuf-query-loaders.exe \
|
||||
> lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
|
||||
|
||||
# pkgconf has a command line option for this, but CMake can't pass it
|
||||
sed -i "s|^prefix=/mingw64|prefix=$(pwd)|" lib/pkgconfig/*.pc
|
||||
}
|
||||
|
||||
mkdir -p win32-depends
|
||||
cd win32-depends
|
||||
dbsync
|
||||
fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lua \
|
||||
mingw-w64-x86_64-libwinpthread-git # because we don't do "provides"?
|
||||
extract
|
||||
configure
|
||||
|
||||
# XXX: Why is this override needed to run some GLib-based things under wine64?
|
||||
export XDG_DATA_DIRS=$(pwd)/share
|
Loading…
Reference in New Issue