diff --git a/.gitignore b/.gitignore index 5d6c166cf..e9d46b1e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.dylib +*.dll *.so *.orig tmp/ diff --git a/deps/Makefile b/deps/Makefile deleted file mode 100644 index 48f7f159a..000000000 --- a/deps/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -CC=gcc -JL_SHARE = $(shell julia -e 'print(joinpath(JULIA_HOME,Base.DATAROOTDIR,"julia"))') -CFLAGS += $(shell julia $(JL_SHARE)/julia-config.jl --cflags) -CXXFLAGS += $(shell julia $(JL_SHARE)/julia-config.jl --cflags) -LDFLAGS += $(shell julia $(JL_SHARE)/julia-config.jl --ldflags) -LDLIBS += $(shell julia $(JL_SHARE)/julia-config.jl --ldlibs) - -CFLAGS += $(shell julia -e 'print("-std=gnu99 ")') -CFLAGS += $(shell julia -e 'if is_windows() && Int == Int32 print("-march=pentium4 ") end') - -task: task.c - $(CC) $(CFLAGS) -O2 -shared -fPIC task.c $(LDFLAGS) $(LDLIBS) -o libtask.$(LIBEXT) - -platform=$(shell uname) -ifeq ($(platform),Linux) - LIBEXT=so -else ifeq ($(platform),Darwin) - LIBEXT=dylib -else - LIBEXT=dll -endif - -clean: - -rm libtask.$(LIBEXT) - -.PHONY: \ - task - diff --git a/deps/build.jl b/deps/build.jl index 421cf4f6f..31cc784d4 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,3 +1,41 @@ -if is_unix() run(`make`) end -if is_windows() run(`mingw32-make`) end +using BinaryProvider # requires BinaryProvider 0.3.0 or later +# Parse some basic command-line arguments +const verbose = "--verbose" in ARGS +const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) +products = [ + LibraryProduct(prefix, String["libtask"], :libtask), +] + +# Download binaries from hosted location +bin_prefix = "https://github.com/hessammehr/LibtaskBuilder2/releases/download/0.1.12" + +# Listing of files generated by BinaryBuilder: +download_info = Dict( + BinaryProvider.Linux(:aarch64, :glibc, :blank_abi) => ("$bin_prefix/libtask.aarch64-linux-gnu.tar.gz", "d2ccc114b3ab606493a8a270e2844b05a52115461370fdc6e668e6b310f5e7a3"), + BinaryProvider.Linux(:armv7l, :glibc, :eabihf) => ("$bin_prefix/libtask.arm-linux-gnueabihf.tar.gz", "0e1545529a87115a33f9c5b2cdf51e116dfa1016657d6bd877ac6e987a50cdef"), + BinaryProvider.Linux(:i686, :glibc, :blank_abi) => ("$bin_prefix/libtask.i686-linux-gnu.tar.gz", "620b606954f526ba0bdc20786c65e0095e0df8d26c2e906cd0e04319a2c8a3b2"), + BinaryProvider.Windows(:i686, :blank_libc, :blank_abi) => ("$bin_prefix/libtask.i686-w64-mingw32.tar.gz", "7595ecc2d5f2fc0be18f69d07a4c0d4a2e7f1bceb5495a333c5b3c5853f0b7a9"), + BinaryProvider.Linux(:powerpc64le, :glibc, :blank_abi) => ("$bin_prefix/libtask.powerpc64le-linux-gnu.tar.gz", "cb269617e977a8a576c18fa40e31a0080a1d9b365dd2330746345cfedb3f81a3"), + BinaryProvider.MacOS(:x86_64, :blank_libc, :blank_abi) => ("$bin_prefix/libtask.x86_64-apple-darwin14.tar.gz", "bbc4d6b2d4ddc83dd842d633da36faaeb459163af1461e4fe2237821c3f8dbdd"), + BinaryProvider.Linux(:x86_64, :glibc, :blank_abi) => ("$bin_prefix/libtask.x86_64-linux-gnu.tar.gz", "e044bace4fbc88844af3a7eb2346b8824aa4d1c5853977c0a35e54296d8a9389"), + BinaryProvider.Windows(:x86_64, :blank_libc, :blank_abi) => ("$bin_prefix/libtask.x86_64-w64-mingw32.tar.gz", "2158e66eff878641f7a39cdbf20b9b41a007f1dc2242bb3655dccb2e2ac65830"), +) + +# Install unsatisfied or updated dependencies: +unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) +if haskey(download_info, platform_key()) + url, tarball_hash = download_info[platform_key()] + if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix) + # Download and install binaries + install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose) + end +elseif unsatisfied + # If we don't have a BinaryProvider-compatible .tar.gz to download, complain. + # Alternatively, you could attempt to install from a separate provider, + # build from source or something more even more ambitious here. + error("Your platform $(triplet(platform_key())) is not supported by this package!") +end + +# Write out a deps.jl file that will contain mappings for our products +write_deps_file(joinpath(@__DIR__, "deps.jl"), products) diff --git a/src/trace/taskcopy.jl b/src/trace/taskcopy.jl index 9d503962c..61a51a72d 100644 --- a/src/trace/taskcopy.jl +++ b/src/trace/taskcopy.jl @@ -1,5 +1,6 @@ -if is_unix() libpath = replace(@__FILE__, "src/trace/taskcopy.jl", "deps/") end -if is_windows() libpath = replace(@__FILE__, "src\\trace\\taskcopy.jl", "deps\\") end +include("../../deps/deps.jl") +check_deps() +libpath = dirname(libtask) if !(libpath in Base.DL_LOAD_PATH) push!(Base.DL_LOAD_PATH, libpath)