# #Environment for building native autotools-based packages. The concept of #portability purported by such packages is centered around an FHS filesystem #layout and a BASH shell which offers a "Pandora's box" of utility programs #like SED/AWK/GREP/MAKE available via the PATH. Configuring such #autotools-based packages must be done using a ./configure script executed #inside a BASH shell with a FHS file system layout. We need a bash shell and #the assumed Pandora's box. # #NOTE: The following requires 64 bit Windows. #Should not be a problem in the year 2018. # if (WIN32) #On Windows, we rely on MSYS2 to provide an FHS bash environment with a toolchain #that can build native Windows applications. ExternalProject_Add ( autotools PREFIX ${CMAKE_INSTALL_PREFIX} BUILD_IN_SOURCE 1 URL https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20180531.tar.xz URL_MD5 29ce9b77a0fb8452d1a34858c977852f #To make sense of the alchemy below, see https://github.com/msys2/msys2/wiki/MSYS2-installation CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env MSYSTEM=MINGW64 CHERE_INVOKING=1 ${POSIX_ROOT}/usr/bin/bash.exe --login -c "exit 0" #Update the package database and then install development tools #See https://github.com/Alexpux/MSYS2-packages/issues/148 for which packages we install #yasm is installed in order to compile ffmpeg BUILD_COMMAND ${CMAKE_COMMAND} -E env MSYSTEM=MINGW64 CHERE_INVOKING=1 ${POSIX_ROOT}/usr/bin/bash.exe --login -c "pacman -Suu --noconfirm" COMMAND ${CMAKE_COMMAND} -E env MSYSTEM=MINGW64 CHERE_INVOKING=1 ${POSIX_ROOT}/usr/bin/bash.exe --login -c "pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain yasm" #Install a small batch file ${CMAKE_INSTALL_PREFIX}/bin/bash.cmd which we will use to start a bash shell INSTALL_COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_CURRENT_LIST_DIR}/install.cmake DEPENDS posix-runtime ) set (BASH_CMD "${CMAKE_INSTALL_PREFIX}/bin/bash.cmd" PARENT_SCOPE) endif (WIN32) if (UNIX) #UNIX systems have a builtin bash shell, so there is no need to install anything. set (BASH_CMD "" PARENT_SCOPE) #Define an empty bash project so that dependencies on autotools can be #specified indendently of WIN32 or UNIX. ExternalProject_Add ( autotools BUILD_IN_SOURCE 1 DOWNLOAD_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS posix-runtime ) endif (UNIX)