mirror of
https://github.com/bluszcz/cutego.git
synced 2024-09-28 21:25:16 +03:00
add fcitx to static linux image + fix CGO_LDFLAGS issue
This commit is contained in:
parent
eedf008a49
commit
8161b74c70
5 changed files with 34 additions and 6 deletions
|
@ -385,7 +385,11 @@ func createMakefile(module, path, target string, mode int) {
|
|||
pPath := filepath.Join(path, fmt.Sprintf("%v%v.cpp", filepath.Base(path), suf))
|
||||
if (utils.QT_STATIC()) && utils.ExistsFile(pPath) {
|
||||
if content := utils.Load(pPath); !strings.Contains(content, "+build linux") {
|
||||
utils.Save(pPath, "// +build linux\r\n"+content)
|
||||
if strings.ToLower(module) == "core" && suf == "_plugin_import" && utils.ExistsFile(filepath.Join(utils.QT_INSTALL_PREFIX(target), "plugins", "platforminputcontexts", "libfcitxplatforminputcontextplugin.a")) {
|
||||
utils.Save(pPath, "// +build linux\r\n"+content+"Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)\r\n")
|
||||
} else {
|
||||
utils.Save(pPath, "// +build linux\r\n"+content)
|
||||
}
|
||||
}
|
||||
}
|
||||
if mode == MOC || mode == RCC || !utils.QT_STATIC() || (module != "Qml" && strings.Contains(pPath, "_qml_")) {
|
||||
|
@ -477,6 +481,13 @@ func createCgo(module, path, target string, mode int, ipkg, tags string) string
|
|||
|
||||
//
|
||||
|
||||
switch target {
|
||||
case "linux":
|
||||
if f := filepath.Join(utils.QT_INSTALL_PREFIX(target), "plugins", "platforminputcontexts", "libfcitxplatforminputcontextplugin.a"); utils.QT_STATIC() && strings.ToLower(module) == "core" && utils.ExistsFile(f) {
|
||||
fmt.Fprintf(bb, "#cgo LDFLAGS: %v\n", f)
|
||||
}
|
||||
}
|
||||
|
||||
file := "Mfile"
|
||||
if target == "windows" {
|
||||
file += ".Release"
|
||||
|
|
|
@ -731,7 +731,7 @@ func BuildEnv(target, name, depPath string) (map[string]string, []string, []stri
|
|||
}
|
||||
}
|
||||
|
||||
if target == "linux" && !(utils.QT_STATIC() || utils.QT_PKG_CONFIG()) {
|
||||
if _, ok := os.LookupEnv("CGO_LDFLAGS"); target == "linux" && !(utils.QT_STATIC() || utils.QT_PKG_CONFIG() || ok) {
|
||||
env["CGO_LDFLAGS"] = "-Wl,-rpath,$ORIGIN/lib -Wl,--disable-new-dtags"
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ func build(mode, target, path, ldFlagsCustom, tagsCustom, name, depPath string,
|
|||
env["CGO_ENABLED"] = "0"
|
||||
ending = ".wasm"
|
||||
case "linux":
|
||||
if fast || utils.QT_PKG_CONFIG() {
|
||||
delete(env, "CGO_LDFLAGS")
|
||||
if fast || utils.QT_PKG_CONFIG() || utils.QT_STATIC() {
|
||||
env["CGO_LDFLAGS"] = strings.Replace(env["CGO_LDFLAGS"], "-Wl,-rpath,$ORIGIN/lib -Wl,--disable-new-dtags", "", -1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@ func Install(target string, docker, vagrant, failfast bool) {
|
|||
if target == "js" {
|
||||
cmd.Args = append(cmd.Args, "-v")
|
||||
} else {
|
||||
if target == "linux" {
|
||||
delete(env, "CGO_LDFLAGS")
|
||||
if target == "linux" && (utils.QT_PKG_CONFIG() || utils.QT_STATIC()) {
|
||||
env["CGO_LDFLAGS"] = strings.Replace(env["CGO_LDFLAGS"], "-Wl,-rpath,$ORIGIN/lib -Wl,--disable-new-dtags", "", -1)
|
||||
}
|
||||
for key, value := range env {
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", key, value))
|
||||
|
|
|
@ -9,6 +9,22 @@ RUN GO=go1.12.4.linux-amd64.tar.gz && curl -sL --retry 10 --retry-delay 60 -O ht
|
|||
RUN /usr/local/go/bin/go get -tags=no_env github.com/therecipe/qt/cmd/...
|
||||
|
||||
|
||||
FROM therecipe/qt:linux_static_base as fcitx
|
||||
|
||||
ENV CMAKE_PREFIX_PATH /opt/Qt/5.12.0/gcc_64/lib/cmake/Qt5/
|
||||
|
||||
RUN apt-get -qq update && apt-get --no-install-recommends -qq -y install build-essential libglib2.0-dev libglu1-mesa-dev \
|
||||
&& apt-get --no-install-recommends -qq -y install ca-certificates cmake git libxkbcommon-dev
|
||||
|
||||
RUN git clone -q --depth 1 https://github.com/fcitx/fcitx-qt5.git
|
||||
RUN FILE=/fcitx-qt5/platforminputcontext/CMakeLists.txt \
|
||||
&& echo "ADD_DEFINITIONS(-DQT_STATICPLUGIN)\n$(cat $FILE)" > $FILE \
|
||||
&& echo "find_package(Qt5 REQUIRED COMPONENTS Core Gui DBus)\n$(cat $FILE)" > $FILE \
|
||||
&& echo "$(head -n -5 $FILE)" > $FILE \
|
||||
&& sed -i -e 's/ MODULE / STATIC /g' $FILE
|
||||
RUN cd /fcitx-qt5/platforminputcontext && cmake . && make -j $(grep -c ^processor /proc/cpuinfo)
|
||||
|
||||
|
||||
FROM ubuntu:16.04
|
||||
LABEL maintainer therecipe
|
||||
|
||||
|
@ -26,6 +42,7 @@ 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=fcitx /fcitx-qt5/platforminputcontext/libfcitxplatforminputcontextplugin.a /opt/Qt/5.12.0/gcc_64/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.a
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue