mirror of
https://github.com/bluszcz/cutego.git
synced 2024-09-28 21:25:16 +03:00
new static linux docker image + add qtsetup failfast flag + minor fix for docker deployments
This commit is contained in:
parent
da9f0689a8
commit
be7a7d5463
14 changed files with 95 additions and 12 deletions
|
@ -101,7 +101,7 @@ func main() {
|
|||
if target == "desktop" {
|
||||
target = runtime.GOOS
|
||||
}
|
||||
utils.CheckBuildTarget(target)
|
||||
utils.CheckBuildTarget(target, docker)
|
||||
cmd.InitEnv(target)
|
||||
|
||||
if !filepath.IsAbs(path) {
|
||||
|
|
|
@ -68,7 +68,7 @@ func main() {
|
|||
if target == "desktop" {
|
||||
target = runtime.GOOS
|
||||
}
|
||||
utils.CheckBuildTarget(target)
|
||||
utils.CheckBuildTarget(target, docker)
|
||||
cmd.InitEnv(target)
|
||||
|
||||
if !filepath.IsAbs(path) {
|
||||
|
|
|
@ -74,7 +74,7 @@ func main() {
|
|||
if target == "desktop" {
|
||||
target = runtime.GOOS
|
||||
}
|
||||
utils.CheckBuildTarget(target)
|
||||
utils.CheckBuildTarget(target, docker)
|
||||
cmd.InitEnv(target)
|
||||
|
||||
if !filepath.IsAbs(path) {
|
||||
|
|
|
@ -71,7 +71,7 @@ func main() {
|
|||
if target == "desktop" {
|
||||
target = runtime.GOOS
|
||||
}
|
||||
utils.CheckBuildTarget(target)
|
||||
utils.CheckBuildTarget(target, docker)
|
||||
cmd.InitEnv(target)
|
||||
|
||||
if !filepath.IsAbs(path) {
|
||||
|
|
|
@ -55,6 +55,9 @@ func main() {
|
|||
flag.BoolVar(&dynamic, "dynamic", false, "create and use semi-dynamic libraries during the generation and installation process (experimental; no real replacement for dynamic linking)")
|
||||
}
|
||||
|
||||
var failfast bool
|
||||
flag.BoolVar(&failfast, "failfast", false, "exit the setup upon the first error encountered during the installation step")
|
||||
|
||||
if cmd.ParseFlags() {
|
||||
flag.Usage()
|
||||
}
|
||||
|
@ -82,7 +85,7 @@ func main() {
|
|||
if target == "desktop" {
|
||||
target = runtime.GOOS
|
||||
}
|
||||
utils.CheckBuildTarget(target)
|
||||
utils.CheckBuildTarget(target, docker)
|
||||
cmd.InitEnv(target)
|
||||
|
||||
if dynamic && (target == runtime.GOOS || target == "js" || target == "wasm") {
|
||||
|
@ -101,14 +104,14 @@ func main() {
|
|||
case "generate":
|
||||
setup.Generate(target, docker, vagrant)
|
||||
case "install":
|
||||
setup.Install(target, docker, vagrant)
|
||||
setup.Install(target, docker, vagrant, failfast)
|
||||
case "test":
|
||||
setup.Test(target, docker, vagrant, vagrant_system)
|
||||
case "full":
|
||||
setup.Prep()
|
||||
setup.Check(target, docker, vagrant)
|
||||
setup.Generate(target, docker, vagrant)
|
||||
setup.Install(target, docker, vagrant)
|
||||
setup.Install(target, docker, vagrant, failfast)
|
||||
setup.Test(target, docker, vagrant, vagrant_system)
|
||||
case "update":
|
||||
setup.Update()
|
||||
|
|
|
@ -292,6 +292,11 @@ func ShouldBuildForTarget(module, target string) bool {
|
|||
return false
|
||||
}
|
||||
}
|
||||
|
||||
case "linux":
|
||||
if utils.QT_STATIC() && module == "WebEngine" {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
|
@ -602,6 +602,9 @@ func createCgo(module, path, target string, mode int, ipkg, tags string) string
|
|||
}
|
||||
case "linux":
|
||||
tmp = strings.Replace(tmp, "-Wl,-O1", "-O1", -1)
|
||||
tmp = strings.Replace(tmp, "-ffunction-sections", "", -1)
|
||||
tmp = strings.Replace(tmp, "-fdata-sections", "", -1)
|
||||
tmp = strings.Replace(tmp, "-Wl,--gc-sections", "", -1)
|
||||
}
|
||||
utils.Save(filepath.Join(path, file), tmp)
|
||||
}
|
||||
|
|
|
@ -112,6 +112,10 @@ func bundle(mode, target, path, name, depPath string, tagsCustom string, fast bo
|
|||
utils.MkdirAll(assets)
|
||||
copy(assets+"/.", depPath)
|
||||
|
||||
if utils.QT_STATIC() {
|
||||
break
|
||||
}
|
||||
|
||||
//TODO: -->
|
||||
{
|
||||
if utils.QT_PKG_CONFIG() {
|
||||
|
|
|
@ -47,9 +47,9 @@ func Generate(target string, docker, vagrant bool) {
|
|||
var license string
|
||||
switch module {
|
||||
case "Charts", "DataVisualization":
|
||||
license = strings.Repeat(" ", 20-len(module)) + "[GPLv3]"
|
||||
license = strings.Repeat(" ", 21-len(module)) + "[GPLv3]"
|
||||
}
|
||||
utils.Log.Infof("generating %v qt/%v %v", mode, strings.ToLower(module), license)
|
||||
utils.Log.Infof("generating %v qt/%v%v", mode, strings.ToLower(module), license)
|
||||
|
||||
if target == runtime.GOOS || utils.QT_FAT() || (mode == "full" && (target == "js" || target == "wasm")) { //TODO: REVIEW
|
||||
templater.GenModule(module, target, templater.NONE)
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/therecipe/qt/internal/utils"
|
||||
)
|
||||
|
||||
func Install(target string, docker, vagrant bool) {
|
||||
func Install(target string, docker, vagrant, failfast bool) {
|
||||
utils.Log.Infof("running: 'qtsetup install %v' [docker=%v] [vagrant=%v]", target, docker, vagrant)
|
||||
|
||||
if strings.HasPrefix(target, "sailfish") && !utils.QT_SAILFISH() {
|
||||
|
@ -125,6 +125,9 @@ func Install(target string, docker, vagrant bool) {
|
|||
if msg, err := utils.RunCmdOptionalError(cmd, fmt.Sprintf("install %v", strings.ToLower(module))); err != nil {
|
||||
println(msg)
|
||||
failed = append(failed, strings.ToLower(module))
|
||||
if strings.ToLower(module) == "core" || failfast {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,19 @@ jobs:
|
|||
parameters:
|
||||
file: linux/Dockerfile.arch
|
||||
tag: linux_arch
|
||||
-
|
||||
template: docker_job_template.yml
|
||||
parameters:
|
||||
file: linux/Dockerfile.static_base
|
||||
tag: linux_static_base
|
||||
-
|
||||
template: docker_job_template.yml
|
||||
parameters:
|
||||
file: linux/Dockerfile.static
|
||||
tag: linux_static
|
||||
dep:
|
||||
- linux_static_base
|
||||
- linux
|
||||
-
|
||||
template: docker_job_template.yml
|
||||
parameters:
|
||||
|
|
38
internal/docker/linux/Dockerfile.static
Normal file
38
internal/docker/linux/Dockerfile.static
Normal file
|
@ -0,0 +1,38 @@
|
|||
FROM ubuntu:16.04 as base
|
||||
|
||||
ENV USER user
|
||||
ENV HOME /home/$USER
|
||||
ENV GOPATH $HOME/work
|
||||
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install ca-certificates curl git
|
||||
RUN GO=go1.11.2.linux-amd64.tar.gz && curl -sL --retry 10 --retry-delay 60 -O https://dl.google.com/go/$GO && tar -xzf $GO -C /usr/local
|
||||
RUN /usr/local/go/bin/go get -tags=no_env github.com/therecipe/qt/cmd/...
|
||||
|
||||
|
||||
FROM ubuntu:16.04
|
||||
LABEL maintainer therecipe
|
||||
|
||||
ENV USER user
|
||||
ENV HOME /home/$USER
|
||||
ENV GOPATH $HOME/work
|
||||
ENV PATH /usr/local/go/bin:$PATH
|
||||
ENV QT_DIR /opt/Qt
|
||||
ENV QT_DOCKER true
|
||||
ENV QT_STATIC true
|
||||
ENV QT_QMAKE_DIR /opt/Qt/5.12.0/gcc_64/bin
|
||||
|
||||
|
||||
COPY --from=base /usr/local/go /usr/local/go
|
||||
COPY --from=base $GOPATH/bin $GOPATH/bin
|
||||
COPY --from=base $GOPATH/src/github.com/therecipe/qt $GOPATH/src/github.com/therecipe/qt
|
||||
COPY --from=therecipe/qt:linux_static_base /opt/Qt/5.12.0 /opt/Qt/5.12.0
|
||||
COPY --from=therecipe/qt:linux /opt/Qt/Docs /opt/Qt/Docs
|
||||
COPY --from=therecipe/qt:linux /opt/Qt/Licenses /opt/Qt/Licenses
|
||||
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install build-essential libglib2.0-dev libglu1-mesa-dev libpulse-dev \
|
||||
&& apt-get --no-install-recommends -qq -y install fontconfig libasound2 libegl1-mesa libnss3 libpci3 libxcomposite1 libxcursor1 libxi6 libxrandr2 libxtst6 && apt-get -qq clean
|
||||
|
||||
RUN $GOPATH/bin/qtsetup prep
|
||||
RUN $GOPATH/bin/qtsetup check
|
||||
RUN $GOPATH/bin/qtsetup generate
|
||||
RUN cd $GOPATH/src/github.com/therecipe/qt/internal/examples/widgets/line_edits && $GOPATH/bin/qtdeploy build linux && rm -rf ./deploy
|
10
internal/docker/linux/Dockerfile.static_base
Normal file
10
internal/docker/linux/Dockerfile.static_base
Normal file
|
@ -0,0 +1,10 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install ca-certificates git
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install dbus fontconfig libx11-6 libx11-xcb1
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install build-essential libglib2.0-dev libglu1-mesa-dev libpulse-dev \
|
||||
&& apt-get --no-install-recommends -qq -y install fontconfig libasound2 libegl1-mesa libnss3 libpci3 libxcomposite1 libxcursor1 libxi6 libxrandr2 libxtst6
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install libdbus-1-dev libssl-dev
|
||||
|
||||
RUN git clone -q --depth 1 -b 5.12 --recursive https://code.qt.io/qt/qt5.git /opt/qt5
|
||||
RUN cd /opt/qt5 && ./configure -prefix /opt/Qt/5.12.0/gcc_64 -confirm-license -opensource -static -qt-zlib -qt-libpng -qt-libjpeg -dbus -opengl -optimize-size -skip qtwebengine -skip qtfeedback -nomake tests -nomake examples && make && make install
|
|
@ -105,7 +105,7 @@ func QT_DEBUG_CONSOLE() bool {
|
|||
return os.Getenv("QT_DEBUG_CONSOLE") == "true"
|
||||
}
|
||||
|
||||
func CheckBuildTarget(buildTarget string) {
|
||||
func CheckBuildTarget(buildTarget string, docker bool) {
|
||||
switch buildTarget {
|
||||
case "android", "android-emulator",
|
||||
"ios", "ios-simulator",
|
||||
|
@ -119,7 +119,7 @@ func CheckBuildTarget(buildTarget string) {
|
|||
Log.Panicf("failed to recognize build target %v", buildTarget)
|
||||
}
|
||||
}
|
||||
if buildTarget != runtime.GOOS && !strings.Contains(buildTarget, "_") {
|
||||
if !docker && buildTarget != runtime.GOOS && !strings.Contains(buildTarget, "_") {
|
||||
switch {
|
||||
case QT_MSYS2():
|
||||
Log.Fatalf("%v is not supported as a deploy target on %v with MSYS2 -> install the official Qt version instead and try again", buildTarget, runtime.GOOS)
|
||||
|
@ -305,3 +305,7 @@ func GoList(args ...string) *exec.Cmd {
|
|||
cmd.Env = append(os.Environ(), []string{"CGO_ENABLED=0"}...)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func QT_STATIC() bool {
|
||||
return os.Getenv("QT_STATIC") == "true"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue