build-freebsd.sh 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/usr/bin/env bash
  2. ##############################################################################
  3. # FreeBSD full build script
  4. ##############################################################################
  5. #
  6. # This script contains all steps necessary to:
  7. #
  8. # * Build OBS with all default plugins and dependencies
  9. # * Package a FreeBSD package
  10. #
  11. # Parameters:
  12. # -h, --help : Print usage help
  13. # -q, --quiet : Suppress most build process output
  14. # -v, --verbose : Enable more verbose build process output
  15. # -d, --skip-dependency-checks : Skip dependency checks (default: off)
  16. # -p, --portable : Create portable build (default: off)
  17. # -pkg, --package : Create distributable archive
  18. # (default: off)
  19. # --build-dir : Specify alternative build directory
  20. # (default: build)"
  21. #
  22. ##############################################################################
  23. # Halt on errors
  24. set -eE
  25. ## SET UP ENVIRONMENT ##
  26. _RUN_OBS_BUILD_SCRIPT=TRUE
  27. PRODUCT_NAME="OBS-Studio"
  28. CHECKOUT_DIR="$(git rev-parse --show-toplevel)"
  29. DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies"
  30. source "${CHECKOUT_DIR}/CI/include/build_support.sh"
  31. source "${CHECKOUT_DIR}/CI/include/build_support_freebsd.sh"
  32. ## DEPENDENCY INSTALLATION
  33. source "${CHECKOUT_DIR}/CI/freebsd/01_install_dependencies.sh"
  34. ## BUILD OBS ##
  35. source "${CHECKOUT_DIR}/CI/freebsd/02_build_obs.sh"
  36. ## PACKAGE OBS AND NOTARIZE ##
  37. source "${CHECKOUT_DIR}/CI/freebsd/03_package_obs.sh"
  38. ## MAIN SCRIPT FUNCTIONS ##
  39. print_usage() {
  40. echo "build-linux.sh - Build script for OBS-Studio\n"
  41. echo -e "Usage: ${0}\n" \
  42. "-h, --help : Print this help\n" \
  43. "-q, --quiet : Suppress most build process output\n" \
  44. "-v, --verbose : Enable more verbose build process output\n" \
  45. "-d, --skip-dependency-checks : Skip dependency checks (default: off)\n" \
  46. "-p, --portable : Create portable build (default: off)\n" \
  47. "-pkg, --package : Create distributable disk image (default: off)\n" \
  48. "--build-dir : Specify alternative build directory (default: build)\n"
  49. }
  50. obs-build-main() {
  51. while true; do
  52. case "${1}" in
  53. -h | --help ) print_usage; exit 0 ;;
  54. -q | --quiet ) export QUIET=TRUE; shift ;;
  55. -v | --verbose ) export VERBOSE=TRUE; shift ;;
  56. -d | --skip-dependency-checks ) SKIP_DEP_CHECKS=TRUE; shift ;;
  57. -p | --portable ) PORTABLE=TRUE; shift ;;
  58. -pkg | --package ) PACKAGE=TRUE; shift ;;
  59. --disable-pipewire ) DISABLE_PIPEWIRE=TRUE; shift ;;
  60. --build-dir ) BUILD_DIR="${2}"; shift 2 ;;
  61. -- ) shift; break ;;
  62. * ) break ;;
  63. esac
  64. done
  65. ensure_dir "${CHECKOUT_DIR}"
  66. step "Fetching OBS tags..."
  67. git fetch origin --tags
  68. GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
  69. GIT_HASH=$(git rev-parse --short HEAD)
  70. GIT_TAG=$(git describe --tags --abbrev=0)
  71. FILE_NAME="obs-studio-${GIT_TAG}-${GIT_HASH}-FreeBSD"
  72. if [ -z "${SKIP_DEP_CHECKS}" ]; then
  73. install_dependencies
  74. fi
  75. build_obs
  76. if [ "${PACKAGE}" ]; then
  77. package_obs
  78. fi
  79. cleanup
  80. }
  81. obs-build-main $*