summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Win32Depends.cmake69
1 files changed, 14 insertions, 55 deletions
diff --git a/Win32Depends.cmake b/Win32Depends.cmake
index 515072c..ba486fe 100644
--- a/Win32Depends.cmake
+++ b/Win32Depends.cmake
@@ -1,13 +1,11 @@
# Usage: cmake -P Win32Depends.cmake
-# Only CMake 3.1+ supports XZ archives and 7z doesn't also untar automatically
-cmake_minimum_required (VERSION 3.1)
+# Only CMake 3.1+ supports XZ archives, not sure when 7z support comes from
+cmake_minimum_required (VERSION 3.9)
# Directories
set (working_dir ${CMAKE_CURRENT_BINARY_DIR}/win32-depends)
set (pkg_dir ${working_dir}/packages)
-set (tools_dir ${working_dir}/tools)
-set (sevenzip_executable ${tools_dir}/7za)
set (tmp_dir ${working_dir}/tmp)
file (MAKE_DIRECTORY ${working_dir})
file (MAKE_DIRECTORY ${pkg_dir})
@@ -21,11 +19,7 @@ if (files)
endif (files)
# Packages
-set (pkg_list "7za" "gtk" "gtkalt" "winlibs" "mingw_lua")
-
-set (pkg_7za_root "http://sourceforge.net/projects/sevenzip/files")
-set (pkg_7za_urls "${pkg_7za_root}/7-Zip/9.20/7za920.zip")
-set (pkg_7za_md5 "2fac454a90ae96021f4ffc607d4c00f8")
+set (pkg_list "gtk" "gtkalt" "winlibs" "mingw_lua")
set (pkg_gtk_root "http://ftp.gnome.org/pub/gnome/binaries/win32")
set (pkg_gtk_urls
@@ -68,11 +62,11 @@ foreach (pkg_set ${pkg_list})
message (WARNING "MD5 checksum missing for ${basename}")
set (pkg_md5_sum)
set (pkg_md5_param)
- else (NOT pkg_md5)
+ else ()
list (GET pkg_md5 0 pkg_md5_sum)
list (REMOVE_AT pkg_md5 0)
set (pkg_md5_param EXPECTED_MD5 ${pkg_md5_sum})
- endif (NOT pkg_md5)
+ endif ()
if (NOT EXISTS ${filename})
message (STATUS "Downloading ${url}...")
@@ -90,74 +84,39 @@ foreach (pkg_set ${pkg_list})
if (NOT output MATCHES "^${pkg_md5_sum}")
message (FATAL_ERROR "MD5 mismatch for ${basename}")
endif (NOT output MATCHES "^${pkg_md5_sum}")
- endif (NOT EXISTS ${filename})
+ endif ()
endforeach (url)
endforeach (pkg_set)
-if (NOT WIN32)
- unset (sevenzip_executable)
- find_program (sevenzip_executable 7za)
- if (NOT sevenzip_executable)
- message (FATAL_ERROR "Could not find 7za (part of p7zip)")
- endif (NOT sevenzip_executable)
-endif (NOT WIN32)
-
-# Stage 2: setup 7za first
-file (MAKE_DIRECTORY ${tmp_dir})
-foreach (url ${pkg_7za_urls})
- get_filename_component (filename ${url} NAME)
- message (STATUS "Extracting ${filename}...")
-
- set (filename ${pkg_dir}/${filename})
- execute_process (COMMAND ${CMAKE_COMMAND} -E tar xf ${filename}
- WORKING_DIRECTORY ${tmp_dir}
- RESULT_VARIABLE status)
- if (status)
- message (FATAL_ERROR "Extraction failed: ${status}")
- endif (status)
-endforeach (url)
-
-file (MAKE_DIRECTORY ${tools_dir})
-file (COPY ${tmp_dir}/7za.exe DESTINATION ${tools_dir})
-file (REMOVE_RECURSE ${tmp_dir})
-list (REMOVE_ITEM pkg_list "7za")
-
-# Stage 3: extract the rest of packages
+# Stage 2: extract the rest of packages
foreach (pkg_set ${pkg_list})
foreach (url ${pkg_${pkg_set}_urls})
get_filename_component (filename ${url} NAME)
message (STATUS "Extracting ${filename}...")
-
- if (filename MATCHES "\\.7z$")
- set (extract_command ${sevenzip_executable} x)
- set (quiet OUTPUT_QUIET)
- else (filename MATCHES "\\.7z$")
- set (extract_command ${CMAKE_COMMAND} -E tar xf)
- set (quiet)
- endif (filename MATCHES "\\.7z$")
+ set (extract_command ${CMAKE_COMMAND} -E tar xf)
set (filename ${pkg_dir}/${filename})
if (pkg_${pkg_set}_strip)
file (MAKE_DIRECTORY ${tmp_dir})
execute_process (COMMAND ${extract_command} ${filename}
WORKING_DIRECTORY ${tmp_dir}
- RESULT_VARIABLE status ${quiet})
+ RESULT_VARIABLE status)
file (COPY ${tmp_dir}/${pkg_${pkg_set}_strip}/
DESTINATION ${working_dir})
file (REMOVE_RECURSE ${tmp_dir})
- else (pkg_${pkg_set}_strip)
+ else ()
execute_process (COMMAND ${extract_command} ${filename}
WORKING_DIRECTORY ${working_dir}
- RESULT_VARIABLE status ${quiet})
- endif (pkg_${pkg_set}_strip)
+ RESULT_VARIABLE status)
+ endif ()
if (status)
message (FATAL_ERROR "Extraction failed: ${status}")
- endif (status)
+ endif ()
endforeach (url)
endforeach (pkg_set)
-# Stage 4: final touches
+# Stage 3: final touches
# We have to fix the prefix path as it is completely wrong everywhere
file (GLOB files ${working_dir}/lib/pkgconfig/*.pc)
foreach (file ${files})