Add support for MinGW/msys2 in 32 bits + Updates in buildserver

v0.27.3
Robin Mills 7 years ago committed by Luis Díaz Más
parent e347b41279
commit 42084f2563

@ -21,14 +21,13 @@
4. [Platform Notes](#4)
1. [Linux](#4-1)
2. [MacOS-X](#4-2)
3. [Cygwin](#4-3)
4. [MinGW msys/2](#4-4)
3. [MinGW/msys2](#4-3)
4. [Cygwin](#4-3)
5. [Microsoft Visual C++](#4-5)
5. [Test Suit](#5)
1. [Running tests on a UNIX-like system](#5-1)
2. [Running tests on Visual Studio builds](#5-2)
<name id="1"></a>
# Welcome to Exiv2
@ -293,33 +292,46 @@ You should build and install CMake from source.
[TOC](#TOC)
<name id="4-3"></a>
### 4.3 MinGW msys/2 64
### 4.3 MinGW/msys2
Support for MinGW/msys1.0 32 bit build was provided for Exiv2 v0.26.
#### MSYS 64 bit
https://www.msys2.org
Download: http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe
#### msys64.bat
I use this batch file to start the MinGW bash shell from the Dos Command Prompt (cmd.exe)
```
$ cat msys64.bat
setlocal
set "PATH=c:\msys64\usr\bin;c:\msys64\usr\local\bin;c:\msys64\mingw64\bin;"
set "PS1=\! \u@\h:\w \$ "
set "PS1=\! \u@\h-64:\w \$ "
bash.exe -norc
$
```
#### Install MinGW Dependencies
#### MSYS 32 bit
http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe
$ pacman -S base-devel
I use this batch file to start the MinGW bash shell from the Dos Command Prompt (cmd.exe)
```
$ for i in libtre git coreutils mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-cmake; do (echo y|pacman -S $i); done
$ cat msys32.bat
setlocal
set "PATH=c:\msys32\usr\bin;c:\msys32\usr\local\bin;c:\msys32\mingw64\bin;"
set "PS1=\! \u@\h-32:\w \$ "
bash.exe -norc
$
```
#### Download exiv2 from github and build.
#### Install MinGW Dependencies
```
for i in base-devel git cmake coreutils python3 man gcc gdb make dos2unix diffutils zlib-devel libexpat-devel libiconv-devel; do (echo y|pacman -S $i); done
```
#### Download exiv2 from github and build
```
$ mkdir -p ~/gnu/github/exiv2
@ -329,6 +341,11 @@ $ mkdir build ; cd build ;
$ cmake .. -G "Unix Makefiles"
$ make
```
#### MinGW and Regex
The exiv2 command line program provides a `--grep` option which filters output. The implementation requires the header file `<regex.h>` and supporting library to be available during the build. When not available, the option degenerates to a substring match. Because there are multiple versions of `<regex.h>` available on the MinGW platform, detection of Regex is always disabled on this platform.
[TOC](#TOC)
<name id="4-4"></a>
@ -345,7 +362,6 @@ https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
Download and build cmake from source because I can't get the cygwin installed cmake 3.6.2 to work
To build cmake from source (for 3.11+), you need libncurses.
[TOC](#TOC)
<name id="4-5"></a>
@ -391,7 +407,7 @@ rmills@rmillsmbp-w7 ~/gnu/github/exiv2/exiv2/test $ env EXIV2_BINDIR=${PWD}/../b
<name id="5-2"></a>
### 5.2 Running tests on Visual Studio builds
Use the bash interpreter for MinGW/msys/2 to run the test suite.
Use the bash interpreter for MinGW/msys2 to run the test suite.
$ cd ...../build/../test
$ export EXIV2_EXT=.exe

@ -1,6 +1,6 @@
# These flags applies to exiv2lib, the applications, and to the xmp code
if ( MINGW OR UNIX ) # MINGW, Linux, APPLE, CYGWIN
if ( MINGW OR UNIX OR MSYS ) # MINGW, Linux, APPLE, CYGWIN
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(COMPILER_IS_GCC ON)
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
@ -59,7 +59,7 @@ if ( MINGW OR UNIX ) # MINGW, Linux, APPLE, CYGWIN
endif()
# sorry, ASAN does not work on Windows
if ( NOT CYGWIN AND NOT MINGW )
if ( NOT CYGWIN AND NOT MINGW AND NOT MSYS )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
@ -157,7 +157,7 @@ if(MSVC)
set(CMAKE_CXX_COMPILER ${CLCACHE})
endif()
endif()
set(variables
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL

@ -50,12 +50,6 @@
// Define if you have the <stdint.h> header file.
#cmakedefine EXV_HAVE_STDINT_H
#ifndef EXV_HAVE_STDINT_H
#if defined(__MINGW32__) || defined(__MINGW64__)
#define EXV_HAVE_STDINT_H
#endif
#endif
// Define if you have the <strings.h> header file.
#cmakedefine EXV_HAVE_STRINGS_H

@ -10,13 +10,6 @@ endif()
find_package(Threads REQUIRED)
if(MINGW)
find_package(Regex REQUIRED)
if(REGEX_FOUND)
include_directories(${REGEX_INCLUDE_DIRS})
endif()
endif()
if( EXIV2_ENABLE_PNG )
find_package( ZLIB REQUIRED )
include_directories( ${ZLIB_INCLUDE_DIR} )
@ -84,7 +77,7 @@ if (EXIV2_BUILD_UNIT_TESTS)
endif()
# On Windows we are interested in placing the DLLs together to the binaries in the install/bin
# folder, at the installation step. On other platforms we do not care about that, since the
# folder, at the installation step. On other platforms we do not care about that, since the
# RPATHs will point the locations where the libraries where found.
if (USING_CONAN AND WIN32)
install(DIRECTORY ${PROJECT_BINARY_DIR}/conanDlls/ DESTINATION bin)

@ -7,7 +7,7 @@ set(CPACK_SOURCE_IGNORE_FILES "build.*;\.git/;\.DS_Store/;test;third-party;")
## -----------------------------------------------
## TODO: Luis will rewrite this -----------------
if ( MINGW )
if ( MINGW OR MSYS )
set (PACKNAME MinGW)
elseif ( MSVC )
set (PACKNAME msvc)
@ -15,7 +15,7 @@ else()
set (PACKNAME ${CMAKE_SYSTEM_NAME}) # Darwin or Linux or CYGWIN
endif()
if ( CYGWIN OR MINGW )
if ( CYGWIN OR MINGW OR MSYS )
set(CPACK_GENERATOR TGZ) # MinGW/Cygwin use .tar.gz
elseif ( MSVC )
set(CPACK_GENERATOR ZIP) # use .zip - less likely to damage bin/exiv2.dll permissions

@ -1,8 +1,10 @@
#!/bin/bash
syntax() {
echo "usage: $0 { --help | -? | -h | platform }+ "
echo "usage: $0 { --help | -? | -h | platform | option | switch }+ "
echo "platform: all | cygwin | linux | macosx | mingw | msvc "
echo "switch: --32 | --64 | --2015 | --2017 --publish | --verbose | --static "
echo "option: --branch x | --server x | --user x"
}
announce()
@ -12,6 +14,55 @@ announce()
echo ++++++++++++++++++++++++++++++++
}
bomb() {
echo "*** $1 requires an argument ***" >&2
exit 1
}
unixBuild()
{
announce $1 $2
! ssh $1 ${command} <<EOF
PATH="/usr/local/bin/:/usr/bin:/mingw64/bin:$PATH"
cd ${cd}
mkdir -p buildserver
rm -rf buildserver
git clone --branch $branch https://github.com/exiv2/exiv2 buildserver
mkdir -p buildserver/build buildserver/logs
cd buildserver/build
cmake .. -G "Unix Makefiles" | tee -a logs/build.log
make | tee -a logs/build.log
make tests | tee -a logs/build.log
make package | tee -a logs/build.log
ls -alt *.tar.gz
EOF
}
msvcBuild()
{
cd=c:\\Users\\rmills\\gnu\\github\\exiv2\\
config=Release
profile=msvc2017Release64
generator='"Visual Studio 15 2017 Win64"'
if [ "$edition" == "2015" ]; then
profile=msvc2015Release64
generator='"Visual Studio 154 2015 Win64"'
fi
announce $1 ${profile}
! ssh $1 <<EOF
cd ${cd}
IF EXIST buildserver rmdir/s/q buildserver
git clone --branch ${branch} https://github.com/exiv2/exiv2 buildserver
mkdir buildserver\build
cd buildserver\build
conan install .. --profile ${profile} --build missing
cmake .. -G ${generator} -DCMAKE_BUILD_TYPE=${config} -DCMAKE_INSTALL_PREFIX=..\\dist\\${profile} | tee -a logs/build.log
cmake --build . --config ${config} --target install
cmake --build . --config ${config} --target package
ls -alt *.zip
EOF
}
msvc=0
cygwin=0
mingw=0
@ -19,6 +70,17 @@ cygwin=0
macosx=0
linux=0
help=0
publish=0
verbose=0
b64=0
b32=0
static=0
edition=2017
branch=RC1
dryrun=0
server=rmillsmm
user=rmills
if [ "$#" == "0" ]; then help=1; fi
@ -31,6 +93,17 @@ while [ "$#" != "0" ]; do
macosx) macosx=1 ;;
mingw) mingw=1 ;;
msvc) msvc=1 ;;
--64) b64=1 ;;
--32) b32=1 ;;
--verbose) verbose=1 ;;
--dryrun) dryrun=1 ;;
--publish) publish=1 ;;
--static) static=1 ;;
--2017) edition=2017 ;;
--2015) edition=2015 ;;
--server) if [ $# -gt 1 ]; then server=$2; shift 2 ; else bomb $1 ; fi ;;
--branch) if [ $# -gt 1 ]; then branch=$2; shift 2 ; else bomb $1 ; fi ;;
--user) if [ $# -gt 1 ]; then user=$2 ; shift 2 ; else bomb $1 ; fi ;;
*) echo "invalid option: $1" 1>&2; help=1; ;;
esac
if [ "$#" != "0" ]; then shift ; fi
@ -41,66 +114,39 @@ if [ $help == 1 ]; then
exit 0;
fi
if [ "$b64" == "0" -a "$b32" == "0" ]; then b64=1; fi
if [ "$b64" == "1" -a "$b32" == "1" ]; then
echo "*** can't specify --64 && --32 ***" >&2
exit 1
fi
if [ $linux == 1 ]; then
me=Linux
server=rmills@rmillsmm-ubuntu
command=''
cd=/home/rmills/gnu/github/exiv2/
unixBuild ${user}@${server}-ubuntu Linux
fi
if [ $macosx == 1 ]; then
me=MacOS-X
server=rmills@rmillsmm
cd=/Users/rmills/gnu/github/exiv2/
command=''
cd=/Users/rmills/gnu/github/exiv2/
command=''
unixBuild ${user}@${server} MacOSX
fi
if [ $mingw == 1 ]; then
me=MinGW
server=rmills@rmillsmm-w7
command='msys64'
cd=/home/rmills/gnu/github/exiv2/
command='msys64'
if [ $b32 == 1 ]; then command='msys32' ; fi
cd=/home/rmills/gnu/github/exiv2/
unixBuild ${user}@${server}-w7 MinGW
fi
if [ $cygwin == 1 ]; then
me=Cygwin
server=rmills@rmillsmm-w7
command='c:\\cygwin64\\bin\\bash.exe'
fi
if [ ! -z $server ]; then
announce $me
! ssh ${server} ${command} <<EOF
PATH="/usr/local/bin/:/usr/bin:/mingw64/bin:$PATH"
cd ${cd}
mkdir -p buildserver
rm -rf buildserver
git clone --branch RC1 https://github.com/exiv2/exiv2 buildserver
mkdir -p buildserver/build
cd buildserver/build
cmake .. -G "Unix Makefiles"
make
make tests
make package
EOF
cd=/home/rmills/gnu/github/exiv2/
command='c:\\cygwin64\\bin\\bash.exe'
unixBuild ${user}@${server}-w7 Cygwin
fi
if [ $msvc == 1 ]; then
cd=c:\\Users\\rmills\\gnu\\github\\exiv2\\
profile=msvc2017Release64
config=Release
generator='"Visual Studio 15 2017 Win64"'
announce ${profile}
! ssh rmills@rmillsmm-w7 <<EOF
cd ${cd}
IF EXIST buildserver rmdir/s/q buildserver
git clone --branch RC1 https://github.com/exiv2/exiv2 buildserver
mkdir buildserver\build
cd buildserver\build
conan install .. --profile ${profile} --build missing
cmake .. -G ${generator} -DCMAKE_BUILD_TYPE=${config} -DCMAKE_INSTALL_PREFIX=..\\dist\\${profile}
cmake --build . --config ${config} --target install
EOF
msvcBuild ${user}@${server}-w7
fi
# That's all Folks

@ -231,7 +231,7 @@ elseif(EXIV2_ENABLE_EXTERNAL_XMP)
target_compile_definitions(exiv2lib PUBLIC EXV_ADOBE_XMPSDK=2016)
endif()
# TODO : We should not include include/exiv2 but only include !!!
# Use include/exiv2 to build libary code
target_include_directories(exiv2lib PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/exiv2>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
@ -262,30 +262,27 @@ if (EXIV2_ENABLE_WEBREADY)
endif()
if ( MSVC )
if ( MSVC OR CYGWIN OR MINGW OR MSYS)
target_compile_definitions(exiv2lib
PRIVATE
PSAPI_VERSION=1 # to be compatible with <= WinVista (#905)
)
endif()
if ( MSVC )
source_group("Header Files" FILES ${LIBEXIV2_HDR} )
source_group("Header Files" FILES ${LIBCURL_HDR} )
source_group("Header Files" FILES ${SSH_HDR} )
target_link_libraries( exiv2lib PRIVATE ${CURL_LIBRARIES} ${SSH_LIBRARIES})
else()
# TODO: Check if this is really needed.
if ( UNIX AND NOT FREEBSD )
target_link_libraries( exiv2lib PRIVATE ${CMAKE_DL_LIBS}) # -ldl = dynamic loader used by src/version.cpp
endif()
if (CYGWIN OR MINGW)
if (CYGWIN OR MINGW OR MSYS)
target_link_libraries( exiv2lib PRIVATE psapi ws2_32 )
endif()
if (MINGW)
target_link_libraries( exiv2lib PRIVATE ${REGEX_LIBRARIES} )
endif()
target_link_libraries( exiv2lib PRIVATE Threads::Threads)
endif()
@ -340,13 +337,7 @@ if(EXIV2_BUILD_EXIV2_COMMAND)
target_compile_definitions(exiv2 PRIVATE EXV_HAVE_DLL )
endif()
if (MINGW)
target_link_libraries( exiv2 PRIVATE ${REGEX_LIBRARIES} )
endif()
# modify source lists to suit environment
# TODO This should not be needed here! we need to fix the previous TODO
target_include_directories(exiv2 PRIVATE ${CMAKE_SOURCE_DIR}/include/)
# Copy DLLs from conan packages to the bin folder

@ -222,7 +222,9 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys)
#endif
const char* platform =
#if defined(__CYGWIN__)
#if defined(__MSYS__)
"msys";
#elif defined(__CYGWIN__)
"cygwin";
#elif defined(_MSC_VER)
"windows";

Loading…
Cancel
Save