X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2d2fcf8e83870114fe6ee20746aac362927d92aa..17ffdf2077227c1b235fd97a06af805fb8207b59:/build/run-library.sh diff --git a/build/run-library.sh b/build/run-library.sh index 3434f1ae89..b0d4daa722 100755 --- a/build/run-library.sh +++ b/build/run-library.sh @@ -170,29 +170,48 @@ package_go_binary() { native_arch=$(get_native_arch) if [[ "$native_arch" != "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then - echo "Error: no cross compilation support for Go on $native_arch yet, can not build $prog for $target_arch" + echo "Error: no cross compilation support for Go on $native_arch, can not build $prog for $target_arch" return 1 fi + cross_compilation=1 + if [[ "$TARGET" == "centos7" ]]; then + if [[ "$native_arch" == "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then + echo "Error: no cross compilation support for Go on $native_arch for $TARGET, can not build $prog for $target_arch" + return 1 + fi + cross_compilation=0 + fi + + if [[ "$package_format" == "deb" ]] && + [[ "$TARGET" == "debian10" ]] || [[ "$TARGET" == "ubuntu1804" ]] || [[ "$TARGET" == "ubuntu2004" ]]; then + # Due to bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477 the libfuse-dev package for arm64 does + # not install properly side by side with the amd64 version before Debian 11. + if [[ "$native_arch" == "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then + echo "Error: no cross compilation support for Go on $native_arch for $TARGET, can not build $prog for $target_arch" + return 1 + fi + cross_compilation=0 + fi + if [[ -n "$target_arch" ]]; then - # A target architecture has been specified - package_go_binary_worker "$src_path" "$prog" "$package_format" "$description" "$native_arch" "$target_arch" "$license_file" - return $? + archs=($target_arch) else - # No target architecture specified, default to native target. When on amd64 also crosscompile arm64 - # but only when building deb packages (centos does not have support for crosscompiling userspace). + # No target architecture specified, default to native target. When on amd64 + # also crosscompile arm64 (when supported). archs=($native_arch) - if [[ "$native_arch" == "amd64" ]] && [[ "$package_format" == "deb" ]]; then + if [[ $cross_compilation -ne 0 ]]; then archs+=("arm64") fi - for ta in ${archs[@]}; do - package_go_binary_worker "$src_path" "$prog" "$package_format" "$description" "$native_arch" "$ta" "$license_file" - retval=$? - if [[ $retval -ne 0 ]]; then - return $retval - fi - done fi + + for ta in ${archs[@]}; do + package_go_binary_worker "$src_path" "$prog" "$package_format" "$description" "$native_arch" "$ta" "$license_file" + retval=$? + if [[ $retval -ne 0 ]]; then + return $retval + fi + done } # Usage: package_go_binary services/foo arvados-foo deb "Compute foo to arbitrary precision" [amd64/arm64] [amd64/arm64] [apache-2.0.txt] @@ -205,11 +224,6 @@ package_go_binary_worker() { local target_arch="${1:-amd64}"; shift local license_file="${1:-agpl-3.0.txt}"; shift - if [[ "$native_arch" != "$target_arch" ]] && [[ "$package_format" == "rpm" ]]; then - echo "Error: no cross compilation support for Go on $native_arch ($package_format), can not build $prog for $target_arch" - return 1 - fi - debug_echo "package_go_binary $src_path as $prog (native arch: $native_arch, target arch: $target_arch)" local basename="${src_path##*/}" calculate_go_package_version go_package_version $src_path @@ -222,9 +236,9 @@ package_go_binary_worker() { echo "Building $package_format ($target_arch) package for $prog from $src_path" if [[ "$native_arch" == "amd64" ]] && [[ "$target_arch" == "arm64" ]]; then - CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOARCH=${target_arch} go get -ldflags "-X git.arvados.org/arvados.git/lib/cmd.version=${go_package_version} -X main.version=${go_package_version}" "git.arvados.org/arvados.git/$src_path" + CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOARCH=${target_arch} go install -ldflags "-X git.arvados.org/arvados.git/lib/cmd.version=${go_package_version} -X main.version=${go_package_version}" "git.arvados.org/arvados.git/$src_path" else - GOARCH=${arch} go get -ldflags "-X git.arvados.org/arvados.git/lib/cmd.version=${go_package_version} -X main.version=${go_package_version}" "git.arvados.org/arvados.git/$src_path" + GOARCH=${arch} go install -ldflags "-X git.arvados.org/arvados.git/lib/cmd.version=${go_package_version} -X main.version=${go_package_version}" "git.arvados.org/arvados.git/$src_path" fi local -a switches=() @@ -728,11 +742,17 @@ fpm_build_virtualenv () { PYTHON_PKG=$pkg fi - # arvados-python-client sdist should always be built, to be available - # for other dependent packages. - if [[ -n "$ONLY_BUILD" ]] && [[ "arvados-python-client" != "$pkg" ]] && [[ "$PYTHON_PKG" != "$ONLY_BUILD" ]] && [[ "$pkg" != "$ONLY_BUILD" ]]; then - debug_echo -e "Skipping build of $pkg package." - return 0 + if [[ -n "$ONLY_BUILD" ]] && [[ "$PYTHON_PKG" != "$ONLY_BUILD" ]]; then + # arvados-python-client sdist should always be built if we are building a + # python package. + if [[ "$ONLY_BUILD" != "python3-arvados-cwl-runner" ]] && + [[ "$ONLY_BUILD" != "python3-arvados-fuse" ]] && + [[ "$ONLY_BUILD" != "python3-crunchstat-summary" ]] && + [[ "$ONLY_BUILD" != "arvados-docker-cleaner" ]] && + [[ "$ONLY_BUILD" != "python3-arvados-user-activity" ]]; then + debug_echo -e "Skipping build of $pkg package." + return 0 + fi fi if [[ -n "$target_arch" ]] && [[ "$native_arch" == "$target_arch" ]]; then