]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
On CI use common install prefix named 'dep_prefix' for installing local packages
authorRalf Habacker <ralf.habacker@freenet.de>
Mon, 9 Nov 2020 09:58:22 +0000 (10:58 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 24 Nov 2020 07:08:42 +0000 (07:08 +0000)
With this commit a new variable 'ci_local_packages' has been introduced
to have a choice for using development packages from a local installation
or from the distribution.

.gitlab-ci.yml
tools/ci-build.sh
tools/ci-install.sh

index 63598e89812410faee06ef22ea02da5f48286e23..d0b1a01fb2cda549900bc716b1fe0f57d02e94d4 100644 (file)
@@ -41,6 +41,7 @@ cache:
 
 variables:
   ci_in_docker: "yes"
+  ci_local_packages: "yes"
   ci_parallel: "2"
   ci_sudo: "yes"
   ci_distro: "debian"
index 7fed2e46ef703a45877b858964292162fb73d53f..f77f11c2022c1cf7f86d3b757a36a22853a0910d 100755 (executable)
@@ -95,6 +95,11 @@ init_wine() {
 # See ci-install.sh
 : "${ci_host:=native}"
 
+# ci_local_packages:
+# prefer local packages instead of distribution
+# See ci-install.sh
+: "${ci_local_packages:=yes}"
+
 # ci_parallel:
 # A number of parallel jobs, passed to make -j
 : "${ci_parallel:=1}"
@@ -172,14 +177,24 @@ esac
 #
 case "$ci_host" in
     (*-w64-mingw32)
-        if [ "${ci_host%%-*}" = i686 ]; then
-            mingw="$(pwd)/mingw32"
+        if [ "$ci_local_packages" = yes ]; then
+            dep_prefix=$(pwd)/${ci_host}-prefix
         else
-            mingw="$(pwd)/mingw64"
+            # assume the compiler was configured with a sysroot (e.g. openSUSE)
+            sysroot=$("${ci_host}-gcc" --print-sysroot)
+            # check if the prefix is a subdir of sysroot (e.g. openSUSE)
+            if [ -d "${sysroot}/${ci_host}" ]; then
+                dep_prefix="${sysroot}/${ci_host}"
+            else
+                # fallback: assume the dependency libraries were built with --prefix=/${ci_host}
+                dep_prefix="/${ci_host}"
+                export PKG_CONFIG_SYSROOT_DIR="${sysroot}"
+            fi
         fi
-        export PKG_CONFIG_LIBDIR="${mingw}/lib/pkgconfig"
+
+        export PKG_CONFIG_LIBDIR="${dep_prefix}/lib/pkgconfig"
         export PKG_CONFIG_PATH=
-        export PKG_CONFIG="pkg-config --define-variable=prefix=${mingw}"
+        export PKG_CONFIG="pkg-config --define-variable=prefix=${dep_prefix}"
         unset CC
         unset CXX
         export TMPDIR=/tmp
@@ -359,16 +374,18 @@ case "$ci_buildsys" in
                     if [ "$ci_runtime" = "shared" ]; then
                         libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)")
                     fi
-                    init_wine "${mingw}/bin" "$(pwd)/bin" ${libgcc_path:+"$libgcc_path"}
+                    init_wine "${dep_prefix}/bin" "$(pwd)/bin" ${libgcc_path:+"$libgcc_path"}
                     cmdwrapper="xvfb-run -a"
                 fi
                 set _ "$@"
                 set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake"
-                set "$@" -D CMAKE_PREFIX_PATH="${mingw}"
-                set "$@" -D CMAKE_INCLUDE_PATH="${mingw}/include"
-                set "$@" -D CMAKE_LIBRARY_PATH="${mingw}/lib"
-                set "$@" -D EXPAT_LIBRARY="${mingw}/lib/libexpat.dll.a"
-                set "$@" -D GLIB2_LIBRARIES="${mingw}/lib/libglib-2.0.dll.a ${mingw}/lib/libgobject-2.0.dll.a ${mingw}/lib/libgio-2.0.dll.a"
+                set "$@" -D CMAKE_PREFIX_PATH="${dep_prefix}"
+                if [ "$ci_local_packages" = yes ]; then
+                    set "$@" -D CMAKE_INCLUDE_PATH="${dep_prefix}/include"
+                    set "$@" -D CMAKE_LIBRARY_PATH="${dep_prefix}/lib"
+                    set "$@" -D EXPAT_LIBRARY="${dep_prefix}/lib/libexpat.dll.a"
+                    set "$@" -D GLIB2_LIBRARIES="${dep_prefix}/lib/libglib-2.0.dll.a ${dep_prefix}/lib/libgobject-2.0.dll.a ${dep_prefix}/lib/libgio-2.0.dll.a"
+                fi
                 if [ "$ci_test" = yes ]; then
                     set "$@" -D DBUS_USE_WINE=1
                 fi
index a1f8a86d326346839af20f2ef20a152144733460..882b0da0ac4574aba08d78ce94b8613e4e85e3bb 100755 (executable)
@@ -48,6 +48,10 @@ NULL=
 # (ci_docker is empty in this case).
 : "${ci_in_docker:=no}"
 
+# ci_local_packages:
+# prefer local packages instead of distribution
+: "${ci_local_packages:=yes}"
+
 # ci_suite:
 # OS suite (release, branch) in which we are testing.
 # Typical values for ci_distro=debian: sid, jessie
@@ -204,39 +208,6 @@ case "$ci_distro" in
                 ;;
         esac
 
-        case "$ci_host" in
-            (*-w64-mingw32)
-                mirror=http://repo.msys2.org/mingw/${ci_host%%-*}
-                if [ "${ci_host%%-*}" = i686 ]; then
-                    mingw="$(pwd)/mingw32"
-                else
-                    mingw="$(pwd)/mingw64"
-                fi
-                install -d "${mingw}"
-                for pkg in \
-                    bzip2-1.0.8-1 \
-                    expat-2.2.9-1 \
-                    gcc-libs-9.3.0-2 \
-                    gettext-0.19.8.1-8 \
-                    glib2-2.64.2-1 \
-                    iconv-1.16-1 \
-                    libffi-3.3-1 \
-                    libiconv-1.16-1 \
-                    libwinpthread-git-8.0.0.5814.9dbf4cc1-1 \
-                    pcre-8.44-1 \
-                    zlib-1.2.11-7 \
-                ; do
-                    wget ${mirror}/mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
-                    tar -xvf mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
-                done
-
-                # limit access rights
-                if [ "$ci_in_docker" = yes ]; then
-                    chown -R user "${mingw}"
-                fi
-                ;;
-        esac
-
         # Make sure we have a messagebus user, even if the dbus package
         # isn't installed
         $sudo adduser --system --quiet --home /nonexistent --no-create-home \
@@ -249,4 +220,35 @@ case "$ci_distro" in
         ;;
 esac
 
+if [ "$ci_local_packages" = yes ]; then
+    case "$ci_host" in
+        (*-w64-mingw32)
+            mirror=http://repo.msys2.org/mingw/${ci_host%%-*}
+            dep_prefix=$(pwd)/${ci_host}-prefix
+            install -d "${dep_prefix}"
+            for pkg in \
+                bzip2-1.0.8-1 \
+                expat-2.2.9-1 \
+                gcc-libs-9.3.0-2 \
+                gettext-0.19.8.1-8 \
+                glib2-2.64.2-1 \
+                iconv-1.16-1 \
+                libffi-3.3-1 \
+                libiconv-1.16-1 \
+                libwinpthread-git-8.0.0.5814.9dbf4cc1-1 \
+                pcre-8.44-1 \
+                zlib-1.2.11-7 \
+            ; do
+                wget ${mirror}/mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
+                tar -C ${dep_prefix} --strip-components=1 -xvf mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
+            done
+
+            # limit access rights
+            if [ "$ci_in_docker" = yes ]; then
+                chown -R user "${dep_prefix}"
+            fi
+            ;;
+    esac
+fi
+
 # vim:set sw=4 sts=4 et: