diff options
| author | ruki <[email protected]> | 2020-04-04 21:11:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-04 21:11:06 +0800 |
| commit | d656204be63f729a9e7b60f509af1fc3450726cc (patch) | |
| tree | 165c71c6a202a2d43c590cf16959449968e10f47 /xmake/modules/private/tools/codesign.lua | |
| parent | 82c4738ba1f8c7839d272b5e9d7e818efa97bdbf (diff) | |
add codesign
Diffstat (limited to 'xmake/modules/private/tools/codesign.lua')
| -rw-r--r-- | xmake/modules/private/tools/codesign.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/xmake/modules/private/tools/codesign.lua b/xmake/modules/private/tools/codesign.lua new file mode 100644 index 000000000..b9b7f05a0 --- /dev/null +++ b/xmake/modules/private/tools/codesign.lua @@ -0,0 +1,47 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed 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-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file codesign.lua +-- + +-- imports +import("lib.detect.find_tool") + +-- main entry +function main (programdir) + + -- get codesign + local codesign = find_tool("codesign") + if not codesign then + return + end + + -- get codesign_allocate + local codesign_allocate + local xcode_sdkdir = get_config("xcode") + if xcode_sdkdir then + codesign_allocate = path.join(xcode_sdkdir, "Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate") + end + + -- do sign + local argv = {"--force", "--timestamp=none"} + table.insert(argv, "--sign") + table.insert(argv, "-") + table.insert(argv, programdir) + os.vrunv(codesign.program, argv, {envs = {CODESIGN_ALLOCATE = codesign_allocate}}) +end + |
