xmake.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("scotch")
  2. set_homepage("https://www.labri.fr/perso/pelegrin/scotch/")
  3. set_description("Scotch: a software package for graph and mesh/hypergraph partitioning, graph clustering, and sparse matrix ordering")
  4. add_urls("https://gitlab.inria.fr/scotch/scotch/-/archive/$(version)/scotch-$(version).zip",
  5. "https://gitlab.inria.fr/scotch/scotch.git")
  6. add_versions("v6.1.1", "21d001c390ec63ac60f987b9921f33cc1967b41cf07567e22cbf3253cda8962a")
  7. add_deps("zlib")
  8. if is_plat("linux") then
  9. add_syslinks("pthread")
  10. end
  11. add_links("esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis")
  12. on_install("macosx|x86_64", "linux", function (package)
  13. os.cd("src")
  14. if package:is_plat("macosx") then
  15. os.cp("Make.inc/Makefile.inc.i686_mac_darwin10", "Makefile.inc")
  16. elseif package:is_plat("linux") then
  17. local basename
  18. if package:is_arch("x86_64") then
  19. basename = "Make.inc/Makefile.inc.x86-64_pc_linux2"
  20. elseif package:is_arch("i386", "x86") then
  21. basename = "Make.inc/Makefile.inc.i686_pc_linux2"
  22. end
  23. os.cp(basename .. (package:config("shared") and ".shlib" or ""), "Makefile.inc")
  24. end
  25. io.replace("Makefile.inc", "CFLAGS%s+=", "CFLAGS := $(CFLAGS)")
  26. io.replace("Makefile.inc", "LDFLAGS%s+=", "LDFLAGS := $(LDFLAGS)")
  27. local envs = import("package.tools.make").buildenvs(package)
  28. local zlib = package:dep("zlib"):fetch()
  29. if zlib then
  30. local cflags, ldflags
  31. for _, includedir in ipairs(zlib.sysincludedirs or zlib.includedirs) do
  32. cflags = (cflags or "") .. " -I" .. includedir
  33. end
  34. for _, linkdir in ipairs(zlib.linkdirs) do
  35. ldflags = (ldflags or "") .. " -L" .. linkdir
  36. end
  37. envs.CFLAGS = cflags
  38. envs.LDFLAGS = ldflags
  39. end
  40. os.vrunv("make", {"scotch"}, {envs = envs})
  41. os.vrunv("make", {"esmumps"}, {envs = envs})
  42. os.vrunv("make", {"prefix=" .. package:installdir(), "install"}, {envs = envs})
  43. end)
  44. on_test(function (package)
  45. assert(package:has_cfuncs("SCOTCH_graphInit", {includes = {"stdio.h", "stdlib.h", "scotch.h"}}))
  46. end)