github.com/lazyledger/lazyledger-core@v0.35.0-dev.0.20210613111200-4c651f053571/build.sh (about)

     1  #!/bin/bash
     2  
     3  set -ue
     4  
     5  # Expect the following envvars to be set:
     6  # - APP
     7  # - VERSION
     8  # - COMMIT
     9  # - TARGET_OS
    10  # - LEDGER_ENABLED
    11  # - DEBUG
    12  
    13  # Source builder's functions library
    14  . /usr/local/share/cosmos-sdk/buildlib.sh
    15  
    16  # These variables are now available
    17  # - BASEDIR
    18  # - OUTDIR
    19  
    20  # Build for each os-architecture pair
    21  for platform in ${TARGET_PLATFORMS} ; do
    22      # This function sets GOOS, GOARCH, and OS_FILE_EXT environment variables
    23      # according to the build target platform. OS_FILE_EXT is empty in all
    24      # cases except when the target platform is 'windows'.
    25      setup_build_env_for_platform "${platform}"
    26  
    27      make clean
    28      echo Building for $(go env GOOS)/$(go env GOARCH) >&2
    29      GOROOT_FINAL="$(go env GOROOT)" \
    30      make build LDFLAGS=-buildid=${VERSION} COMMIT=${COMMIT}
    31      mv ./build/${APP}${OS_FILE_EXT} ${OUTDIR}/${APP}-${VERSION}-$(go env GOOS)-$(go env GOARCH)${OS_FILE_EXT}
    32  
    33      # This function restore the build environment variables to their
    34      # original state.
    35      restore_build_env
    36  done
    37  
    38  # Generate and display build report.
    39  generate_build_report
    40  cat ${OUTDIR}/build_report