xmake.lua 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("uasm")
  2. set_kind("binary")
  3. set_homepage("http://www.terraspace.co.uk/uasm.html")
  4. set_description("UASM - Macro Assembler")
  5. add_urls("https://github.com/Terraspace/UASM/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/Terraspace/UASM.git")
  7. add_versions("v2.57r", "09fa69445f2af47551e82819d024e6b4b629fcfd47af4a22ccffbf37714230e5")
  8. if not is_plat("windows") then
  9. add_patches("v2.57r", "patches/fix-bool.diff", "91a6b4634fab3fb3991a372c845247bd895ea3d2de104d3687eb6e2c61e44e39")
  10. add_patches("v2.57r", "patches/fix-build.diff", "840a36bf7200941cd98331245a5b7b71f9ee56a912b4c10c255498c6f7c89d45")
  11. add_patches("v2.57r", "patches/fix-esc-seq.diff", "4011194c59f87b5be798b4e85dca869e3a3f7ddf2b0fc4f8b3b26190df1abca3")
  12. add_patches("v2.57r", "patches/uint64-fix.diff", "ea6bab7192894fc673b55b9ead67cf1eb0046cd34c425f33781e167097988662")
  13. end
  14. on_install("macosx", function (package)
  15. os.cp(path.join(package:scriptdir(), "ports", "osx64.mak"), "osx64.mak")
  16. local configs = { "-f", "osx64.mak", "CC=clang"}
  17. import("package.tools.make").install(package, configs)
  18. os.cp("GccUnixR/uasm", path.join(package:installdir("bin"), "uasm"))
  19. end)
  20. on_install("msys", "mingw@macosx,linux,windows,msys", function (package)
  21. local configs = { "-f", "Makefile-DOS-GCC.mak", "CC=gcc -c -IH -std=gnu11 -funsigned-char -fcommon -Wno-implicit-function-declaration -Wno-incompatible-pointer-types"}
  22. import("package.tools.make").install(package, configs)
  23. os.cp("*/hjwasm.exe", path.join(package:installdir("bin"), "uasm.exe"))
  24. end)
  25. on_install("@windows", function (package)
  26. import("package.tools.msbuild")
  27. local arch = package:is_arch("x64") and "x64" or "Win32"
  28. if package:is_arch("arm64") then
  29. arch = "ARM64"
  30. io.replace("UASM.sln", "|x64", "|ARM64", {plain = true})
  31. end
  32. local mode = package:is_debug() and "Debug" or "Release"
  33. local configs = { "UASM.sln" }
  34. table.insert(configs, "/p:Configuration=" .. mode)
  35. table.insert(configs, "/p:Platform=" .. arch)
  36. if package:is_arch("arm64") then
  37. io.replace("UASM.vcxproj", "|x64", "|ARM64", {plain = true})
  38. io.replace("UASM.vcxproj", "<Platform>x64", "<Platform>ARM64", {plain = true})
  39. end
  40. if package:has_runtime("MT", "MTd") then
  41. -- Allow MT, MTd
  42. io.replace("UASM.vcxproj", "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", {plain = true})
  43. io.replace("UASM.vcxproj", "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>", "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", {plain = true})
  44. end
  45. io.replace("UASM.vcxproj", [[<Command>regress\runtestsVS.cmd</Command>]], [[]], {plain = true})
  46. msbuild.build(package, configs)
  47. os.cp("*/*/UASM.exe", path.join(package:installdir("bin"), "uasm.exe"))
  48. end)
  49. on_test(function (package)
  50. os.vrun("uasm -h")
  51. end)