summaryrefslogtreecommitdiff
path: root/xmake/includes/xpack/xmake.lua
blob: f7198600de888c669518fc432ea634629bc72d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
--!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-present, TBOOX Open Source Group.
--
-- @author      ruki
-- @file        xmake.lua
--

-- Define xpack interfaces to generate installation package. e.g. nsis, deb, rpm, ...
--
-- And we can call `xmake pack` plugin to pack them.
--
-- @see https://github.com/xmake-io/xmake/issues/1433
--

-- define apis
local apis = {
    values = {
        -- set package version,  we will also get it from project/target
        "xpack.set_version",
        -- set pacakge homepage url
        "xpack.set_homepage",
        -- set package description
        "xpack.set_description",
        -- set package copyright
        "xpack.set_copyright",
        -- set company name
        "xpack.set_company",
        -- set package formats, e.g. nsis, deb, rpm, targz, zip, runself, ...
        "xpack.set_formats",
        -- set the base name of the output file
        "xpack.set_basename",
        -- add targets to be packaged
        "xpack.add_targets",
        -- set installed binary directory, e.g. bin
        "xpack.set_bindir",
        -- set installed library directory, e.g. lib
        "xpack.set_libdir",
        -- set installed include directory, e.g. include
        "xpack.set_includedir"
    },
    paths = {
        -- set the spec file path, support the custom variable pattern, e.g. set_specfile("", {pattern = "%${([^\n]-)}"})
        "xpack.set_specfile",
        -- set icon file path, e.g foo.ico
        "xpack.set_iconfile",
        -- set package license file, we will also get them from target
        "xpack.set_licensefile",
        -- add install files, we will also get them from target
        "xpack.add_installfiles"
    },
    script = {
        -- add custom load script
        "xpack.on_load",
        -- add custom package script before packing package
        "xpack.before_package",
        -- rewrite custom package script
        "xpack.on_package",
        -- add custom package script after packing package
        "xpack.after_package",
        -- add custom commands script before installing
        "xpack.before_installcmd",
        -- add custom commands script before uninstalling
        "xpack.before_uninstallcmd",
        -- rewrite custom install commands script, we will also get it from target/rules
        "xpack.on_installcmd",
        -- rewrite custom uninstall commands script, we will also get it from target/rules
        "xpack.on_uninstallcmd",
        -- add custom commands script after installing
        "xpack.after_installcmd",
        -- add custom commands script after uninstalling
        "xpack.after_uninstallcmd"
    },
    keyvalues = {
        -- set the spec variable
        "xpack.set_specvar",
        -- add nsis sections, e.g.
        -- add NSIS install commands that will be added to the end of the install Section, e.g.
        --[[
            add_nsis_installcmds("Enable Long Path",
                'WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1',
                {description = "Increases the maximum path length limit, up to 32,767 characters (before 256)."})
        --]]
        "xpack.add_nsis_installcmds"
    }
}
interp_add_scopeapis(apis)