mirror of
https://github.com/gosticks/gml.git
synced 2025-10-16 12:05:33 +00:00
added debug build mode and optimized stripping
This commit is contained in:
parent
627f016994
commit
179ed60c5d
@ -43,6 +43,7 @@ func init() {
|
||||
Flags: func(f *grumble.Flags) {
|
||||
f.Bool("c", "clean", false, "clean build files first")
|
||||
f.BoolL("no-strip", false, "don't strip the final binary")
|
||||
f.BoolL("debug", false, "build a debug binary (disables strip)")
|
||||
f.String("s", "source-dir", "./", "source directorty")
|
||||
f.String("b", "build-dir", "./build", "build directorty")
|
||||
f.String("d", "dest-dir", "./", "destination directorty")
|
||||
@ -70,6 +71,7 @@ func runBuild(c *grumble.Context) error {
|
||||
c.Flags.String("dest-dir"),
|
||||
c.Flags.Bool("clean"),
|
||||
c.Flags.Bool("no-strip"),
|
||||
c.Flags.Bool("debug"),
|
||||
c.Flags.String("tags"),
|
||||
)
|
||||
}
|
||||
@ -88,6 +90,7 @@ func runBuildDocker(c *grumble.Context) error {
|
||||
c.Flags.String("dest-dir"),
|
||||
c.Flags.Bool("clean"),
|
||||
c.Flags.Bool("no-strip"),
|
||||
c.Flags.Bool("debug"),
|
||||
c.Flags.Bool("custom"),
|
||||
c.Flags.String("tags"),
|
||||
)
|
||||
|
||||
11
go.mod
11
go.mod
@ -3,12 +3,15 @@ module github.com/desertbit/gml
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/desertbit/closer/v3 v3.0.1
|
||||
github.com/desertbit/grumble v1.0.2
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/desertbit/closer v2.0.1+incompatible // indirect
|
||||
github.com/desertbit/closer/v3 v3.1.2
|
||||
github.com/desertbit/grumble v1.0.4
|
||||
github.com/fatih/color v1.9.0
|
||||
github.com/json-iterator/go v1.1.6
|
||||
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||
github.com/radovskyb/watcher v1.0.6
|
||||
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a
|
||||
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867
|
||||
)
|
||||
|
||||
51
go.sum
51
go.sum
@ -1,29 +1,56 @@
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/Netflix/go-expect v0.0.0-20190729225929-0e00d9168667/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/desertbit/closer v2.0.1+incompatible h1:vC58rDu6nwxrBvibQ/TEmtPGnfscC8n0GExFzYXsLjE=
|
||||
github.com/desertbit/closer v2.0.1+incompatible/go.mod h1:kYgYVgfyW2gRrbZ/trEqb+RPqaYczGtpIINsZD2tNbk=
|
||||
github.com/desertbit/closer/v3 v3.0.1 h1:mZORDd9VbXIgH8OrUyKrS+0sdvNwpR47JB5cgnBTc0I=
|
||||
github.com/desertbit/closer/v3 v3.0.1/go.mod h1:AAC4KRd8DC40nwvV967J/kDFhujMEiuwIKQfN0IDxXw=
|
||||
github.com/desertbit/closer/v3 v3.1.2 h1:a6+2DmwIcNygW04XXWYq+Qp2X9uIk9QbZCP9//qEkb0=
|
||||
github.com/desertbit/closer/v3 v3.1.2/go.mod h1:AAC4KRd8DC40nwvV967J/kDFhujMEiuwIKQfN0IDxXw=
|
||||
github.com/desertbit/columnize v2.1.0+incompatible h1:h55rYmdrWoTj7w9aAnCkxzM3C2Eb8zuFa2W41t0o5j0=
|
||||
github.com/desertbit/columnize v2.1.0+incompatible/go.mod h1:5kPrzQwKbQ8E5D28nvTVPqIBJyj+8jvJzwt6HXZvXgI=
|
||||
github.com/desertbit/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:Kt3BVZKcFOZ3xaI1G6EHd2eM8boRvm5qCs/AZBr9ysQ=
|
||||
github.com/desertbit/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:igZLYq+xJYskT7PXx1VyRk+3MlQ5geJnvQuO8HQlyKY=
|
||||
github.com/desertbit/grumble v1.0.2 h1:iH00G04cx+0l951VG/yCClsoK3lk3gONtOUSmH5Oq+Q=
|
||||
github.com/desertbit/grumble v1.0.2/go.mod h1:2qY276+sdXm3ApSszqN/Xkn39PbINTExygcoINU3BRI=
|
||||
github.com/desertbit/grumble v1.0.4 h1:69ueJ9xON0MJnb+Q542n94QYlQI1s1yi+7/jqm1RlcE=
|
||||
github.com/desertbit/grumble v1.0.4/go.mod h1:bKsHODfRjUHYuqN7mvpzE2N/NLmhkgXwWpGRt6rZIvE=
|
||||
github.com/desertbit/readline v0.0.0-20171208011716-f6d7a1f6fbf3 h1:PLbrJOpAtk8ros5avAt8am0GJvPuD08FVLV+ffmG0Jo=
|
||||
github.com/desertbit/readline v0.0.0-20171208011716-f6d7a1f6fbf3/go.mod h1:AayRnEOr0ttSh4kgOlHBBtJufZMMW/1BVCdV5oFs8t0=
|
||||
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
|
||||
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
|
||||
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc=
|
||||
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
@ -32,10 +59,34 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||
github.com/radovskyb/watcher v1.0.6 h1:8WIQ9UxEYMZjem1OwU7dVH94DXXk9mAIE1i8eqHD+IY=
|
||||
github.com/radovskyb/watcher v1.0.6/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a h1:Igim7XhdOpBnWPuYJ70XcNpq8q3BCACtVgNfoJxOV7g=
|
||||
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6 h1:Sy5bstxEqwwbYs6n0/pBuxKENqOeZUgD45Gp3Q3pqLg=
|
||||
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867 h1:JoRuNIf+rpHl+VhScRQQvzbHed86tKkqwPMV34T8myw=
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190802003818-e9bb7d36c060/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA=
|
||||
|
||||
@ -40,8 +40,13 @@ const (
|
||||
PostHookName = "GML_BUILD_POST_HOOKS"
|
||||
)
|
||||
|
||||
func Build(sourceDir, buildDir, destDir string, clean, noStrip bool, tags string) (err error) {
|
||||
ctx, err := newContext(sourceDir, buildDir, destDir, clean)
|
||||
func Build(sourceDir, buildDir, destDir string, clean, noStrip, debugBuild bool, tags string) (err error) {
|
||||
// Force no strip if this is a debug build.
|
||||
if debugBuild {
|
||||
noStrip = true
|
||||
}
|
||||
|
||||
ctx, err := newContext(sourceDir, buildDir, destDir, clean, debugBuild)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -76,20 +81,11 @@ func Build(sourceDir, buildDir, destDir string, clean, noStrip bool, tags string
|
||||
|
||||
// Run go build.
|
||||
utils.PrintColorln("> building Go source")
|
||||
err = buildGo(ctx, tags, clean)
|
||||
err = buildGo(ctx, tags, clean, noStrip)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Finally strip the binary.
|
||||
if !noStrip {
|
||||
utils.PrintColorln("> stripping binary")
|
||||
err = stripBinary(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Run post hooks if available.
|
||||
err = runPostHooks(ctx)
|
||||
if err != nil {
|
||||
@ -108,7 +104,7 @@ func buildCLib(ctx *Context) (err error) {
|
||||
return utils.RunCommand(ctx.Env(), ctx.BuildDir, "make")
|
||||
}
|
||||
|
||||
func buildGo(ctx *Context, tags string, clean bool) (err error) {
|
||||
func buildGo(ctx *Context, tags string, clean, noStrip bool) (err error) {
|
||||
// Delete the output binary to force relinking.
|
||||
// This is faster than building with the -a option.
|
||||
e, err := utils.Exists(ctx.OutputFile)
|
||||
@ -121,10 +117,21 @@ func buildGo(ctx *Context, tags string, clean bool) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
args := []string{"build", "-o", ctx.OutputFile}
|
||||
var (
|
||||
ldflags []string
|
||||
args = []string{"build", "-o", ctx.OutputFile}
|
||||
)
|
||||
|
||||
if clean {
|
||||
args = append(args, "-a")
|
||||
}
|
||||
if !noStrip {
|
||||
args = append(args, "-trimpath")
|
||||
ldflags = append(ldflags, "-s", "-w")
|
||||
}
|
||||
if ctx.DebugBuild {
|
||||
ldflags = append(ldflags, "-compressdwarf=false")
|
||||
}
|
||||
if utils.Verbose {
|
||||
args = append(args, "-v")
|
||||
}
|
||||
@ -137,7 +144,12 @@ func buildGo(ctx *Context, tags string, clean bool) (err error) {
|
||||
|
||||
// Hide the terminal window on windows bullshit systems.
|
||||
if build.Default.GOOS == "windows" {
|
||||
args = append(args, "-ldflags", "-H=windowsgui")
|
||||
ldflags = append(ldflags, "-H=windowsgui")
|
||||
}
|
||||
|
||||
// Combine ldflags passed by arguments.
|
||||
if len(ldflags) > 0 {
|
||||
args = append(args, "-ldflags", strings.Join(ldflags, " "))
|
||||
}
|
||||
|
||||
// Don't overwrite already set cgo flags.
|
||||
@ -168,10 +180,6 @@ func buildGo(ctx *Context, tags string, clean bool) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func stripBinary(ctx *Context) (err error) {
|
||||
return utils.RunCommand(ctx.Env(), ctx.DestDir, "strip", ctx.OutputFile)
|
||||
}
|
||||
|
||||
func runPostHooks(ctx *Context) (err error) {
|
||||
var value string
|
||||
|
||||
|
||||
@ -67,9 +67,11 @@ type Context struct {
|
||||
OutputFile string
|
||||
StaticLibPath string
|
||||
QtProFile string
|
||||
|
||||
DebugBuild bool
|
||||
}
|
||||
|
||||
func newContext(sourceDir, buildDir, destDir string, clean bool) (ctx *Context, err error) {
|
||||
func newContext(sourceDir, buildDir, destDir string, clean bool, debugBuild bool) (ctx *Context, err error) {
|
||||
// Get absolute paths.
|
||||
sourceDir, err = filepath.Abs(sourceDir)
|
||||
if err != nil {
|
||||
@ -99,6 +101,7 @@ func newContext(sourceDir, buildDir, destDir string, clean bool) (ctx *Context,
|
||||
OutputFile: filepath.Join(destDir, filepath.Base(sourceDir)),
|
||||
StaticLibPath: filepath.Join(buildDir, staticLibName),
|
||||
QtProFile: filepath.Join(buildDir, proFileName),
|
||||
DebugBuild: debugBuild,
|
||||
}
|
||||
|
||||
// Obtain the full path to the C bindings.
|
||||
|
||||
@ -54,11 +54,19 @@ const qtProData = `
|
||||
QT += core qml quick
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++11
|
||||
|
||||
{{ if .DebugBuild -}}
|
||||
CONFIG += debug staticlib c++11
|
||||
{{- else -}}
|
||||
CONFIG += release staticlib c++11
|
||||
{{- end}}
|
||||
|
||||
win32|win64 {
|
||||
CONFIG += release
|
||||
Release:DESTDIR = {{.BuildDir}}
|
||||
{{ if .DebugBuild -}}
|
||||
Debug:DESTDIR = {{.BuildDir}}
|
||||
{{- else -}}
|
||||
Release:DESTDIR = {{.BuildDir}}
|
||||
{{- end}}
|
||||
}
|
||||
|
||||
INCLUDEPATH += {{.GmlBindingDir}}/headers
|
||||
|
||||
@ -61,7 +61,7 @@ func Containers() []string {
|
||||
func Build(
|
||||
container string,
|
||||
sourceDir, buildDir, destDir string,
|
||||
clean, noStrip, customContainer bool,
|
||||
clean, noStrip, debugBuild, customContainer bool,
|
||||
tags string,
|
||||
) (err error) {
|
||||
if !customContainer {
|
||||
@ -132,6 +132,9 @@ func Build(
|
||||
if noStrip {
|
||||
args = append(args, "--no-strip")
|
||||
}
|
||||
if debugBuild {
|
||||
args = append(args, "--debug")
|
||||
}
|
||||
|
||||
// Add the tags if defined.
|
||||
tags = strings.TrimSpace(tags)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user