summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-28 22:52:38 +0800
committerruki <[email protected]>2018-09-28 11:15:48 +0800
commit619eda909993a3ed64816b53b860a9c559a77fed (patch)
tree3a313eac9f5459eefc4583d5b2b7100fde6c9912
parent27cf709dda7b6626822534a7e2d18b41cf315c4f (diff)
remove build scripts for package
-rw-r--r--xmake/actions/require/action/build.lua55
-rw-r--r--xmake/actions/require/action/filter.lua1
-rw-r--r--xmake/actions/require/action/install.lua4
-rw-r--r--xmake/actions/require/action/test.lua2
-rw-r--r--xmake/core/package/package.lua14
-rw-r--r--xmake/modules/package/tools/autoconf.lua (renamed from xmake/modules/package/builder/autoconf.lua)8
-rw-r--r--xmake/modules/package/tools/cmake.lua (renamed from xmake/modules/package/builder/cmake.lua)18
-rw-r--r--xmake/modules/package/tools/xmake.lua (renamed from xmake/modules/package/builder/xmake.lua)8
-rw-r--r--xmake/repository/packages/a/autoconf/xmake.lua6
-rw-r--r--xmake/repository/packages/a/automake/xmake.lua6
-rw-r--r--xmake/repository/packages/c/cmake/xmake.lua3
-rw-r--r--xmake/repository/packages/g/git/xmake.lua3
-rw-r--r--xmake/repository/packages/l/libtool/xmake.lua6
13 files changed, 16 insertions, 118 deletions
diff --git a/xmake/actions/require/action/build.lua b/xmake/actions/require/action/build.lua
deleted file mode 100644
index 878e7f10f..000000000
--- a/xmake/actions/require/action/build.lua
+++ /dev/null
@@ -1,55 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2018, TBOOX Open Source Group.
---
--- @author ruki
--- @file build.lua
---
-
--- imports
-import("core.base.option")
-import("core.project.config")
-import("core.sandbox.sandbox")
-import("filter")
-
--- build the given package
-function main(package)
-
- -- the package scripts
- local scripts =
- {
- package:script("build_before")
- , package:script("build")
- , package:script("build_after")
- }
-
- -- save the current directory
- local oldir = os.curdir()
-
- -- build it
- for i = 1, 3 do
- local script = scripts[i]
- if script ~= nil then
- filter.call(script, package)
- end
- end
-
- -- restore the current directory
- os.cd(oldir)
-end
diff --git a/xmake/actions/require/action/filter.lua b/xmake/actions/require/action/filter.lua
index 0955e8f8d..209c703ba 100644
--- a/xmake/actions/require/action/filter.lua
+++ b/xmake/actions/require/action/filter.lua
@@ -93,7 +93,6 @@ function _handler(package, strval)
end
return package:version_str()
end
- , buildir = function () return package:buildir() end
}
-- get value
diff --git a/xmake/actions/require/action/install.lua b/xmake/actions/require/action/install.lua
index dd63e82ad..ea60d9cd9 100644
--- a/xmake/actions/require/action/install.lua
+++ b/xmake/actions/require/action/install.lua
@@ -25,7 +25,6 @@
-- imports
import("core.base.option")
import("core.project.target")
-import("build")
import("test")
import("filter")
@@ -174,9 +173,6 @@ function main(package)
-- clean the install directory first
os.tryrm(package:installdir())
- -- build it
- build(package)
-
-- install it
for i = 1, 3 do
local script = scripts[i]
diff --git a/xmake/actions/require/action/test.lua b/xmake/actions/require/action/test.lua
index 5c9cf4afd..5b8b40aee 100644
--- a/xmake/actions/require/action/test.lua
+++ b/xmake/actions/require/action/test.lua
@@ -40,7 +40,7 @@ function main(package)
-- save the current directory
local oldir = os.curdir()
- -- build it
+ -- test it
for i = 1, 3 do
local script = scripts[i]
if script ~= nil then
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index b779a1e83..5d3ee15e0 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -186,11 +186,6 @@ function _instance:kind()
return self:get("kind")
end
--- get the build directory of this package
-function _instance:buildir()
- return path.join(self:cachedir(), "build")
-end
-
-- get the cached directory of this package
function _instance:cachedir()
return path.join(package.cachedir(), self:name():sub(1, 1):lower(), self:name(), self:version_str())
@@ -402,8 +397,8 @@ end
-- is supported package?
function _instance:supported()
- -- attempt to get the build script with the current plat/arch
- return self:script("build") ~= nil
+ -- attempt to get the install script with the current plat/arch
+ return self:script("install") ~= nil
end
-- get xxx_script
@@ -587,17 +582,14 @@ function package.apis()
, script =
{
-- package.on_xxx
- "package.on_build"
- , "package.on_install"
+ "package.on_install"
, "package.on_test"
-- package.before_xxx
- , "package.before_build"
, "package.before_install"
, "package.before_test"
-- package.before_xxx
- , "package.after_build"
, "package.after_install"
, "package.after_test"
}
diff --git a/xmake/modules/package/builder/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 28b9c2187..7a20d0664 100644
--- a/xmake/modules/package/builder/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -22,8 +22,8 @@
-- @file autoconf.lua
--
--- build package
-function build(package, configs)
+-- install package
+function install(package, configs)
-- generate configure file
if not os.isfile("configure") and os.isfile("configure.ac") then
@@ -50,10 +50,6 @@ function build(package, configs)
end
os.vrunv("./configure", argv)
os.vrun("make -j4")
-end
-
--- install package
-function install(package)
os.vrun("make install")
end
diff --git a/xmake/modules/package/builder/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 3897e72e2..ae1ecee16 100644
--- a/xmake/modules/package/builder/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -26,26 +26,18 @@
import("core.base.option")
import("lib.detect.find_file")
--- build package
-function build(package, configs)
+-- install package
+function install(package, configs)
os.mkdir("build/install")
os.cd("build")
os.vrun("cmake -a $(arch) -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
if is_host("windows") then
local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!")
- os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, is_mode("debug") and "Debug" or "Release", is_arch("x64") and "x64" or "Win32")
- else
- os.vrun("make")
- end
-end
-
--- install package
-function install(package)
- os.cd("build")
- if is_host("windows") then
+ os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, package:debug() and "Debug" or "Release", is_arch("x64") and "x64" or "Win32")
local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj"
- os.vrun("msbuild \"%s\" /property:configuration=%s", projfile, is_mode("debug") and "Debug" or "Release")
+ os.vrun("msbuild \"%s\" /property:configuration=%s", projfile, package:debug() and "Debug" or "Release")
else
+ os.vrun("make -j4")
os.vrun("make install")
end
os.cp("install/lib", package:installdir())
diff --git a/xmake/modules/package/builder/xmake.lua b/xmake/modules/package/tools/xmake.lua
index cc97cac91..300b3f5e1 100644
--- a/xmake/modules/package/builder/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -25,8 +25,8 @@
-- imports
import("core.base.option")
--- build package
-function build(package, configs)
+-- install package
+function install(package, configs)
-- inherit builtin configs
local argv = {"f", "-y"}
@@ -52,9 +52,5 @@ function build(package, configs)
end
os.vrunv("xmake", argv)
os.vrun("xmake" .. (option.get("verbose") and " -v" or ""))
-end
-
--- install package
-function install(package)
os.vrunv("xmake", {"install", "-o", package:installdir()})
end
diff --git a/xmake/repository/packages/a/autoconf/xmake.lua b/xmake/repository/packages/a/autoconf/xmake.lua
index 0a9ee6cfc..eb571f93a 100644
--- a/xmake/repository/packages/a/autoconf/xmake.lua
+++ b/xmake/repository/packages/a/autoconf/xmake.lua
@@ -12,12 +12,8 @@ package("autoconf")
add_versions("2.68", "eff70a2916f2e2b3ed7fe8a2d7e63d72cf3a23684b56456b319c3ebce0705d99")
end
- on_build("macosx", "linux", function (package)
- import("package.builder.autoconf").build(package)
- end)
-
on_install("macosx", "linux", function (package)
- import("package.builder.autoconf").install(package)
+ import("package.tools.autoconf").install(package)
end)
on_test(function (package)
diff --git a/xmake/repository/packages/a/automake/xmake.lua b/xmake/repository/packages/a/automake/xmake.lua
index b16837cc9..8db2e4527 100644
--- a/xmake/repository/packages/a/automake/xmake.lua
+++ b/xmake/repository/packages/a/automake/xmake.lua
@@ -13,12 +13,8 @@ package("automake")
add_versions("1.9.5", "68712753fcb756f3707b7da554917afb348450eb8530cae3b623a067078596fd")
end
- on_build("macosx", "linux", function (package)
- import("package.builder.autoconf").build(package)
- end)
-
on_install("macosx", "linux", function (package)
- import("package.builder.autoconf").install(package)
+ import("package.tools.autoconf").install(package)
end)
on_test(function (package)
diff --git a/xmake/repository/packages/c/cmake/xmake.lua b/xmake/repository/packages/c/cmake/xmake.lua
index 4e17cc453..e0994cf52 100644
--- a/xmake/repository/packages/c/cmake/xmake.lua
+++ b/xmake/repository/packages/c/cmake/xmake.lua
@@ -20,9 +20,6 @@ package("cmake")
end
end
- on_build(function (package)
- end)
-
on_install("macosx", function (package)
os.cp("CMake.app/Contents/bin", package:installdir())
os.cp("CMake.app/Contents/share", package:installdir())
diff --git a/xmake/repository/packages/g/git/xmake.lua b/xmake/repository/packages/g/git/xmake.lua
index a734ed7a1..0076dd64e 100644
--- a/xmake/repository/packages/g/git/xmake.lua
+++ b/xmake/repository/packages/g/git/xmake.lua
@@ -18,9 +18,6 @@ package("git")
end
end
- on_build(function (package)
- end)
-
on_install("macosx", "linux", function (package)
import("package.manager.install")("git")
end)
diff --git a/xmake/repository/packages/l/libtool/xmake.lua b/xmake/repository/packages/l/libtool/xmake.lua
index 155ff8320..0fb676f98 100644
--- a/xmake/repository/packages/l/libtool/xmake.lua
+++ b/xmake/repository/packages/l/libtool/xmake.lua
@@ -12,12 +12,8 @@ package("libtool")
add_versions("2.4.5", "509cb49c7de14ce7eaf88993cf09fd4071882699dfd874c2e95b31ab107d6987")
end
- on_build("macosx", "linux", function (package)
- import("package.builder.autoconf").build(package)
- end)
-
on_install("macosx", "linux", function (package)
- import("package.builder.autoconf").install(package)
+ import("package.tools.autoconf").install(package)
end)
on_test(function (package)