Added .appveyor.yml to the repo and better config (#7474)

This commit is contained in:
xarkes 2017-05-18 16:50:52 +02:00 committed by radare
parent 894d083127
commit ccc39a88cf
8 changed files with 120 additions and 20 deletions

75
.appveyor.yml Normal file
View File

@ -0,0 +1,75 @@
# Version format
version: 1.5.0.{build}-git
# Skip Github tags
skip_tags: true
# VM Template
image: Visual Studio 2015
# Clone depth
clone_depth: 1
# Branches to clone
branches:
only:
- master
# Environment variables
environment:
matrix:
# TODO Add missing build platforms
# MSVC Variables
#- builder: msvc
# MESON Variables
- builder: msvc_meson
PYTHON: 'C:\\Python36-x64'
BUILD_DIR: build
NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip
# MINGW32 Variables
- builder: mingw32
EXP_PATH: '/c/mingw/bin:/c/mingw/msys/1.0/bin:/c/Program\ Files\ \(x86\)/Git/bin'
# MSYS2 Variables
#- builder: msys2
# MSYS2_DIR: msys64
# MSYS2_ARCH: x86_64
# MSYSTEM: MINGW64
## CYGWIN32 Variables
#- builder: cygwin32
# init_command: git config --global core.autocrlf input
# CYG_CACHE: 'C:\cygwin\var\cache\setup'
# CYG_BASH: 'C:\cygwin\bin\bash'
# ZIP_ROOT: '%APPVEYOR_BUILD_FOLDER%\zip'
ARTIFACT_ZIP: 'radare2-%builder%-%APPVEYOR_BUILD_VERSION%.zip'
# Init
init:
- cmd: "%init_command%"
# Required softwares for building
install:
# TODO Add ninja and meson to cached folder (and capstone)
- cmd: if %builder% == msvc_meson ( %PYTHON%\python.exe -m pip install meson && powershell -Command wget %NINJA_URL% -OutFile ninja.zip && unzip ninja.zip )
# Cached folders
cache:
- "%CYG_CACHE%"
- "%ZIP_ROOT%"
# Build scripts
build_script:
- cmd: if %builder% == msvc ( sys\msvc.bat && make windist WINBITS=%builder% )
- cmd: if %builder% == msvc_meson ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && cd shlr && git clone https://github.com/aquynh/capstone && cd capstone && git checkout next && git reset --hard 2b84c0cf2c992e7010d7f67535cc791bd1d2e427 && cd ..\.. && make meson-config && %PYTHON%\\python.exe C:\\Python36-x64\\Scripts\\meson.py %BUILD_DIR% && ninja.exe -C build && ninja.exe -C build install && echo %ARTIFACT_ZIP% && zip -r %ARTIFACT_ZIP% C:\bin C:\lib )
- cmd: if %builder% == mingw32 ( sys\mingw32.bat && sh -c "export PATH=%EXP_PATH%:${PATH}; make windist WINBITS=%builder% ZIPNAME=%ARTIFACT_ZIP%" )
- cmd: if %builder% == msys2 ( set && set PATH=C:\%MSYS2_DIR%\%MSYSTEM%\bin;C:\%MSYS2_DIR%\usr\bin;"%PATH%" && echo "%PATH%" && sh.exe -c "export PATH=${PATH}:/mingw64/bin; ./configure --build=i686-unknown-windows-gnu ; mingw32-make -j1 ; mingw32-make windist WINBITS=%builder%" )
- cmd: if %builder% == cygwin32 ( %CYG_BASH% -lc "gcc -v" && %CYG_BASH% -lc "uname | tr 'A-Z' 'a-z'" && %CYG_BASH% -lc 'cd $APPVEYOR_BUILD_FOLDER; ./configure --prefix=/usr/local' && %CYG_BASH% -lc 'cd $APPVEYOR_BUILD_FOLDER; make' && %CYG_BASH% -lc 'cd $APPVEYOR_BUILD_FOLDER; make windist WINBITS=%builder%' )
# Artifacts
artifacts:
- path: "%ARTIFACT_ZIP%"
# Disable test
test: off
# Disable deployment
deploy: off

View File

@ -97,6 +97,7 @@ w64dist:
${MAKE} windist WINBITS=w64
WINDIST=${WINBITS}dist
ZIPNAME?=radare2-${WINBITS}-${VERSION}.zip
C=$(shell printf "\033[32m")
R=$(shell printf "\033[0m")
@ -151,7 +152,7 @@ windist:
@mv "${WINDIST}" "radare2-${WINBITS}-${VERSION}"
@rm -f "radare2-${WINBITS}-${VERSION}.zip"
ifneq ($(USE_ZIP),NO)
$(ZIP) -r "radare2-${WINBITS}-${VERSION}.zip" "radare2-${WINBITS}-${VERSION}"
$(ZIP) -r "${ZIPNAME}" "radare2-${WINBITS}-${VERSION}"
endif
clean: rmd

View File

@ -419,7 +419,7 @@ static inline void *r_new_copy(int size, void *data) {
#ifdef _WIN64
#define R_SYS_ARCH "x86"
#define R_SYS_BITS (R_SYS_BITS_32 | R_SYS_BITS_64)
#define __x86_64__
#define __x86_64__ 1
#else
#define R_SYS_ARCH "x86"
#define R_SYS_BITS (R_SYS_BITS_32)

View File

@ -76,7 +76,7 @@ $(LIBSO): $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ}
if [ $$do = 1 ]; then \
[ -n "${SILENT}" ] && \
echo "LD $(LIBSO)" || \
echo "${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LINK} ${LDFLAGS}" ; \
echo "\"${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LINK} ${LDFLAGS}\"" ; \
${CC_LIB} ${LIBNAME} ${CFLAGS} ${OBJS} ${SHARED_OBJ} ${LINK} ${LDFLAGS} || exit 1; \
[ -f "$(LIBR)/stripsyms.sh" ] && sh $(LIBR)/stripsyms.sh ${LIBSO} ${NAME} ; \
break ; \

View File

@ -213,6 +213,10 @@ EOF
#ignore MMD
;;
-fPIC)
#ignore fPIC
;;
-*)
# Remaining '-' options are passed to the compiler
val=$(echo "$1" | cut -c2-)
@ -259,9 +263,14 @@ EOF
shift
done
;;
/*/*)
# If there are multiple slashes, then it's an absoulte path
path=$(cygpath -aw "$1")
clopt="${clopt},${path}"
;;
/*)
# All '/' options are assumed to be for cl and are passed through
# All '/' options (except the one above) are assumed to be options
val=$(echo "$1" | cut -c2-)
clopt="${clopt},${slash}${val}"
;;

View File

@ -43,11 +43,17 @@ call :convert_mingw MINGW_BIN_PATH
call :convert_mingw MINGW_MSYS_PATH
call :convert_mingw GIT_BIN_PATH
sh.exe -c "export PATH=${MINGW_BIN_PATH}:${MINGW_MSYS_PATH}:${GIT_BIN_PATH}:${PATH} ; gcc -v"
set EXPAND_PATH=export PATH="${MINGW_BIN_PATH}:${MINGW_MSYS_PATH}:${GIT_BIN_PATH}:${PATH}"
sh.exe -c "%EXPAND_PATH% ; gcc -v"
sh.exe -c "uname | tr 'A-Z' 'a-z'"
sh.exe -c "echo CC=${CC}"
sh.exe -c "sed -i '/xtensa/d' plugins.def.cfg"
sh.exe -c "export PATH=${MINGW_BIN_PATH}:${MINGW_MSYS_PATH}:${GIT_BIN_PATH}:${PATH} ; ./configure --with-ostype=mingw32 --build=i686-unknown-windows-gnu && make -j1 CC='gcc -static-libgcc' && make w32dist USE_ZIP=NO"
sh.exe -c "%EXPAND_PATH% ; ./configure --with-ostype=mingw32 --build=i686-unknown-windows-gnu && make -j1 CC='gcc -static-libgcc'"
if NOT "%APPVEYOR%" == "True" (
sh.exe -c "%EXPAND_PATH% ; make w32dist USE_ZIP=NO"
)
rem if "%APPVEYOR%" == "True" (
rem appveyor DownloadFile https://raw.githubusercontent.com/radare/radare2-win-installer/master/radare2.iss
rem appveyor DownloadFile https://raw.githubusercontent.com/radare/radare2-win-installer/master/radare2.ico

View File

@ -11,15 +11,27 @@ set VC_VARS_ALL=
if ["%VC_VARS_ALL%"] == [""] goto :FindVcVars else goto :SetVars
:FindVcVars
setlocal enabledelayedexpansion
echo VC_VARS_ALL was not set, trying to find its location...
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7"
set VC_VER=0
for /F "skip=2 tokens=1,2*" %%A in ('REG QUERY %KEY_NAME% 2^>nul') do (
set VC_DIR=%%C
for /F "tokens=1,2 delims=." %%X in ("%%A") do (
set VER=%%X
)
if !VER! GTR !VC_VER! (
set VC_VER=!VER!
set VC_DIR=%%C
)
)
if ["%VC_DIR%"] == [""] goto :FindFail
endlocal & (
set "VC_DIR=%VC_DIR%"
set "VC_VER=%VC_VER%"
)
:VcVarsDefaults
echo Found VC_DIR location: %VC_DIR%
echo Found VC_DIR location: %VC_DIR% (version %VC_VER%)
if exist "%VC_DIR%VC\Auxiliary\Build\vcvarsall.bat" (
set vcvarsall="%VC_DIR%VC\Auxiliary\Build\vcvarsall.bat"
)
@ -49,12 +61,12 @@ set VC_LIB=%LIB%
:Bash
echo Calling script...
PATH=%cd%\sys;C:\cygwin64\bin;%PATH%
bash sys\msvc.sh
goto :End
cmd /c bash sys\msvc.sh
exit /b %errorlevel%
goto :End
:FindFail
echo Could not find the vcvarsall.bat location.
echo Maybe are you missing Visual Studio compiler ?
echo Try setting it manually at the beginning of this file.
:End

View File

@ -1,10 +1,7 @@
#!/bin/sh
#make clean
CC=cccl
# Configure
#COMPILER=${CC} USERCC=${CC} CC=${CC} LD=${CC} ./configure --with-ostype=windows --with-nonpic --without-pic
if [ ! -e "libr/config.mk" ]; then
COMPILER=${CC} USERCC=${CC} CC=${CC} LD=${CC} ./configure --with-ostype=windows
if [ $? -ne 0 ]; then
@ -14,8 +11,8 @@ if [ ! -e "libr/config.mk" ]; then
rm test.exe test.obj
fi
# TODO I cannot say why cl.exe does not use the environment variables when ran from make
# so I give it to cl.exe with -LIBPATH (translated from -L by cccl)
# cl.exe does not use the environment variables when ran from make
# so let's give it to cl.exe with -LIBPATH (translated from -L by cccl)
_IFS=${IFS}
IFS=\;
for path in ${LIBPATH}${LIB}; do
@ -24,10 +21,10 @@ done
IFS=${_IFS}
# Use /FS to allow cl.exe to write to the same .pdb file
CFLAGS="/FS"
CFLAGS="-FS"
# Include msvc directory to provide unistd.h and sys/time.h
INC_DIR=$(cygpath -aw $(pwd)/libr/include/msvc)
CFLAGS="${CFLAGS} /I\"${INC_DIR}\""
CFLAGS="${CFLAGS} -I\"${INC_DIR}\""
export CCCL_OPTIONS="--cccl-verbose"
export CFLAGS="${CFLAGS}"
@ -44,8 +41,8 @@ sed -i "s,p/z80.mk ,," libr/config.mk
# Now we can make
make CC=${CC} USERCC=${CC} HOST_CC=${CC} USE_CAPSTONE=1
#make w64dist
ERR=$?
# Reset capstone Makefile (git)
sed -i s/CS_RELEASE=1/CS_RELEASE=0/ shlr/Makefile
exit $ERR