-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
126 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
copy c99wrap.exe %LIBRARY_BIN%\c99wrap.exe | ||
copy c99conv.exe %LIBRARY_BIN%\c99conv.exe | ||
copy makedef %LIBRARY_BIN%\makedef | ||
|
||
rem Have to run the test here as cl.exe is only | ||
rem available during building. | ||
c99wrap cl /EP /P %RECIPE_DIR%\unit.c | ||
copy "%RECIPE_DIR%\build.sh" . | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "LIBRARY_PREFIX=%%i" | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%PREFIX%"') DO set "PREFIX=%%i" | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%PYTHON%"') DO set "PYTHON=%%i" | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%RECIPE_DIR%"') DO set "RECIPE_DIR=%%i" | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%SP_DIR%"') DO set "SP_DIR=%%i" | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%SRC_DIR%"') DO set "SRC_DIR=%%i" | ||
FOR /F "delims=" %%i IN ('cygpath.exe -u "%STDLIB_DIR%"') DO set "STDLIB_DIR=%%i" | ||
set MSYSTEM=MINGW%ARCH% | ||
set MSYS2_PATH_TYPE=inherit | ||
set CHERE_INVOKING=1 | ||
bash -lc ./build.sh | ||
if errorlevel 1 exit 1 | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
# $(dirname $(dirname $(dirname $(which 7z))))/usr/lib/p7zip/7z x -aoa -o$PWD/clang LLVM*${ARCH}.exe || exit 1 | ||
pushd llvm | ||
7z x -aoa -o$PWD/clang LLVM*.exe || exit 1 | ||
popd | ||
|
||
CLANGDIR=${PWD}/clang | ||
# Rename libclang.dll to avoid conflicts. Sorry. No one builds static libclangs on Windows for some reason? | ||
cp ${CLANGDIR}/bin/libclang.dll ${CLANGDIR}/bin/c99-to-c89-libclang.dll | ||
|
||
# Create an import library for c99-to-c89-libclang.dll | ||
gendef ${CLANGDIR}/bin/c99-to-c89-libclang.dll - > c99-to-c89-libclang.dll.def | ||
sed -i 's|LIBRARY "libclang.dll"|LIBRARY "c99-to-c89-libclang.dll"|' c99-to-c89-libclang.dll.def | ||
if [[ ${ARCH} == 32 ]]; then | ||
MS_MACH=X86 | ||
else | ||
MS_MACH=X64 | ||
fi | ||
if [[ ${vc} == 9 ]]; then | ||
SNPRINTF=-Dsnprintf=_snprintf | ||
fi | ||
lib /def:c99-to-c89-libclang.dll.def /out:$(cygpath -m ${CLANGDIR}/lib/c99-to-c89-libclang.lib) /machine:${MS_MACH} | ||
|
||
if ! CFLAGS="${CFLAGS} -I${BUILD_PREFIX}/Library/include ${SNPRINTF}" CLANGDIR=${PWD}/clang make -f Makefile.w32; then | ||
echo "ERROR :: Build failed" | ||
exit 1 | ||
fi | ||
cp c99*.exe ${CLANGDIR}/bin/c99-to-c89-libclang.dll ${PREFIX}/Library/bin | ||
|
||
# This file should be passed to the CMake command-line as: | ||
# -DCMAKE_C_COMPILER="c99-to-c89-cmake-nmake-wrap.bat" | ||
# I have given it a very specific name as I do not know that it will work for any other CMake. | ||
# We set the some debug flags so that we see the contents of the @response files and so that | ||
# temporaries are retained. | ||
pushd ${PREFIX}/Library/bin | ||
echo "@echo off" > c99-to-c89-cmake-nmake-wrap.bat | ||
echo "echo cd %CD%" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo "setlocal EnableExtensions EnableDelayedExpansion" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo "if \"%VERBOSE_CM%\"==\"1\" (" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo " set C99_TO_C89_WRAP_DEBUG_LEVEL=1" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo " set C99_TO_C89_WRAP_SAVE_TEMPS=1" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo " set C99_TO_C89_WRAP_NO_LINE_DIRECTIVES=1" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo " set C99_TO_C89_CONV_DEBUG_LEVEL=1" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo ")" >> c99-to-c89-cmake-nmake-wrap.bat | ||
echo "%~dp0c99wrap.exe -keep cl %*" >> c99-to-c89-cmake-nmake-wrap.bat | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,81 @@ | ||
{% set version = "1.0.3" %} | ||
{% set version = "1.0.4" %} | ||
|
||
package: | ||
name: c99-to-c89 | ||
version: {{ version }} | ||
|
||
source: | ||
fn: c99-to-c89-{{ version }}.zip # [win] | ||
url: https://github.com/libav/c99-to-c89/releases/download/release-1.0.3/c99-to-c89-{{ version }}.zip # [win] | ||
md5: d58bc9741f258841aa3196a1b4155e51 | ||
- url: https://github.com/AnacondaRecipes/c99-to-c89/archive/release-{{ version }}.tar.gz | ||
sha256: 1df2ec430d34e9034d162969fe1a12cee50fa67cacdcc60d7b57b6c45b576467 | ||
# We need a libclang. No one builds them statically for Windows unfortunately (though the | ||
# libav binaries have been built this way). I rename the libclang.dll in these to avoid | ||
# conflicts with conda-forge's clangdev (which we cannot use at present due to compat). | ||
# LLVM 6 has changed too much and is no longer compatible. It is at the ABI level, but | ||
# not semantically (Assertion failed: n_tokens == 2, file convert.c, line 559). | ||
- url: http://releases.llvm.org/3.9.1/LLVM-3.9.1-win64.exe | ||
sha256: 7ea2b7bc0de6b96a6ce11e6cfece7b84a31fb0c86c977f42ee178cba41517606 | ||
folder: llvm | ||
|
||
build: | ||
number: 0 | ||
skip: True # [unix] | ||
|
||
skip: true # [win and vc!=14] | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- msinttypes # [win and vc==9] | ||
- m2-sed | ||
- m2-base | ||
- m2-make | ||
- m2-filesystem | ||
- m2-p7zip | ||
- m2w64-tools-git | ||
|
||
test: | ||
requires: | ||
- {{ compiler('c') }} | ||
test: | ||
source_files: | ||
- c99-to-c89-release/recipe/tests | ||
commands: | ||
# Would be good to run this - but can't because there are no version or help | ||
# commands and without the proper input arguments it always returns exit code 1 | ||
- if not exist %PREFIX%\\Library\\bin\\c99wrap.exe exit 1 # [win] | ||
- if not exist %PREFIX%\\Library\\bin\\c99conv.exe exit 1 # [win] | ||
- echo on | ||
- echo cd %CD% | ||
- set C99_TO_C89_CONV_DEBUG_LEVEL=0 | ||
- set C99_TO_C89_WRAP_DEBUG_LEVEL=0 | ||
- set C99_TO_C89_WRAP_SAVE_TEMPS=1 | ||
- set C99_TO_C89_WRAP_NO_LINE_DIRECTIVES=1 | ||
# Simple but large test: | ||
- c99wrap cl /nologo -DDLL_EXPORT -DHAVE_CONFIG_H -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -Dlzma_EXPORTS -I%CD%\tests /DWIN32 /D_WINDOWS /Fo%TEMP%\check.c.obj -c %CD%\c99-to-c89-release\recipe\tests\check.c | ||
- echo /nologo -DDLL_EXPORT -DHAVE_CONFIG_H -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -Dlzma_EXPORTS -I%CD%\tests /DWIN32 /D_WINDOWS /Fo%TEMP%\check.c.obj -c %CD%\c99-to-c89-release\recipe\tests\check.c > response-file | ||
# Same test but via a response-file: | ||
- c99wrap cl @response-file | ||
# Small tests from now on so can safely enable a lot of debug output: | ||
- set C99_TO_C89_CONV_DEBUG_LEVEL=2 | ||
- set C99_TO_C89_WRAP_DEBUG_LEVEL=2 | ||
# Test fix for broken handling of empty cond-statement in loops when moving the decl out of the init-expression: | ||
# for (int i = 0 ; ; ++i) {} => int i = 0 ; ; for ( ; i++) {} | ||
- c99wrap cl /Folzma_encoder_optimal_normal.c.obj -c %CD%\c99-to-c89-release\recipe\tests\lzma_encoder_optimal_normal.c | ||
# Simple case I broke when attempting to fix cursor position management bug tested below: | ||
- c99wrap cl /Focheck-2.c.obj -c %CD%\c99-to-c89-release\recipe\tests\check-2.c | ||
# The cl pre-processor does not remove line continuations and the cl compiler cannot handle these: | ||
- c99wrap cl /Fotest-macro-line-continuation.o -c %CD%\c99-to-c89-release\recipe\tests\test-macro-line-continuation.c | ||
- c99wrap cl /Fotest-pragma-comment.o -c %CD%\c99-to-c89-release\recipe\tests\test-pragma-comment.c | ||
# Next problem, cursor position management bug. "else if" => "elseif" and all other spaces vanish | ||
# after insertion text to an earlier position on the same line, fixed by maintaining relative spacing. | ||
# .. this test must be the last one due it exiting in both cases (though we could probably make it a | ||
# c99wrap test instead so failure to compile would cause a natural exit). | ||
- c99conv -ms %CD%\c99-to-c89-release\recipe\tests\stream_encoder.c.obj_preprocessed.c stream_encoder.c.converted.c | ||
- findstr elseif stream_encoder.c.converted.c && (exit /b 1) || (exit /b 0) | ||
|
||
about: | ||
home: https://github.com/libav/c99-to-c89/ | ||
license: Apache v2 | ||
summary: 'Tool to convert C99 code to MSVC-compatible C89' | ||
home: https://github.com/libav/c99-to-c89 | ||
license: Apache 2.0 | ||
license_family: Apache | ||
license_file: LICENSE | ||
summary: 'Tool to convert C99 code to MSVC-compatible C89, with many Anaconda Distribution fixes' | ||
dev_url: https://github.com/libav/c99-to-c89 | ||
|
||
extra: | ||
recipe-maintainers: | ||
- mingwandroid | ||
- patricksnape |
This file was deleted.
Oops, something went wrong.