mirror of https://github.com/mono/CppSharp.git
9 changed files with 281 additions and 0 deletions
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
require "Utils" |
||||
|
||||
local llvm_build = "../../deps/llvm/build" |
||||
|
||||
function clean_build() |
||||
os.rmdir(llvm_build) |
||||
os.mkdir(llvm_build) |
||||
end |
||||
|
||||
function cmake(gen) |
||||
os.chdir(llvm_build) |
||||
local cmd = "cmake -G " .. '"' .. gen .. '"' |
||||
.. " -DCLANG_BUILD_EXAMPLES=false -DCLANG_INCLUDE_DOCS=false -DCLANG_INCLUDE_TESTS=false" |
||||
.. ' -DCLANG_INCLUDE_DOCS=false -DCLANG_BUILD_EXAMPLES=false -DLLVM_TARGETS_TO_BUILD="X86"' |
||||
.. ' -DLLVM_INCLUDE_EXAMPLES=false -DLLVM_INCLUDE_DOCS=false -DLLVM_INCLUDE_TESTS=false -DCMAKE_BUILD_TYPE=Release ..' |
||||
execute(cmd) |
||||
end |
||||
|
||||
function get_msbuild_path() |
||||
local msbuild = '%WINDIR%\\system32\\reg.exe query "HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0" /v MSBuildToolsPath' |
||||
local val = execute(msbuild) |
||||
|
||||
for i in string.gmatch(val, "%S+") do |
||||
if os.isdir(i) then |
||||
return i |
||||
end |
||||
end |
||||
|
||||
error("MSBuild path could not be found in Windows registry.") |
||||
end |
||||
|
||||
function msbuild() |
||||
local msbuild_path = path.normalize(path.join(get_msbuild_path(), "msbuild.exe")) |
||||
execute(msbuild_path .. " " .. llvm_build) |
||||
end |
||||
|
||||
function ninja() |
||||
execute("ninja") |
||||
execute("ninja clang-headers") |
||||
end |
||||
|
||||
clean_build() |
||||
cmake("Visual Studio 14 2015") |
||||
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
require "Utils" |
||||
|
||||
function clone() |
||||
if not os.isdir("../deps") then |
||||
print("mkdir") |
||||
os.mkdir(".../deps") |
||||
end |
||||
|
||||
local llvm_release = cat("LLVM-commit") |
||||
print("LLVM release: " .. llvm_release) |
||||
|
||||
local clang_release = cat("Clang-commit") |
||||
print("Clang release: " .. clang_release) |
||||
|
||||
if not os.isdir("../deps/llvm") then |
||||
git.clone("../deps/llvm", "http://llvm.org/git/llvm.git") |
||||
git.checkout("../deps/llvm", llvm_release) |
||||
end |
||||
|
||||
if not os.isdir("../deps/llvm/tools/clang") then |
||||
git.clone("../deps/llvm/tools/clang", "http://llvm.org/git/clang.git") |
||||
git.checkout("../deps/llvm/tools/clang", clang_release) |
||||
end |
||||
end |
||||
|
||||
function download() |
||||
if os.is("windows") then |
||||
http.download("https://dl.dropboxusercontent.com/u/194502/CppSharp/llvm_windows_x86.7z") |
||||
end |
||||
|
||||
-- extract the package |
||||
7z x llvm_windows_x86.7z -o%DEPS_PATH%\llvm -y > nul |
||||
end |
||||
|
||||
function nuget() |
||||
if not os.isfile("nuget.exe") |
||||
http.download("https://nuget.org/nuget.exe") |
||||
end |
||||
|
||||
local nugetexe = os.is("windows") and "NuGet.exe" or "mono ./NuGet.exe" |
||||
execute(nugetexe .. " restore packages.config -PackagesDirectory ../deps") |
||||
end |
||||
|
||||
if _ACTION == "nuget" then |
||||
nuget() |
||||
os.exit() |
||||
end |
||||
|
||||
if _ACTION == "clone" then |
||||
clone() |
||||
os.exit() |
||||
end |
||||
|
||||
if _ACTION == "download" then |
||||
download() |
||||
os.exit() |
||||
end |
||||
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
rmdir /s /q out |
||||
mkdir out |
||||
mkdir out\tools\clang |
||||
mkdir out\tools\clang\lib\CodeGen |
||||
mkdir out\tools\clang\lib\Driver |
||||
mkdir out\build\ |
||||
mkdir out\build\tools\clang\ |
||||
|
||||
set rbcopy=%systemroot%\System32\robocopy /NDL /NFL /NJH /NJS |
||||
set dircopy=%rbcopy% /E |
||||
|
||||
%dircopy% include\ out\include |
||||
%dircopy% build\include\ out\build\include |
||||
%dircopy% build\RelWithDebInfo\lib out\build\RelWithDebInfo\lib |
||||
|
||||
%dircopy% tools\clang\include\ out\tools\clang\include |
||||
copy /Y tools\clang\lib\CodeGen\*.h out\tools\clang\lib\CodeGen >nul |
||||
copy /Y tools\clang\lib\Driver\*.h out\tools\clang\lib\Driver >nul |
||||
%dircopy% build\tools\clang\include\ out\build\tools\clang\include |
||||
|
||||
del out\build\RelWithDebInfo\lib\LLVM*ObjCARCOpts*.lib |
||||
del out\build\RelWithDebInfo\lib\clang*ARC*.lib |
||||
del out\build\RelWithDebInfo\lib\clang*Matchers*.lib |
||||
del out\build\RelWithDebInfo\lib\clang*Rewrite*.lib |
||||
del out\build\RelWithDebInfo\lib\clang*StaticAnalyzer*.lib |
||||
del out\build\RelWithDebInfo\lib\clang*Tooling*.lib |
||||
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
cd ../../deps/llvm |
||||
|
||||
if [ -d "out" ]; then rm -rf out; fi |
||||
mkdir out |
||||
mkdir -p out/lib/clang |
||||
mkdir -p out/tools/clang |
||||
mkdir -p out/tools/clang/lib/CodeGen |
||||
mkdir -p out/tools/clang/lib/Driver |
||||
mkdir -p out/build/ |
||||
mkdir -p out/build/lib |
||||
mkdir -p out/build/tools/clang |
||||
mkdir -p out/build/tools/clang/lib |
||||
|
||||
cp -R include/ out/ |
||||
cp -R build/include/ out/build |
||||
cp build/lib/*.a out/build/lib |
||||
|
||||
cp -R tools/clang/include/ out/tools/clang |
||||
cp -R tools/clang/lib/CodeGen/*.h out/tools/clang/lib/CodeGen |
||||
cp -R tools/clang/lib/Driver/*.h out/tools/clang/lib/Driver |
||||
cp -R build/lib/clang out/lib/clang |
||||
cp -R build/tools/clang/include/ out/build/tools/clang |
||||
|
||||
rm out/build/lib/libllvm*ObjCARCOpts*.a |
||||
rm out/build/lib/libclang*ARC*.a |
||||
rm out/build/lib/libclang*Matchers*.a |
||||
rm out/build/lib/libclang*Rewrite*.a |
||||
rm out/build/lib/libclang*StaticAnalyzer*.a |
||||
rm out/build/lib/libclang*Tooling*.a |
||||
|
||||
7z a llvm_linux_x86_64.7z ./out/* |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
require "Utils" |
||||
|
||||
function download_ninja() |
||||
local system = ""; |
||||
if os.is("windows") then |
||||
system = "win" |
||||
elseif os.is("macosx") then |
||||
system = "mac" |
||||
elseif os.is("linux") then |
||||
system = "linux" |
||||
else |
||||
error("Error downloading Ninja for unknown system") |
||||
end |
||||
|
||||
local url = "https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-" .. system .. ".zip" |
||||
local file = "ninja.zip" |
||||
|
||||
if not os.isfile(file) then |
||||
download(url, file) |
||||
end |
||||
|
||||
if os.isfile(file) then |
||||
print("Extracting file " .. file) |
||||
zip.extract(file, "ninja") |
||||
end |
||||
end |
||||
|
||||
function download_cmake() |
||||
local system = ""; |
||||
if os.is("windows") then |
||||
system = "win32-x86.zip" |
||||
elseif os.is("macosx") then |
||||
system = "Darwin-x86_64.dmg" |
||||
elseif os.is("linux") then |
||||
system = "Linux-x86_64.tar.gz" |
||||
else |
||||
error("Error downloading CMake for unknown system") |
||||
end |
||||
|
||||
local url = "https://cmake.org/files/v3.4/cmake-3.4.0-" .. system |
||||
local file = "cmake.zip" |
||||
|
||||
if not os.isfile(file) then |
||||
download(url, file) |
||||
end |
||||
end |
||||
|
||||
download_ninja() |
||||
download_cmake() |
||||
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
# Add Repos |
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF |
||||
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list |
||||
|
||||
sudo add-apt-repository ppa:george-edison55/cmake-3.x |
||||
apt-get update |
||||
|
||||
# Build tools |
||||
apt-get install -y git build-essential clang cmake ninja-build |
||||
|
||||
apt-get install -y p7zip-full |
||||
|
||||
# Mono |
||||
apt-get install -y mono-devel |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh |
||||
|
||||
echo APPKEY= > ~/.dropbox_uploader |
||||
echo APPSECRET= >> ~/.dropbox_uploader |
||||
echo ACCESS_LEVEL=sandbox >> ~/.dropbox_uploader |
||||
echo OAUTH_ACCESS_TOKEN= >> ~/.dropbox_uploader |
||||
echo OAUTH_ACCESS_TOKEN_SECRET= >> ~/.dropbox_uploader |
||||
|
||||
./dropbox_uploader.sh upload llvm_linux_x86_64.7z llvm_linux_x86_64.7z |
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
function cat(file) |
||||
local file = assert(io.open(file, "r")) |
||||
local output = file:read('*all') |
||||
file:close() |
||||
return output |
||||
end |
||||
|
||||
function execute(cmd) |
||||
print(cmd) |
||||
local file = assert(io.popen(cmd, "r")) |
||||
local output = file:read('*all') |
||||
file:close() |
||||
return output |
||||
end |
||||
|
||||
local git = {} |
||||
|
||||
function git.clone(dir, url, target) |
||||
local cmd = "git clone " .. url .. " " .. path.translate(dir) |
||||
if target ~= nil then |
||||
cmd = cmd .. " " .. target |
||||
end |
||||
execute(cmd) |
||||
end |
||||
|
||||
function git.checkout(dir, rev) |
||||
local cmd = "git -C " .. path.translate(dir) .. " checkout " .. rev |
||||
execute(cmd) |
||||
end |
||||
|
||||
function git.revision(dir) |
||||
local cmd = "git -C " .. path.translate(dir) .. " checkout " .. rev |
||||
execute(cmd) |
||||
end |
||||
|
||||
function http.progress (total, curr) |
||||
local ratio = curr / total; |
||||
ratio = math.floor(math.min(math.max(ratio, 0), 1)); |
||||
|
||||
local percent = ratio * 100; |
||||
print("Download progress (" .. percent .. "%/100%)") |
||||
end |
||||
|
||||
function download(url, file) |
||||
print("Downloading file " .. file) |
||||
local res = http.download(url, file, http.progress) |
||||
|
||||
if res == nil then |
||||
error("Error downloading file " .. file) |
||||
end |
||||
end |
||||
Loading…
Reference in new issue