Improve packages

This commit is contained in:
Jérôme Leclercq 2021-07-29 18:08:07 +02:00
parent 8397fd257b
commit 800028a21f
6 changed files with 106 additions and 7 deletions

View File

@ -0,0 +1,19 @@
diff --git a/CPP/7zip/Common/OffsetStream.cpp b/CPP/7zip/Common/OffsetStream.cpp
index b3e710f..b16124c 100644
--- a/CPP/7zip/Common/OffsetStream.cpp
+++ b/CPP/7zip/Common/OffsetStream.cpp
@@ -20,13 +20,13 @@ STDMETHODIMP COffsetOutStream::Write(const void *data, UInt32 size, UInt32 *proc
STDMETHODIMP COffsetOutStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
{
- UInt64 absoluteNewPosition;
if (seekOrigin == STREAM_SEEK_SET)
{
if (offset < 0)
return HRESULT_WIN32_ERROR_NEGATIVE_SEEK;
offset += _offset;
}
+ UInt64 absoluteNewPosition = 0; // =0 for gcc-10
HRESULT result = _stream->Seek(offset, seekOrigin, &absoluteNewPosition);
if (newPosition)
*newPosition = absoluteNewPosition - _offset;

View File

@ -0,0 +1,57 @@
package("7z")
set_kind("binary")
set_homepage("https://www.7-zip.org/")
set_description("A file archiver with a high compression ratio.")
if is_host("windows") then
if is_arch("x64", "x86_64") then
set_urls("https://github.com/xmake-mirror/7zip/releases/download/$(version)/7z$(version)-x64.zip",
"https://gitlab.com/xmake-mirror/7zip-releases/raw/master/7z$(version)-x64.zip")
add_versions("19.00", "fc21cf510d70a69bfa8e5b0449fe0a054fb76e2f8bd568364821f319c8b1d86d")
add_versions("18.05", "e6e2d21e2c482f1b1c5a6d21ed80800ce1273b902cf4b9afa68621545540ee2f")
else
set_urls("https://github.com/xmake-mirror/7zip/releases/download/$(version)/7z$(version)-x86.zip",
"https://gitlab.com/xmake-mirror/7zip-releases/raw/master/7z$(version)-x86.zip")
add_versions("19.00", "f84fab081a2d8a6b5868a2eaf01cd56017363fb24560259cea80567f8062334f")
add_versions("18.05", "544c37bebee30437aba405071484e0ac6310332b4bdabe4ca7420a800d4b4b5e")
end
else
set_urls("https://github.com/xmake-mirror/7zip/archive/refs/tags/$(version).tar.gz",
"https://github.com/xmake-mirror/7zip.git")
add_versions("21.02", "b2a4c5bec8207508b26f94507f62f5a79c57ae9ab77dbf393f3b2fc8eef2e382")
add_patches("21.02", path.join(os.scriptdir(), "patches", "21.02", "backport-21.03-fix-for-GCC-10.patch"), "f1d8fa0bbb25123b28e9b2842da07604238b77e51b918260a369f97c2f694c89")
end
on_install("macosx", "linux", function (package)
-- Clang has some indentation warnings that fails compilation using -Werror, remove it
io.replace("CPP/7zip/7zip_gcc.mak", "CFLAGS_WARN_WALL = -Wall -Werror -Wextra", "CFLAGS_WARN_WALL = -Wall -Wextra", {plain = true})
os.cd("CPP/7zip/Bundles/Alone2")
os.vrun("make -j -f makefile.gcc")
local bin = package:installdir("bin")
os.cp("_o/7zz", bin)
os.ln(bin .. "/7zz", bin .. "/7z")
end)
on_install("windows", function (package)
os.cp("*", package:installdir("bin"))
--[[
Build code for windows
local archdir = package:is_arch("x64", "x86_64") and "x64" or "x86"
os.cd("CPP/7zip/Bundles/Alone2")
local configs = {"-f", "makefile"}
table.insert(configs, "PLATFORM=" .. archdir)
import("package.tools.nmake").build(package, configs)
local bin = package:installdir("bin")
os.cp(archdir .. "/7zz.exe", bin .. "/7z.exe")
]]
end)
on_test(function (package)
os.vrun("7z --help")
end)

View File

@ -28,6 +28,7 @@ package("nodeeditor")
if qt then
table.insert(configs, "-DQt5_DIR=" .. path.join(qt.libdir, "cmake", "Qt5"))
end
import("package.tools.cmake").install(package, configs)
end)
@ -37,5 +38,5 @@ package("nodeeditor")
QtNodes::FlowScene scene(std::make_shared<QtNodes::DataModelRegistry>());
QtNodes::FlowView view(&scene);
}
]]}, {configs = {languages = "c++11"}, includes = {"nodes/FlowScene", "nodes/FlowView"}}))
]]}, {configs = {languages = "c++14", cxflags = not package:is_plat("windows") and "-fPIC" or nil}, includes = {"nodes/FlowScene", "nodes/FlowView"}}))
end)

View File

@ -11,6 +11,8 @@ package("qt5base")
local qt = find_qt()
if qt then
package:data_set("qtdir", qt)
else]]
package:add("deps", "python >=3.6", "7z")
end
end)
@ -25,11 +27,32 @@ package("qt5base")
}
end)
-- TODO: on_install using aqtinstall
on_install(function (package)
os.vrunv("python", {"-m", "pip", "install", "-U", "pip"})
os.vrunv("python", {"-m", "pip", "install", "aqtinstall"})
local installdir = package:installdir()
local version = "5.15.2"
local host = package:is_plat("windows") and "windows" or "linux"
local target = "desktop"
local arch = package:is_plat("windows") and "win64_msvc2019_64" or nil
print("LD_LIBRARY_PATH", os.getenv("LD_LIBRARY_PATH"))
os.vrunv("python", {"-m", "aqt", "install", "--outputdir", installdir, version, host, target, arch})
-- move files to root
local installeddir = path.join(installdir, version, package:is_plat("windows") and "msvc2019_64" or "gcc_64", "*")
os.mv(installeddir, installdir)
package:data_set("qtdir", {
bindir = path.join(installdir, "bin"),
includedir = path.join(installdir, "include"),
libdir = path.join(installdir, "lib")
})
end)
on_test(function (package)
local qt = package:data("qtdir")
os.vrun(path.join(qt.bindir, "moc", " -v"))
os.vrun(path.join(qt.bindir, "rcc", " -v"))
os.vrun(path.join(qt.bindir, "uic", " -v"))
os.vrun(path.join(qt.bindir, "moc") .. " -v")
os.vrun(path.join(qt.bindir, "rcc") .. " -v")
os.vrun(path.join(qt.bindir, "uic") .. " -v")
end)

View File

@ -4,7 +4,7 @@ package("qt5core")
set_description("Qt is the faster, smarter way to create innovative devices, modern UIs & applications for multiple screens. Cross-platform software development at its best.")
set_license("LGPL-3")
add_deps("qt5base", {public=true})
add_deps("qt5base")
on_fetch(function (package)
local base = package:dep("qt5base")

View File

@ -9,7 +9,6 @@ package("qt5widgets")
on_fetch(function (package)
local base = package:dep("qt5base")
local qt = base:data("qtdir")
print(qt)
return {
links = table.wrap("Qt5Widgets" .. (package:is_debug() and "d" or "")),