-
-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* igraph: add package * test linux with bundle deps * limit plat * fix grammar error * bison: fix msys install * disable ccache * force to use ninja * fix cmake find libxml2 on windows * patch bison codegen header missing * fix patch checksum (crlf -> lf) * use custom tarball (not need flex/bison) * support cross-compilation * test mingw cross-compilation * Revert "test mingw cross-compilation" This reverts commit 961a953.
- Loading branch information
1 parent
bf79554
commit 95aa0e9
Showing
5 changed files
with
150 additions
and
0 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
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,12 @@ | ||
/* Suitable for macOS on x86_64 and arm64 */ | ||
/* Not suitable for 32-bit macOS */ | ||
|
||
#define IEEE_8087 | ||
#define Arith_Kind_ASL 1 | ||
#define Long int | ||
#define Intcast (int)(long) | ||
#define Double_Align | ||
#define X64_bit_pointers | ||
#define NANCHECK | ||
#define QNaN0 0x0 | ||
#define QNaN1 0x7ff80000 |
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,8 @@ | ||
/* Windows 32-bit */ | ||
|
||
#define IEEE_8087 | ||
#define Arith_Kind_ASL 1 | ||
#define Double_Align | ||
#define NANCHECK | ||
#define QNaN0 0x0 | ||
#define QNaN1 0x7ff80000 |
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,8 @@ | ||
/* Windows 32-bit */ | ||
|
||
#define IEEE_8087 | ||
#define Arith_Kind_ASL 1 | ||
#define Double_Align | ||
#define NANCHECK | ||
#define QNaN0 0x0 | ||
#define QNaN1 0x7ff80000 |
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,120 @@ | ||
package("igraph") | ||
set_homepage("https://igraph.org") | ||
set_description("Library for the analysis of networks") | ||
set_license("GPL-2.0") | ||
|
||
add_urls("https://github.com/igraph/igraph/releases/download/$(version)/igraph-$(version).tar.gz", | ||
"https://github.com/igraph/igraph.git") | ||
|
||
add_versions("0.10.15", "03ba01db0544c4e32e51ab66f2356a034394533f61b4e14d769b9bbf5ad5e52c") | ||
|
||
add_configs("glpk", {description = "Compile igraph with GLPK support", default = false, type = "boolean"}) | ||
add_configs("graphml", {description = "Compile igraph with GraphML support", default = false, type = "boolean"}) | ||
add_configs("openmp", {description = "Use OpenMP for parallelization", default = false, type = "boolean"}) | ||
if is_plat("wasm") then | ||
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) | ||
end | ||
|
||
if is_plat("linux", "bsd") then | ||
add_syslinks("pthread") | ||
end | ||
|
||
add_deps("cmake") | ||
add_deps("plfit") | ||
|
||
on_check(function (package) | ||
if package:is_cross() then | ||
if not package:is_plat("windows", "macosx") then | ||
raise("package(igraph) unsupported cross-compilation now. To support it, see https://igraph.org/c/html/latest/igraph-Installation.html#igraph-Installation-cross-compiling") | ||
end | ||
end | ||
end) | ||
|
||
on_load(function (package) | ||
if package:gitref() then | ||
wprint("If build failed with flex/bison, please see https://github.com/igraph/igraph/issues/2713") | ||
package:add("deps", "flex", "bison", {kind = "binary"}) | ||
end | ||
|
||
-- TODO: unbundle deps gmp, arpack, blas, lapack | ||
-- https://igraph.org/c/html/latest/igraph-Installation.html#igraph-Installation-prerequisites | ||
if package:is_plat("linux", "macosx") then | ||
package:add("deps", "gmp") | ||
end | ||
|
||
if package:config("glpk") then | ||
package:add("deps", "glpk") | ||
end | ||
if package:config("graphml") then | ||
package:add("deps", "libxml2") | ||
end | ||
if package:config("openmp") then | ||
package:add("deps", "openmp") | ||
end | ||
|
||
if not package:config("shared") then | ||
package:add("defines", "IGRAPH_STATIC") | ||
end | ||
end) | ||
|
||
on_install("!cross and !bsd", function (package) | ||
-- Disable test/doc/cpack | ||
io.replace("CMakeLists.txt", "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME", "0", {plain = true}) | ||
if package:config("graphml") then | ||
io.replace("etc/cmake/dependencies.cmake", "find_package(LibXml2 ${LIBXML2_VERSION_MIN} QUIET)", "find_package(LibXml2 CONFIG REQUIRED)", {plain = true}) | ||
end | ||
if package:gitref() then | ||
io.writefile("IGRAPH_VERSION", package:version_str()) | ||
end | ||
|
||
-- https://igraph.org/c/html/latest/igraph-Installation.html | ||
local configs = { | ||
"-DUSE_CCACHE=OFF", | ||
"-DIGRAPH_WARNINGS_AS_ERRORS=OFF", | ||
-- "-DIGRAPH_USE_INTERNAL_GMP=OFF", | ||
-- "-DIGRAPH_USE_INTERNAL_ARPACK=OFF", | ||
-- "-DIGRAPH_USE_INTERNAL_BLAS=OFF", | ||
-- "-DIGRAPH_USE_INTERNAL_LAPACK=OFF", | ||
"-DIGRAPH_USE_INTERNAL_GLPK=OFF", | ||
"-DIGRAPH_USE_INTERNAL_PLFIT=OFF", | ||
} | ||
if package:is_plat("linux", "macosx") then | ||
table.insert(configs, "-DIGRAPH_USE_INTERNAL_GMP=OFF") | ||
end | ||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) | ||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) | ||
table.insert(configs, "-DIGRAPH_ENABLE_LTO=" .. (package:config("lto") and "ON" or "OFF")) | ||
|
||
table.insert(configs, "-DIGRAPH_GLPK_SUPPORT=" .. (package:config("glpk") and "ON" or "OFF")) | ||
table.insert(configs, "-DIGRAPH_OPENMP_SUPPORT=" .. (package:config("openmp") and "ON" or "OFF")) | ||
-- AUTO -> find_package, ON -> find_dependency (unavailable) | ||
table.insert(configs, "-DIGRAPH_GRAPHML_SUPPORT=" .. (package:config("graphml") and "AUTO" or "OFF")) | ||
if package:is_cross() then | ||
-- from https://github.com/microsoft/vcpkg/tree/0857a4b08c14030bbe41e80accb2b1fddb047a74/ports/igraph | ||
local header | ||
if package:is_plat("macosx") then | ||
header = "arith_osx.h" | ||
elseif package:is_plat("windows") then | ||
if package:is_arch64() then | ||
header = "arith_win64.h" | ||
else | ||
header = "arith_win32.h" | ||
end | ||
end | ||
|
||
if header then | ||
local header_path = path.unix(path.join(os.scriptdir(), header)) | ||
table.insert(configs, "-DF2C_EXTERNAL_ARITH_HEADER=" .. header_path) | ||
end | ||
end | ||
|
||
local opt = {} | ||
if package:config("glpk") then | ||
opt.packagedeps = "zlib" | ||
end | ||
import("package.tools.cmake").install(package, configs, opt) | ||
end) | ||
|
||
on_test(function (package) | ||
assert(package:has_cfuncs("igraph_rng_seed", {includes = "igraph/igraph.h"})) | ||
end) |