├── .github └── workflows │ ├── mlt-weekly-tests.yml │ ├── qt6-build.yml │ └── shotcut-build.yml ├── .gitignore ├── README.md ├── build ├── build-flowblade.sh ├── build-kdenlive.sh ├── build-melt.sh └── build-melted.sh ├── docker ├── README.md ├── mlt-build │ └── Dockerfile ├── mxe │ └── Dockerfile ├── qt6-build │ └── Dockerfile └── shotcut-build │ └── Dockerfile ├── teamcity ├── flowblade.sh ├── kdenlive.sh ├── melt.sh ├── melted.sh ├── openshot.sh ├── shotcut.sh └── test.sh └── test ├── report_results.sh ├── test_avsync.sh ├── test_libav_regression.sh ├── test_qtest.sh └── test_yml.sh /.github/workflows/mlt-weekly-tests.yml: -------------------------------------------------------------------------------- 1 | name: mlt-weekly-tests 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | # weekly 7 | - cron: '0 8 * * 6' 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-20.04 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | 16 | - name: Install dependencies 17 | env: 18 | DEBIAN_FRONTEND: noninteractive 19 | run: | 20 | sudo sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list" 21 | sudo apt-get -qq update 22 | sudo apt-get -yqq build-dep mlt 23 | sudo apt-get -yqq install qt5-default locales yasm nasm xutils-dev cmake curl libtheora-dev libvorbis-dev kwalify meson ninja-build 24 | sudo locale-gen de_DE.UTF-8 25 | 26 | - name: Build and test 27 | run: ./teamcity/test.sh 28 | -------------------------------------------------------------------------------- /.github/workflows/qt6-build.yml: -------------------------------------------------------------------------------- 1 | name: docker-qt6-build 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'docker/qt6-build/**' 7 | pull_request: 8 | paths: 9 | -'docker/qt6-build/**' 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | if: ${{ github.repository_owner == 'mltframework' }} 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Set up Docker Buildx 19 | uses: docker/setup-buildx-action@v2 20 | 21 | - name: Login to Docker Hub 22 | uses: docker/login-action@v2 23 | with: 24 | username: ${{ secrets.DOCKER_USERNAME }} 25 | password: ${{ secrets.DOCKER_PASSWORD }} 26 | 27 | - name: Build and Push to Docker Hub 28 | uses: docker/build-push-action@v3 29 | with: 30 | context: "{{defaultContext}}:docker/qt6-build" 31 | push: true 32 | tags: mltframework/qt:6.4.3-ubuntu18.04 33 | -------------------------------------------------------------------------------- /.github/workflows/shotcut-build.yml: -------------------------------------------------------------------------------- 1 | name: docker-shotcut-build 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'docker/shotcut-build/**' 7 | pull_request: 8 | paths: 9 | -'docker/shotcut-build/**' 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | if: ${{ github.repository_owner == 'mltframework' }} 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Set up Docker Buildx 19 | uses: docker/setup-buildx-action@v2 20 | 21 | - name: Login to Docker Hub 22 | uses: docker/login-action@v2 23 | with: 24 | username: ${{ secrets.DOCKER_USERNAME }} 25 | password: ${{ secrets.DOCKER_PASSWORD }} 26 | 27 | - name: Build and Push to Docker Hub 28 | uses: docker/build-push-action@v3 29 | with: 30 | context: "{{defaultContext}}:docker/shotcut-build" 31 | push: true 32 | tags: mltframework/shotcut-build:qt6.4.3-ubuntu20.04 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | docker/work/* 2 | docker/.* 3 | work/* 4 | qt-*.txz 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![docker-shotcut-build](https://github.com/mltframework/mlt-scripts/workflows/docker-shotcut-build/badge.svg) 2 | 3 | This repository contains scripts for Continuous Integration and Deployment for the MLT and Shotcut projects. 4 | 5 | - The `teamcity` folder contains the scripts executed byour TeamCity build server. This server is legacy as we hope to 6 | migrate to GitHub Actions. 7 | - The `build` folder contains scripts that the TeamCity scripts or users may wish to run to build MLT applications 8 | bundled with some depenencies. 9 | - The `test` folder contains various test scripts executed by the `teamcity/test.sh` script. 10 | - The `docker` folder contains `Dockerfile`s for containers that may be used by some of the build scripts or GitHub 11 | Actions. 12 | -------------------------------------------------------------------------------- /build/build-flowblade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script builds mlt, flowblade, and many of their dependencies. 4 | # It can accept a configuration file, default: build-flowblade.conf 5 | 6 | # List of programs used: 7 | # bash, test, tr, awk, ps, make, cmake, cat, sed, curl or wget, and possibly others 8 | 9 | # Author: Dan Dennedy 10 | # Version: 8 11 | # License: GPL2 12 | 13 | ################################################################################ 14 | # ARGS AND GLOBALS 15 | ################################################################################ 16 | 17 | # These are all of the configuration variables with defaults 18 | INSTALL_DIR="$HOME/flowblade" 19 | AUTO_APPEND_DATE=1 20 | SOURCE_DIR="$INSTALL_DIR/src" 21 | ACTION_GET_COMPILE_INSTALL=1 22 | ACTION_GET_ONLY=0 23 | ACTION_COMPILE_INSTALL=0 24 | SOURCES_CLEAN=1 25 | INSTALL_AS_ROOT=0 26 | CREATE_STARTUP_SCRIPT=1 27 | FLOWBLADE_HEAD=1 28 | FLOWBLADE_REVISION= 29 | ENABLE_FREI0R=1 30 | FREI0R_HEAD=1 31 | FREI0R_REVISION= 32 | ENABLE_SWFDEC=0 33 | SWFDEC_HEAD=1 34 | SWFDEC_REVISION= 35 | X264_HEAD=1 36 | X264_REVISION= 37 | LIBVPX_HEAD=1 38 | LIBVPX_REVISION= 39 | ENABLE_LAME=1 40 | FFMPEG_HEAD=1 41 | FFMPEG_REVISION= 42 | FFMPEG_SUPPORT_H264=1 43 | FFMPEG_SUPPORT_LIBVPX=1 44 | FFMPEG_SUPPORT_THEORA=1 45 | FFMPEG_SUPPORT_MP3=1 46 | FFMPEG_SUPPORT_FAAC=0 47 | FFMPEG_ADDITIONAL_OPTIONS= 48 | MLT_HEAD=1 49 | MLT_REVISION= 50 | MLT_DISABLE_SOX=0 51 | 52 | ################################################################################ 53 | # Location of config file - if not overriden on command line 54 | CONFIGFILE=build-flowblade.conf 55 | 56 | # If defined to 1, outputs trace log lines 57 | TRACE=0 58 | 59 | # If defined to 1, outputs debug log lines 60 | DEBUG=0 61 | 62 | # We need to set LANG to C to avoid e.g. svn from getting to funky 63 | export LANG=C 64 | 65 | # User CFLAGS and LDFLAGS sometimes prevent more recent local headers. 66 | # Also, you can adjust some flags here. 67 | export CFLAGS= 68 | export CXXFLAGS= 69 | export LDFLAGS= 70 | 71 | ################################################################################ 72 | # FUNCTION SECTION 73 | ################################################################################ 74 | 75 | ################################################################# 76 | # usage 77 | # Reports legal options to this script 78 | function usage { 79 | echo "Usage: $0 [-c config-file] [-t] [-h]" 80 | echo "Where:" 81 | echo -e "\t-c config-file\tDefaults to $CONFIGFILE" 82 | echo -e "\t-t\t\tSpawn into sep. process" 83 | } 84 | 85 | ################################################################# 86 | # parse_args 87 | # Parses the arguments passed in $@ and sets some global vars 88 | function parse_args { 89 | CONFIGFILEOPT="" 90 | DETACH=0 91 | while getopts ":tc:d:l:" OPT; do 92 | case $OPT in 93 | c ) CONFIGFILEOPT=$OPTARG 94 | echo Setting configfile to $CONFIGFILEOPT 95 | ;; 96 | t ) DETACH=1;; 97 | h ) usage 98 | exit 0;; 99 | * ) echo "Unknown option $OPT" 100 | usage 101 | exit 1;; 102 | esac 103 | done 104 | 105 | # Check configfile 106 | if test "$CONFIGFILEOPT" != ""; then 107 | if test ! -r "$CONFIGFILEOPT" ; then 108 | echo "Unable to read config-file $CONFIGFILEOPT" 109 | exit 1 110 | fi 111 | CONFIGFILE="$CONFIGFILEOPT" 112 | fi 113 | } 114 | ###################################################################### 115 | # DATA HANDLING FUNCTIONS 116 | ###################################################################### 117 | 118 | ################################################################# 119 | # to_key 120 | # Returns a numeric key from a known subproject 121 | # $1 : string: ffmpeg, mlt, etc. 122 | function to_key { 123 | case $1 in 124 | FFmpeg) 125 | echo 0 126 | ;; 127 | mlt) 128 | echo 1 129 | ;; 130 | flowblade) 131 | echo 2 132 | ;; 133 | frei0r) 134 | echo 3 135 | ;; 136 | x264) 137 | echo 4 138 | ;; 139 | libvpx) 140 | echo 5 141 | ;; 142 | swfdec) 143 | echo 6 144 | ;; 145 | lame) 146 | echo 7 147 | ;; 148 | *) 149 | echo UNKNOWN 150 | ;; 151 | esac 152 | } 153 | 154 | ################################################################# 155 | # lookup - lookup a value from an array and return it 156 | # $1 array name, $2 subdir name, that is, text string 157 | function lookup { 158 | eval echo "\${${1}[`to_key $2`]}" 159 | } 160 | 161 | ###################################################################### 162 | # LOG FUNCTIONS 163 | ###################################################################### 164 | 165 | ################################################################# 166 | # init_log_file 167 | # Write some init stuff 168 | function init_log_file { 169 | log `date` 170 | log $0 starting 171 | } 172 | 173 | ################################################################# 174 | # trace 175 | # Function that prints a trace line 176 | # $@ : arguments to be printed 177 | function trace { 178 | if test "1" = "$TRACE" ; then 179 | echo "TRACE: $@" 180 | fi 181 | } 182 | 183 | ################################################################# 184 | # debug 185 | # Function that prints a debug line 186 | # $@ : arguments to be printed 187 | function debug { 188 | if test "1" = "$DEBUG" ; then 189 | echo "DEBUG: $@" 190 | fi 191 | } 192 | 193 | ################################################################# 194 | # log 195 | # Function that prints a log line 196 | # $@ : arguments to be printed 197 | function log { 198 | echo "LOG: $@" 199 | } 200 | 201 | ################################################################# 202 | # log warning 203 | # Function that prints a warning line 204 | # $@ : arguments to be printed 205 | function warn { 206 | echo "WARN: $@" 207 | } 208 | 209 | ################################################################# 210 | # die 211 | # Function that prints a line and exists 212 | # $@ : arguments to be printed 213 | function die { 214 | echo "ERROR: $@" 215 | feedback_result FAILURE "Some kind of error occured: $@" 216 | exit -1 217 | } 218 | 219 | ################################################################# 220 | # cmd 221 | # Function that does a (non-background, non-outputting) command, after logging it 222 | function cmd { 223 | trace "Entering cmd @ = $@" 224 | log About to run command: "$@" 225 | "$@" 226 | } 227 | 228 | 229 | ###################################################################### 230 | # SETUP FUNCTIONS 231 | ###################################################################### 232 | 233 | ################################################################# 234 | # read_configuration 235 | # Reads $CONFIGFILE, parses it, and exports global variables reflecting the 236 | # content. Aborts, if the file does not exist or is not readable 237 | CONFIGURATION="" 238 | function read_configuration { 239 | trace "Entering read_configuration @ = $@" 240 | if test ! -r "$CONFIGFILE"; then 241 | warn "Unable to read config file $CONFIGFILE" 242 | return 243 | fi 244 | debug "Reading configuration from $CONFIGFILE" 245 | # This is for replacement in start-flowblade 246 | for LINE in `tr "\t" "=" < $CONFIGFILE`; do 247 | debug Setting $LINE 248 | CONFIGURATION="$CONFIGURATION$LINE " 249 | #export $LINE || die "Invalid export line: $LINE. Unable to set configuration options from CONFIGFILE" 250 | done ||\ 251 | die "Unable to set configuration options from $CONFIGFILE" 252 | source "$CONFIGFILE" || die "Unable to evaluate configuration options from $CONFIGFILE" 253 | } 254 | 255 | ################################################################# 256 | # set_globals 257 | # Set up globals based on configuration 258 | # This is where the configuration options for each subproject is assembled 259 | function set_globals { 260 | trace "Entering set_globals @ = $@" 261 | # Set two convenience variables. 262 | if test 1 = "$ACTION_GET_ONLY" -o 1 = "$ACTION_GET_COMPILE_INSTALL" ; then 263 | GET=1 264 | else 265 | GET=0 266 | fi 267 | NEED_SUDO=0 268 | if test 1 = "$ACTION_GET_COMPILE_INSTALL" -o 1 = "$ACTION_COMPILE_INSTALL" ; then 269 | COMPILE_INSTALL=1 270 | if test 1 = $INSTALL_AS_ROOT ; then 271 | NEED_SUDO=1 272 | fi 273 | else 274 | COMPILE_INSTALL=0 275 | fi 276 | debug "GET=$GET, COMPILE_INSTALL=$COMPILE_INSTALL, NEED_SUDO=$NEED_SUDO" 277 | 278 | # The script sets CREATE_STARTUP_SCRIPT to true always, disable if not COMPILE_INSTALL 279 | if test 0 = "$COMPILE_INSTALL" ; then 280 | CREATE_STARTUP_SCRIPT=0 281 | fi 282 | debug "CREATE_STARTUP_SCRIPT=$CREATE_STARTUP_SCRIPT" 283 | 284 | # Subdirs list, for number of common operations 285 | # Note, the function to_key depends on this 286 | SUBDIRS="FFmpeg mlt flowblade" 287 | if test "$ENABLE_FREI0R" = 1 ; then 288 | SUBDIRS="frei0r $SUBDIRS" 289 | fi 290 | if test "$ENABLE_SWFDEC" = 1 && test "$SWFDEC_HEAD" = 1 -o "$SWFDEC_REVISION" != ""; then 291 | SUBDIRS="swfdec $SUBDIRS" 292 | fi 293 | if test "$FFMPEG_SUPPORT_H264" = 1 && test "$X264_HEAD" = 1 -o "$X264_REVISION" != ""; then 294 | SUBDIRS="x264 $SUBDIRS" 295 | fi 296 | if test "$FFMPEG_SUPPORT_LIBVPX" = 1 && test "$LIBVPX_HEAD" = 1 -o "$LIBVPX_REVISION" != ""; then 297 | SUBDIRS="libvpx $SUBDIRS" 298 | fi 299 | if test "$FFMPEG_SUPPORT_MP3" = 1 && test "$ENABLE_LAME" = 1; then 300 | SUBDIRS="lame $SUBDIRS" 301 | fi 302 | debug "SUBDIRS = $SUBDIRS" 303 | 304 | # REPOLOCS Array holds the repo urls 305 | REPOLOCS[0]="https://github.com/FFmpeg/FFmpeg.git" 306 | REPOLOCS[1]="https://github.com/mltframework/mlt.git" 307 | REPOLOCS[2]="https://github.com/jliljebl/flowblade.git" 308 | REPOLOCS[3]="https://github.com/dyne/frei0r.git" 309 | REPOLOCS[4]="https://github.com/mirror/x264.git" 310 | REPOLOCS[5]="https://chromium.googlesource.com/webm/libvpx.git" 311 | REPOLOCS[6]="https://github.com/mltframework/swfdec.git" 312 | REPOLOCS[7]="https://ftp.osuosl.org/pub/blfs/conglomeration/lame/lame-3.99.5.tar.gz" 313 | 314 | # REPOTYPE Array holds the repo types. (Yes, this might be redundant, but easy for me) 315 | REPOTYPES[0]="git" 316 | REPOTYPES[1]="git" 317 | REPOTYPES[2]="git" 318 | REPOTYPES[3]="git" 319 | REPOTYPES[4]="git" 320 | REPOTYPES[5]="git" 321 | REPOTYPES[6]="git" 322 | REPOTYPES[7]="http-tgz" 323 | 324 | # And, set up the revisions 325 | REVISIONS[0]="" 326 | if test 0 = "$FFMPEG_HEAD" -a "$FFMPEG_REVISION" ; then 327 | REVISIONS[0]="$FFMPEG_REVISION" 328 | fi 329 | # Git, just use blank or the hash. 330 | REVISIONS[1]="" 331 | if test 0 = "$MLT_HEAD" -a "$MLT_REVISION" ; then 332 | REVISIONS[1]="$MLT_REVISION" 333 | fi 334 | REVISIONS[2]="" 335 | if test 0 = "$FLOWBLADE_HEAD" -a "$FLOWBLADE_REVISION" ; then 336 | REVISIONS[2]="$FLOWBLADE_REVISION" 337 | fi 338 | REVISIONS[3]="" 339 | if test 0 = "$FREI0R_HEAD" -a "$FREI0R_REVISION" ; then 340 | REVISIONS[3]="$FREI0R_REVISION" 341 | fi 342 | REVISIONS[4]="" 343 | if test 0 = "$X264_HEAD" -a "$X264_REVISION" ; then 344 | REVISIONS[4]="$X264_REVISION" 345 | fi 346 | REVISIONS[5]="" 347 | if test 0 = "$LIBVPX_HEAD" -a "$LIBVPX_REVISION" ; then 348 | REVISIONS[5]="$LIBVPX_REVISION" 349 | fi 350 | REVISIONS[6]="" 351 | if test 0 = "$SWFDEC_HEAD" -a "$SWFDEC_REVISION" ; then 352 | REVISIONS[6]="$SWFDEC_REVISION" 353 | fi 354 | REVISIONS[7]="lame-3.99.5" 355 | 356 | # Figure out the install dir - we may not install, but then we know it. 357 | FINAL_INSTALL_DIR=$INSTALL_DIR 358 | if test 1 = "$AUTO_APPEND_DATE" ; then 359 | FINAL_INSTALL_DIR="$INSTALL_DIR/`date +'%Y%m%d'`" 360 | fi 361 | debug "Using install dir FINAL_INSTALL_DIR=$FINAL_INSTALL_DIR" 362 | 363 | # Figure out the number of cores in the system. Used both by make and startup script 364 | TARGET_OS="$(uname -s)" 365 | if test "$TARGET_OS" = "Darwin"; then 366 | CPUS=$(sysctl -a hw | grep "ncpu:" | cut -d ' ' -f 2) 367 | else 368 | CPUS=$(grep "processor.*:" /proc/cpuinfo | wc -l) 369 | fi 370 | # Sanity check 371 | if test 0 = $CPUS ; then 372 | CPUS=1 373 | fi 374 | MAKEJ=$(( $CPUS + 1 )) 375 | debug "Using make -j$MAKEJ for compilation" 376 | 377 | # CONFIG Array holds the ./configure (or equiv) command for each project 378 | # CFLAGS_ Array holds additional CFLAGS for the configure/make step of a given project 379 | # LDFLAGS_ Array holds additional LDFLAGS for the configure/make step of a given project 380 | 381 | ##### 382 | # ffmpeg 383 | CONFIG[0]="./configure --prefix=$FINAL_INSTALL_DIR --disable-doc --enable-gpl --enable-version3 --enable-shared --enable-debug --enable-pthreads --enable-runtime-cpudetect" 384 | if test 1 = "$FFMPEG_SUPPORT_THEORA" ; then 385 | CONFIG[0]="${CONFIG[0]} --enable-libtheora --enable-libvorbis" 386 | fi 387 | if test 1 = "$FFMPEG_SUPPORT_MP3" ; then 388 | CONFIG[0]="${CONFIG[0]} --enable-libmp3lame" 389 | fi 390 | if test 1 = "$FFMPEG_SUPPORT_FAAC" ; then 391 | CONFIG[0]="${CONFIG[0]} --enable-libfaac --enable-nonfree" 392 | fi 393 | if test 1 = "$FFMPEG_SUPPORT_H264" ; then 394 | CONFIG[0]="${CONFIG[0]} --enable-libx264" 395 | fi 396 | if test 1 = "$FFMPEG_SUPPORT_LIBVPX" ; then 397 | CONFIG[0]="${CONFIG[0]} --enable-libvpx" 398 | fi 399 | # Add optional parameters 400 | CONFIG[0]="${CONFIG[0]} $FFMPEG_ADDITIONAL_OPTIONS" 401 | CFLAGS_[0]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 402 | LDFLAGS_[0]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 403 | 404 | ##### 405 | # mlt 406 | CONFIG[1]="./configure --prefix=$FINAL_INSTALL_DIR --enable-gpl --enable-linsys --swig-languages=python" 407 | # Remember, if adding more of these, to update the post-configure check. 408 | [ "$TARGET_OS" = "Darwin" ] && CONFIG[1]="${CONFIG[1]} --disable-jackrack" 409 | if test "1" = "$MLT_DISABLE_SOX" ; then 410 | CONFIG[1]="${CONFIG[1]} --disable-sox" 411 | fi 412 | CFLAGS_[1]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 413 | # Temporary patch until makefile for MLT corrected? 414 | #CFLAGS_[1]="${CFLAGS_[1]} -I$FINAL_INSTALL_DIR/include/libavcodec/ -I$FINAL_INSTALL_DIR/include/libavformat/ -I$FINAL_INSTALL_DIR/include/libswscale/ -I$FINAL_INSTALL_DIR/include/libavdevice" 415 | LDFLAGS_[1]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 416 | # Note in the above, that we always looks for frei0r. User can do own install 417 | # it will be picked up. 418 | 419 | ##### 420 | # flowblade 421 | CONFIG[2]="" 422 | CFLAGS_[2]="" 423 | LDFLAGS_[2]="" 424 | 425 | #### 426 | # frei0r 427 | CONFIG[3]="./configure --prefix=$FINAL_INSTALL_DIR --libdir=$FINAL_INSTALL_DIR/lib" 428 | CFLAGS_[3]=$CFLAGS 429 | LDFLAGS_[3]=$LDFLAGS 430 | 431 | #### 432 | # x264 433 | CONFIG[4]="./configure --prefix=$FINAL_INSTALL_DIR --disable-lavf --disable-ffms --disable-gpac --disable-swscale --enable-shared" 434 | CFLAGS_[4]=$CFLAGS 435 | [ "$TARGET_OS" = "Darwin" ] && CFLAGS_[4]="-I. -fno-common -read_only_relocs suppress ${CFLAGS_[4]} " 436 | LDFLAGS_[4]=$LDFLAGS 437 | 438 | #### 439 | # libvpx 440 | CONFIG[5]="./configure --prefix=$FINAL_INSTALL_DIR --enable-vp8 --enable-postproc --enable-multithread --enable-runtime-cpu-detect --disable-install-docs --disable-debug-libs --disable-examples --disable-unit-tests --extra-cflags=-std=c99" 441 | [ "$TARGET_OS" = "Linux" ] && CONFIG[5]="${CONFIG[5]} --enable-shared" 442 | CFLAGS_[5]=$CFLAGS 443 | # [ "$TARGET_OS" = "Darwin" ] && CFLAGS_[5]="-I. -fno-common -read_only_relocs suppress ${CFLAGS_[5]} " 444 | LDFLAGS_[5]=$LDFLAGS 445 | 446 | ##### 447 | # swfdec 448 | CONFIG[6]="./configure --prefix=$FINAL_INSTALL_DIR --disable-gtk --disable-gstreamer" 449 | CFLAGS_[6]=$CFLAGS 450 | LDFLAGS_[6]=$LDFLAGS 451 | 452 | ##### 453 | # lame 454 | CONFIG[7]="./configure --prefix=$FINAL_INSTALL_DIR --libdir=$FINAL_INSTALL_DIR/lib --disable-decoder --disable-frontend" 455 | CFLAGS_[7]=$CFLAGS 456 | LDFLAGS_[7]=$LDFLAGS 457 | } 458 | 459 | ###################################################################### 460 | # FEEDBACK FUNCTIONS 461 | ###################################################################### 462 | 463 | ################################################################# 464 | # feedback_init 465 | # $1 : ProgressBar maximum 466 | # Resets the progressbar or textual output based on DCOPREF 467 | function feedback_init { 468 | trace "Entering feedback_init @ = $@" 469 | case $DCOPREF in 470 | none) 471 | log Total number of steps needed to complete $1 472 | log Press Ctrl+C to abort 473 | ;; 474 | kdialog*) 475 | cmd dcop $DCOPREF ProgressDialog setTotalSteps $1 || \ 476 | warn Unable to setTotalSteps on ProgressBar 477 | cmd dcop $DCOPREF ProgressDialog showCancelButton true || \ 478 | warn Unable to show Cancel button on kdialog instance 479 | ;; 480 | kmdr*) 481 | cmd dcop $DCOPREF KommanderIf setMaximum ProgressBar $1 || \ 482 | warn Unable to setMaximum on ProgressBar 483 | ;; 484 | esac 485 | PROGRESS=0 486 | feedback_set_progress $PROGRESS 487 | } 488 | 489 | ################################################################# 490 | # feedback_progress 491 | # $1 : ProgressBar position 492 | # Sets the progressbar position or textual output based on DCOPREF 493 | function feedback_set_progress { 494 | trace "Entering feedback_set_progress @ = $@" 495 | case $DCOPREF in 496 | none) 497 | log Number of steps completed : $1 498 | ;; 499 | kdialog*) 500 | cmd dcop $DCOPREF ProgressDialog setProgress $1 || \ 501 | warn Unable to setProgress on ProgressBar 502 | ;; 503 | kmdr*) 504 | cmd dcop $DCOPREF KommanderIf setText ProgressBar $1 || \ 505 | warn Unable to setProgress on ProgressBar 506 | ;; 507 | esac 508 | } 509 | 510 | ################################################################# 511 | # feedback_status 512 | # $@ status information 513 | # Displays/Appends status, based on DCOPREF 514 | function feedback_status { 515 | trace "Entering feedback_status @ = $@" 516 | # Need to collect $@ in a single variable for cmd to work 517 | ARG=$@ 518 | log "$ARG" 519 | } 520 | 521 | ################################################################# 522 | # feedback_result 523 | # $1 : SUCCESS, FAILURE, ABORTED 524 | # $2 : Additional information 525 | # Does the relevant feedback, and terminates. 526 | function feedback_result { 527 | trace "Entering feedback_result @ = $@" 528 | 529 | # If needed, kill the checker process 530 | if test "" != "$CHECKERPID" ; then 531 | # Kill the checker process 532 | kill -9 $CHECKERPID &> /dev/null 533 | fi 534 | 535 | log "Process has finished. Reason: $@" 536 | } 537 | 538 | 539 | ################################################################# 540 | # feedback_progress 541 | # $@ : Description of task completed 542 | # Increases the progressbar with 1 and sets the status to $@ 543 | function feedback_progress { 544 | trace "Entering feedback_progress @ = $@" 545 | PROGRESS=$(( $PROGRESS + 1 )) 546 | feedback_status $@ 547 | feedback_set_progress $PROGRESS 548 | } 549 | 550 | ################################################################# 551 | # prepare_feedback 552 | # Function to prepare the feedback. E.g. set up max progress steps 553 | # Based on configuration read and the DCOPREF variable 554 | function prepare_feedback { 555 | trace "Entering prepare_feedback @ = $@" 556 | # Figure out the number of steps 557 | # Get adds 8 if cleaning, 4 otherwise (2/1 pr. proj) 558 | # Compile/Install adds 12 (3/proj) 559 | # Script install adds 1 560 | NUMSTEPS=0 561 | if test 1 = "$GET" ; then 562 | debug Adding 3 steps for get 563 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 564 | if test 1 = "$ENABLE_FREI0R" ; then 565 | debug Adding 1 step for get frei0r 566 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 567 | fi 568 | if test 1 = "$ENABLE_SWFDEC" ; then 569 | debug Adding 1 step for get swfdec 570 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 571 | fi 572 | fi 573 | if test 1 = "$GET" -a 1 = "$SOURCES_CLEAN" ; then 574 | debug Adding 3 steps for clean on get 575 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 576 | if test 1 = "$ENABLE_FREI0R" ; then 577 | debug Adding 1 step for clean frei0r 578 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 579 | fi 580 | if test 1 = "$ENABLE_SWFDEC" ; then 581 | debug Adding 1 step for clean swfdec 582 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 583 | fi 584 | fi 585 | if test 1 = "$COMPILE_INSTALL" ; then 586 | debug Adding 9 steps for compile-install 587 | NUMSTEPS=$(( $NUMSTEPS + 9 )) 588 | if test 1 = "$ENABLE_FREI0R" ; then 589 | debug Adding 3 steps for compile-install frei0r 590 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 591 | fi 592 | if test 1 = "$ENABLE_SWFDEC" ; then 593 | debug Adding 3 steps for compile-install swfdec 594 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 595 | fi 596 | fi 597 | if test 1 = "$CREATE_STARTUP_SCRIPT" ; then 598 | debug Adding 1 step for script creating 599 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 600 | fi 601 | log Number of steps determined to $NUMSTEPS 602 | feedback_init $NUMSTEPS 603 | } 604 | 605 | ################################################################# 606 | # check_abort 607 | # Function that checks if the user wanted to cancel what we are doing. 608 | # returns "stop" or "cont" as appropiate 609 | function check_abort { 610 | # log "$ARG" 611 | echo 612 | } 613 | 614 | ###################################################################### 615 | # GLOBAL TEST FUNCTIONS 616 | ###################################################################### 617 | 618 | ################################################################# 619 | # is_newer_equal 620 | # Compares versions strings, and returns 1 if $1 is newer than $2 621 | # This is highly ineffective, I am sorry to say... 622 | function is_newer_equal { 623 | trace "Entering is_newer_equal @ = $@" 624 | A1=`echo $1 | cut -d. -f1` 625 | A2=`echo $1 | cut -d. -f2` 626 | A3=`echo $1 | cut -d. -f3 | sed 's/^\([0-9]\{1,3\}\).*/\1/'` 627 | B1=`echo $2 | cut -d. -f1` 628 | B2=`echo $2 | cut -d. -f2` 629 | B3=`echo $2 | cut -d. -f3 | sed 's/^\([0-9]\{1,3\}\).*/\1/'` 630 | debug "A = $A1 $A2 $A3, B = $B1 $B2 $B3" 631 | test "$A1" -gt "$B1" -o \( "$A1" = "$B1" -a "$A2" -gt "$B2" \) -o \( "$A1" = "$B1" -a "$A2" = "$B2" -a "$A3" -ge "$B3" \) 632 | } 633 | 634 | ###################################################################### 635 | # ACTION GET FUNCTIONS 636 | ###################################################################### 637 | 638 | ################################################################# 639 | # make_clean_dir 640 | # Make clean in a specific directory 641 | # $1: The directory to make clean in. 642 | # Any errors are ignored. Make clean is only called if cd success. 643 | # Assumes cwd is common parent dir 644 | function make_clean_dir { 645 | trace "Entering make_clean_dir @ = $@" 646 | log Make clean for $1 called 647 | feedback_status "Cleaning out sources for $1" 648 | cmd pushd . 649 | # Special hack for ffmpeg, it sometimes requires distclean to work. 650 | if test "FFmpeg" = "$1" ; then 651 | cmd cd $1 && cmd make distclean 652 | else 653 | cmd cd $1 && cmd make clean 654 | fi 655 | feedback_progress Cleaned up in $1 656 | cmd popd 657 | } 658 | 659 | ################################################################# 660 | # clean_dirs 661 | # Make clean in all directories 662 | function clean_dirs { 663 | trace "Entering clean_dirs @ = $@" 664 | feedback_status Cleaning out all subdirs 665 | cmd cd $SOURCE_DIR || mkdir -p $SOURCE_DIR 666 | cmd cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 667 | for DIR in $SUBDIRS ; do 668 | make_clean_dir $DIR 669 | done 670 | feedback_status Done cleaning out in source dirs 671 | } 672 | 673 | ################################################################# 674 | # get_subproject 675 | # $1 The sourcedir to get sources for 676 | # Get the sources for a single project 677 | # Assumes cwd is common parent dir 678 | # Errors abort 679 | function get_subproject { 680 | trace "Entering get_subproject @ = $@" 681 | feedback_status Getting or updating source for $1 - this could take some time 682 | cmd pushd . 683 | 684 | # Check for repository setyp 685 | REPOTYPE=`lookup REPOTYPES $1` 686 | REPOLOC=`lookup REPOLOCS $1` 687 | REVISION=`lookup REVISIONS $1` 688 | debug "REPOTYPE=$REPOTYPE, REPOLOC=$REPOLOC, REVISION=$REVISION" 689 | 690 | # Note that svn can check out to current directory, whereas git will not. Sigh. 691 | if test "git" = "$REPOTYPE" ; then 692 | # If the dir is there, check if it is a git repo 693 | if test -d "$1" ; then 694 | # Change to it 695 | cmd cd $1 || die "Unable to change to directory $1" 696 | debug "About to look for git repo" 697 | git --no-pager status 2>&1 | grep "fatal" &> /dev/null 698 | if test 0 != $? ; then 699 | # Found git repo 700 | debug "Found git repo, will update" 701 | feedback_status "Pulling git sources for $1" 702 | cmd git reset --hard || die "Unable to reset git tree for $1" 703 | cmd git checkout master || die "Unable to git checkout master" 704 | cmd git --no-pager pull $REPOLOC master || die "Unable to git pull sources for $1" 705 | cmd git checkout $REVISION || die "Unable to git checkout $REVISION" 706 | else 707 | # A dir with the expected name, but not a git repo, bailing out 708 | PWD=`pwd` 709 | die "Found a dir with the expected name $1 ($PWD), but it was not a git repo. Unable to proceed. If you have old mlt/mlt++ sources, please delete these directories, before rerunning the script." 710 | fi 711 | else 712 | # No git repo 713 | debug "No git repo, need to check out" 714 | feedback_status "Cloning git sources for $1" 715 | cmd git --no-pager clone $REPOLOC || die "Unable to git clone source for $1 from $REPOLOC" 716 | cmd cd $1 || die "Unable to change to directory $1" 717 | cmd git checkout $REVISION || die "Unable to git checkout $REVISION" 718 | fi 719 | elif test "svn" = "$REPOTYPE" ; then 720 | # Create subdir if not exist 721 | if test ! -d "$1" ; then 722 | cmd mkdir -p $1 || die "Unable to create directory $1" 723 | fi 724 | # Change to it 725 | cmd cd $1 || die "Unable to change to directory $1" 726 | FIND_STR="\(Revision\|Last\ Changed\ Date\)" 727 | debug "About to look for SVN revision info for $REPOLOC $REVISION" 728 | svn --non-interactive info | grep "$FIND_STR" 729 | if test 0 = $? ; then 730 | debug "Found existing SVN checkout" 731 | # Found svn info 732 | REPOLOCURL=`svn --non-interactive info | grep URL | awk '{print $2}'` 733 | # Now, we have to be a bit clever here, because if the user originally checked it out using 734 | # https, we can not change to http. So, we check for https in the current URL 735 | # Note, that beeing clever almost always fails at some point. But, at least we give it a try... 736 | if test "${REPOLOCURL:0:5}" = "https" ; then 737 | REPOLOC=${REPOLOC/http/https} 738 | fi 739 | feedback_status "Updating SVN sources for $1" 740 | cmd svn --non-interactive update $REVISION || die "Unable to update SVN repo in $1 to $REVISION" 741 | else 742 | # No svn info 743 | feedback_status "Getting SVN sources for $1" 744 | cmd svn --non-interactive co $REPOLOC . $REVISION || die "Unable to get SVN source for $1 from $REPOLOC $REVISION" 745 | fi 746 | elif test "http-tgz" = "$REPOTYPE" ; then 747 | if test ! -d "$1" ; then 748 | feedback_status "Downloading archive for $1" 749 | which curl > /dev/null 750 | if test 0 = $?; then 751 | cmd $(curl -L $REPOLOC | tar -xz) || die "Unable to download source for $1 from $REPOLOC" 752 | else 753 | which wget > /dev/null 754 | if test 0 = $?; then 755 | cmd $(wget -k -O - $REPOLOC | tar -xz) || die "Unable to download source for $1 from $REPOLOC" 756 | fi 757 | fi 758 | cmd mv "$REVISION" "$1" || due "Unable to rename $REVISION to $1" 759 | fi 760 | elif test "hg" = "$REPOTYPE" ; then 761 | # If the dir is there, check if it is a hg repo 762 | if test -d "$1" ; then 763 | # Change to it 764 | cmd cd $1 || die "Unable to change to directory $1" 765 | debug "About to look for hg repo" 766 | hg status 2>&1 | grep "Not a branch" &> /dev/null 767 | if test 0 != $? ; then 768 | # Found hg repo 769 | # TODO: handle REVISION 770 | debug "Found hg repo, will update" 771 | feedback_status "Pulling hg sources for $1" 772 | cmd hg fetch || die "Unable to hg pull sources for $1" 773 | cmd hg update || die "Unable to hg update sources for $1" 774 | else 775 | # A dir with the expected name, but not a hg repo, bailing out 776 | PWD=`pwd` 777 | die "Found a dir with the expected name $1 ($PWD), but it was not a hg repo. Unable to proceed. If you have old flowblade sources, please delete these directories, before rerunning the script." 778 | fi 779 | else 780 | # No hg repo 781 | debug "No hg repo, need to check out" 782 | feedback_status "Cloning hg sources for $1" 783 | cmd hg clone --quiet $REPOLOC $REVISION || die "Unable to hg branch source for $1 from $REPOLOC" 784 | cmd cd $1 || die "Unable to change to directory $1" 785 | fi 786 | fi # git/svn/hg 787 | 788 | feedback_progress Done getting or updating source for $1 789 | cmd popd 790 | } 791 | 792 | ################################################################# 793 | # get_all_sources 794 | # Gets all the sources for all subprojects 795 | function get_all_sources { 796 | trace "Entering get_all_sources @ = $@" 797 | feedback_status Getting all sources 798 | log Changing to $SOURCE_DIR 799 | cd $SOURCE_DIR || mkdir -p "$SOURCE_DIR" 800 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 801 | for DIR in $SUBDIRS ; do 802 | get_subproject $DIR 803 | done 804 | feedback_status Done getting all sources 805 | } 806 | 807 | ###################################################################### 808 | # ACTION COMPILE-INSTALL FUNCTIONS 809 | ###################################################################### 810 | 811 | ################################################################# 812 | # mlt_format_required 813 | # log a string that expresses a requirement 814 | function mlt_format_required { 815 | log 'MLTDISABLED '$1' : this is a required module. '$2'Will abort compilation.' 816 | } 817 | 818 | ################################################################# 819 | # mlt_format_optional 820 | # log a string that expresses missing an optional 821 | function mlt_format_optional { 822 | log 'MLTDISABLED '$1' : this is an optional module that provides '$2'. To enable it, try installing a package called something like '$3'.' 823 | } 824 | 825 | ################################################################# 826 | # mlt_check_configure 827 | # This is a special hack for mlt. Mlt does not allow --enable, or abort 828 | # if something is missing, so we check all the disable files. Some are 829 | # optional, some are required. We stop compilation if a required file is 830 | # missing. For optionals, we report them to the log 831 | # Oh, and it is assumed we are in the toplevel mlt source directory, when 832 | # this is called. 833 | function mlt_check_configure { 834 | trace "Entering check_mlt_configure @ = $@" 835 | cmd pushd . 836 | DODIE=0 837 | cmd cd src/modules || die "Unable to check mlt modules list" 838 | for FILE in `ls disable-* 2>/dev/null` ; do 839 | debug "Checking $FILE" 840 | case $FILE in 841 | # REQUIRED 842 | disable-core) 843 | mlt_format_required core "I have no idea why this was disabled. " 844 | DODIE=1 845 | ;; 846 | disable-avformat) 847 | mlt_format_required avformat "Did ffmpeg installation fail? " 848 | DODIE=1 849 | ;; 850 | disable-xml) 851 | mlt_format_required xml "Please install libxml2-dev. " 852 | DODIE=1 853 | ;; 854 | disable-sdl) 855 | mlt_format_required sdl "Please install libsdl1.2-dev. " 856 | DODIE=1 857 | ;; 858 | disable-qt) 859 | mlt_format_optional qt "some additional image loading support" "libqt4-dev" 860 | ;; 861 | 862 | # AUDIO 863 | disable-sox) 864 | if test "0" = "$MLT_DISABLE_SOX" ; then 865 | mlt_format_optional sox "sound effects/operations" "sox-dev" 866 | DODIE=1 867 | fi 868 | ;; 869 | disable-jackrack) 870 | mlt_format_optional jackrack "sound effects/operations" "libjack-dev" 871 | ;; 872 | disable-resample) 873 | mlt_format_optional resample "audio resampling" "libsamplerate0-dev" 874 | ;; 875 | 876 | # IMAGE 877 | disable-gtk2) 878 | mlt_format_required gtk2 "Please install libgtk2.0-dev. " 879 | ;; 880 | disable-kdenlive) 881 | mlt_format_optional kdenlive "slow motion and freeze effects" "none" 882 | ;; 883 | disable-frei0r) 884 | mlt_format_optional frei0r "plugin architecture. Several additional effects and transitions" "see http://www.piksel.org/frei0r" 885 | ;; 886 | 887 | # OTHERS 888 | disable-dv) 889 | mlt_format_optional dv "loading and saving of DV files" "libdv/libdv-dev" 890 | ;; 891 | disable-vorbis) 892 | mlt_format_optional vorbis "loading and saving ogg/theora/vorbis files" "libvorbis-dev" 893 | ;; 894 | 895 | # FALLBACK 896 | disable-*) 897 | mlt_format_optional ${FILE/disable-} "... dunno ... " "... dunno ..." 898 | ;; 899 | esac 900 | done 901 | if test 1 = "$DODIE" ; then 902 | die "One or more required MLT modules could not be enabled" 903 | fi 904 | cmd popd 905 | } 906 | 907 | ################################################################# 908 | # configure_compile_install_subproject 909 | # $1 The sourcedir to configure, compile, and install 910 | # Configures, compiles, and installs a single subproject. 911 | # Assumes cwd is common parent dir 912 | # Errors abort 913 | function configure_compile_install_subproject { 914 | trace "Entering configure_compile_install_subproject @ = $@" 915 | feedback_status Configuring, compiling, and installing $1 916 | 917 | OLDCFLAGS=$CFLAGS 918 | OLDLD_LIBRARY_PATH=$LD_LIBRARY_PATH 919 | cmd pushd . 920 | 921 | # Change to right directory 922 | cmd cd $1 || die "Unable to change to directory $1" 923 | 924 | # Set cflags, log settings 925 | log PATH=$PATH 926 | log LD_RUN_PATH=$LD_RUN_PATH 927 | log PKG_CONFIG_PATH=$PKG_CONFIG_PATH 928 | export CFLAGS=`lookup CFLAGS_ $1` 929 | log CFLAGS=$CFLAGS 930 | export LDFLAGS=`lookup LDFLAGS_ $1` 931 | log LDFLAGS=$LDFLAGS 932 | 933 | # Configure 934 | feedback_status Configuring $1 935 | # Special hack for libvpx 936 | if test "libvpx" = "$1" ; then 937 | cmd make clean 938 | fi 939 | 940 | # Special hack for frei0r 941 | if test "frei0r" = "$1" -a ! -e configure ; then 942 | debug "Need to create configure for $1" 943 | cmd ./autogen.sh || die "Unable to create configure file for $1" 944 | if test ! -e configure ; then 945 | die "Unable to confirm presence of configure file for $1" 946 | fi 947 | fi 948 | 949 | # Special hack for swfdec 950 | if test "swfdec" = "$1" ; then 951 | debug "Need to create configure for $1" 952 | cmd autoreconf -i || die "Unable to create configure file for $1" 953 | if test ! -e configure ; then 954 | die "Unable to confirm presence of configure file for $1" 955 | fi 956 | fi 957 | 958 | cmd `lookup CONFIG $1` || die "Unable to configure $1" 959 | feedback_progress Done configuring $1 960 | 961 | # Special hack for mlt, post-configure 962 | if test "mlt" = "$1" ; then 963 | mlt_check_configure 964 | fi 965 | 966 | # Compile 967 | feedback_status Building $1 - this could take some time 968 | # Special hack for flowblade 969 | if test "flowblade" != "$1" ; then 970 | cmd make -j$MAKEJ || die "Unable to build $1" 971 | fi 972 | feedback_progress Done building $1 973 | 974 | # Install 975 | feedback_status Installing $1 976 | export LD_LIBRARY_PATH=`lookup LD_LIBRARY_PATH_ $1` 977 | log "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" 978 | if test "1" = "$NEED_SUDO" ; then 979 | debug "Needs to be root to install - trying" 980 | log About to run $SUDO make install 981 | TMPNAME=`mktemp -t build-flowblade.installoutput.XXXXXXXXX` 982 | # At least kdesudo does not return an error code if the program fails 983 | # Filter output for error, and dup it to the log 984 | if test "flowblade" = "$1" ; then 985 | $SUDO cp -a flowblade-trunk "$FINAL_INSTALL_DIR" > $TMPNAME 2>&1 986 | $SUDO cp -a ../mlt/src/swig/python/{_mlt.so,mlt.py} "$FINAL_INSTALL_DIR"/flowblade-trunk 987 | else 988 | $SUDO make install > $TMPNAME 2>&1 989 | fi 990 | cat $TMPNAME 2>&1 991 | # If it contains error it returns 0. 1 matches, 255 errors 992 | # Filter X errors out too 993 | grep -v "X Error" $TMPNAME | grep -i error 2>&1 994 | if test 0 = $? ; then 995 | die "Unable to install $1" 996 | fi 997 | elif test "flowblade" = "$1" ; then 998 | cmd cp -a flowblade-trunk "$FINAL_INSTALL_DIR" || die "Unable to install $1" 999 | cmd cp -a ../mlt/src/swig/python/{_mlt.so,mlt.py} "$FINAL_INSTALL_DIR"/flowblade-trunk 1000 | else 1001 | cmd make install || die "Unable to install $1" 1002 | fi 1003 | feedback_progress Done installing $1 1004 | 1005 | # Reestablish 1006 | cmd popd 1007 | export CFLAGS=$OLDCFLAGS 1008 | export LD_LIBRARY_PATH=$OLDLD_LIBRARY_PATH 1009 | } 1010 | 1011 | 1012 | ################################################################# 1013 | # configure_compile_install_all 1014 | # Configures, compiles, and installs all subprojects 1015 | function configure_compile_install_all { 1016 | trace "Entering configure_compile_install_all @ = $@" 1017 | feedback_status Configuring, compiling and installing all sources 1018 | 1019 | # Set some more vars for this operation 1020 | log "Using install dir $FINAL_INSTALL_DIR" 1021 | log "Found $CPUS cpus. Will use make -j $MAKEJ for compilation" 1022 | 1023 | # set global settings for all jobs 1024 | export PATH="$FINAL_INSTALL_DIR/bin:$PATH" 1025 | export LD_RUN_PATH="$FINAL_INSTALL_DIR/lib" 1026 | export PKG_CONFIG_PATH="$FINAL_INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH" 1027 | 1028 | log Changing to $SOURCE_DIR 1029 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 1030 | for DIR in $SUBDIRS ; do 1031 | configure_compile_install_subproject $DIR 1032 | done 1033 | feedback_status Done configuring, compiling and installing all sources 1034 | } 1035 | 1036 | ###################################################################### 1037 | # ACTION CREATE_STARTUP_SCRIPT 1038 | ###################################################################### 1039 | 1040 | 1041 | ################################################################# 1042 | # get_dir_info 1043 | # Helper function for startup script creating - returns svn rev information 1044 | # for a given directory 1045 | function get_dir_info { 1046 | # trace "Entering get_dir_info @ = $@" 1047 | pushd . &> /dev/null 1048 | cd $1 || die "Unable to change directory to $1" 1049 | REPOTYPE=`lookup REPOTYPES $1` 1050 | if test "xgit" = "x$REPOTYPE" ; then 1051 | FIND_STR="\(commit\|Date\)" 1052 | INFO_TEXT=`git --no-pager log -n1 | grep "$FIND_STR"` 1053 | elif test "http-tgz" != "$REPOTYPE" ; then 1054 | FIND_STR="\(Revision\|Last\ Changed\ Date\)" 1055 | INFO_TEXT=`svn info | grep "$FIND_STR"` 1056 | fi 1057 | echo 1058 | echo -e $1: ${INFO_TEXT:-Warning: No $REPOTYPE information found in $SOURCE_DIR/$1.} 1059 | echo 1060 | popd &> /dev/null 1061 | } 1062 | 1063 | ################################################################# 1064 | # sys_info 1065 | # Returns some information about the system 1066 | function sys_info { 1067 | echo 1068 | echo uname -a at time of compilation: 1069 | uname -a 1070 | echo Information about cc at the time of compilation: 1071 | LANG=C cc -v 2>&1 1072 | if which dpkg ; then 1073 | echo Found dpkg - running dpkg -l to grep libc6 1074 | dpkg -l | grep libc6 1075 | else 1076 | if which rpm ; then 1077 | echo Found rpm - running rpm -qa to grep libc6 1078 | rpm -qa | grep libc 1079 | else 1080 | echo Found neither dpkg or rpm... 1081 | fi 1082 | fi 1083 | } 1084 | 1085 | ################################################################# 1086 | # create_startup_script 1087 | # Creates a startup script. Note, that the actual script gets 1088 | # embedded by the Makefile 1089 | function create_startup_script { 1090 | trace "Entering create_startup_script @ = $@" 1091 | pushd . 1092 | 1093 | log Changing to $SOURCE_DIR 1094 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 1095 | 1096 | INFO=$INFO"Information about revisions of modules at the time of compilation:" 1097 | for DIR in $SUBDIRS ; do 1098 | INFO=$INFO`get_dir_info $DIR` 1099 | done 1100 | INFO=$INFO`sys_info` 1101 | 1102 | TMPFILE=`mktemp -t build-flowblade.start.XXXXXXXXX` 1103 | log Creating startup script in $TMPFILE 1104 | cat > $TMPFILE < $TMPFILE < /dev/null 1202 | wait $1 1203 | for CP in `ps --ppid $1 -o pid=` ; do 1204 | kill_recursive $CP 1205 | done 1206 | fi 1207 | } 1208 | 1209 | ################################################################# 1210 | # keep_checking_abort 1211 | # Checks if the user indicated an abort through 1212 | function keep_checking_abort { 1213 | while test x`check_abort` = "xcont" ; do 1214 | sleep 1 1215 | done 1216 | feedback_result ABORTED "User requested abort" 1217 | # If we reach here, user aborted, kill everything in sight... 1218 | kill_recursive $MAINPID 1219 | exit 1220 | } 1221 | 1222 | ################################################################# 1223 | # main 1224 | # Collects all the steps 1225 | function main { 1226 | { 1227 | sleep 1 1228 | init_log_file 1229 | read_configuration 1230 | set_globals 1231 | } 2>&1 1232 | 1233 | # Setup abort handling 1234 | # If anyone know of a better way to get ones pid from within a subshell, let me know... 1235 | MAINPID=`/bin/bash -c "echo \\$PPID"` 1236 | # debug "Main is running with pid $MAINPID" 1237 | keep_checking_abort & 1238 | CHECKERPID=$! 1239 | # debug "Checker process is running with pid=$CHECKERPID" 1240 | 1241 | # Special case for sudo getting 1242 | SUDO="" 1243 | log "Checking for sudo requirement" 2>&1 1244 | if test "1" = "$NEED_SUDO" ; then 1245 | log "sudo is needed" 1246 | echo You have chosen to install as root. 1247 | echo 1248 | echo 'Please provide your sudo password below. (If you have recently provided your sudo password to this script, you may not have to do that, because the password is cached).' 1249 | echo 1250 | echo The password will be handled securely by the sudo program. 1251 | echo 1252 | echo If you fail to provide the password, you will have to provide it later when installing the different projects. 1253 | sudo -v 1254 | if test 0 != $? ; then 1255 | die "Unable to proceed" 1256 | fi 1257 | SUDO=sudo 1258 | fi 1259 | log "Done checking for sudo requirement" 2>&1 1260 | 1261 | { 1262 | prepare_feedback 1263 | perform_action 1264 | } 2>&1 1265 | 1266 | # All is well, that ends well 1267 | exit 0 1268 | } 1269 | 1270 | parse_args "$@" 1271 | # Call main, but if detach is given, put it in the background 1272 | if test 1 = "$DETACH"; then 1273 | main & 1274 | # Note, that we assume caller has setup stdin & stdout redirection 1275 | disown -a 1276 | else 1277 | main 1278 | fi 1279 | -------------------------------------------------------------------------------- /build/build-melt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script builds melt and many of its dependencies. 4 | # It can accept a configuration file, default: build-melt.conf 5 | 6 | # List of programs used: 7 | # bash, test, tr, awk, ps, make, cmake, cat, sed, curl or wget, and possibly others 8 | 9 | # Author: Dan Dennedy 10 | # Version: 24 11 | # License: GPL2 12 | 13 | ################################################################################ 14 | # ARGS AND GLOBALS 15 | ################################################################################ 16 | 17 | # These are all of the configuration variables with defaults 18 | INSTALL_DIR="$HOME/melt" 19 | AUTO_APPEND_DATE=1 20 | SOURCE_DIR="$INSTALL_DIR/src" 21 | ACTION_GET_COMPILE_INSTALL=1 22 | ACTION_GET_ONLY=0 23 | ACTION_COMPILE_INSTALL=1 24 | SOURCES_CLEAN=1 25 | INSTALL_AS_ROOT=0 26 | CREATE_STARTUP_SCRIPT=1 27 | BUNDLE_EXTRAS=0 28 | ENABLE_FREI0R=1 29 | FREI0R_HEAD=1 30 | FREI0R_REVISION= 31 | ENABLE_SWFDEC=0 32 | SWFDEC_HEAD= 33 | SWFDEC_REVISION= 34 | ENABLE_MOVIT=1 35 | MOVIT_HEAD=0 36 | MOVIT_REVISION="origin/shotcut-opengl3" 37 | LIBEPOXY_REVISION="v1.3.1" 38 | X264_HEAD=1 39 | X264_REVISION= 40 | X265_HEAD=1 41 | X265_REVISION= 42 | LIBVPX_HEAD=0 43 | LIBVPX_REVISION="v1.15.1" 44 | ENABLE_LAME=0 45 | FFMPEG_PROJECT="FFmpeg" 46 | FFMPEG_HEAD=0 47 | FFMPEG_REVISION="origin/release/7.1" 48 | FFMPEG_SUPPORT_H264=1 49 | FFMPEG_SUPPORT_H265=1 50 | FFMPEG_SUPPORT_LIBVPX=1 51 | FFMPEG_SUPPORT_THEORA=1 52 | FFMPEG_SUPPORT_MP3=0 53 | FFMPEG_SUPPORT_FAAC=0 54 | FFMPEG_SUPPORT_SSL=0 55 | FFMPEG_ADDITIONAL_OPTIONS= 56 | ENABLE_VIDSTAB=1 57 | VIDSTAB_HEAD=1 58 | VIDSTAB_REVISION= 59 | MLT_HEAD=1 60 | MLT_REVISION= 61 | ENABLE_WEBVFX=0 62 | WEBVFX_HEAD=1 63 | WEBVFX_REVISION= 64 | ENABLE_RUBBERBAND=1 65 | RUBBERBAND_HEAD=1 66 | RUBBERBAND_REVISION= 67 | MLT_DISABLE_SOX=0 68 | MLT_DISABLE_SDL=0 69 | MLT_SWIG_LANGUAGES="python" 70 | 71 | ################################################################################ 72 | # Location of config file - if not overriden on command line 73 | CONFIGFILE=build-melt.conf 74 | 75 | # If defined to 1, outputs trace log lines 76 | TRACE=0 77 | 78 | # If defined to 1, outputs debug log lines 79 | DEBUG=0 80 | 81 | # We need to set LANG to C to avoid e.g. svn from getting to funky 82 | export LANG=C 83 | 84 | # User CFLAGS and LDFLAGS sometimes prevent more recent local headers. 85 | # Also, you can adjust some flags here. 86 | export CFLAGS= 87 | export CXXFLAGS= 88 | export LDFLAGS= 89 | 90 | ################################################################################ 91 | # FUNCTION SECTION 92 | ################################################################################ 93 | 94 | ################################################################# 95 | # usage 96 | # Reports legal options to this script 97 | function usage { 98 | echo "Usage: $0 [-c config-file] [-t] [-h]" 99 | echo "Where:" 100 | echo -e "\t-c config-file\tDefaults to $CONFIGFILE" 101 | echo -e "\t-t\t\tSpawn into sep. process" 102 | } 103 | 104 | ################################################################# 105 | # parse_args 106 | # Parses the arguments passed in $@ and sets some global vars 107 | function parse_args { 108 | CONFIGFILEOPT="" 109 | DETACH=0 110 | while getopts ":tc:d:l:" OPT; do 111 | case $OPT in 112 | c ) CONFIGFILEOPT=$OPTARG 113 | echo Setting configfile to $CONFIGFILEOPT 114 | ;; 115 | t ) DETACH=1;; 116 | h ) usage 117 | exit 0;; 118 | * ) echo "Unknown option $OPT" 119 | usage 120 | exit 1;; 121 | esac 122 | done 123 | 124 | # Check configfile 125 | if test "$CONFIGFILEOPT" != ""; then 126 | if test ! -r "$CONFIGFILEOPT" ; then 127 | echo "Unable to read config-file $CONFIGFILEOPT" 128 | exit 1 129 | fi 130 | CONFIGFILE="$CONFIGFILEOPT" 131 | fi 132 | } 133 | ###################################################################### 134 | # DATA HANDLING FUNCTIONS 135 | ###################################################################### 136 | 137 | ################################################################# 138 | # to_key 139 | # Returns a numeric key from a known subproject 140 | # $1 : string: ffmpeg, mlt, etc. 141 | function to_key { 142 | case $1 in 143 | $FFMPEG_PROJECT) 144 | echo 0 145 | ;; 146 | mlt) 147 | echo 1 148 | ;; 149 | frei0r) 150 | echo 2 151 | ;; 152 | x264) 153 | echo 3 154 | ;; 155 | libvpx) 156 | echo 4 157 | ;; 158 | swfdec) 159 | echo 5 160 | ;; 161 | lame) 162 | echo 6 163 | ;; 164 | vid.stab) 165 | echo 7 166 | ;; 167 | movit) 168 | echo 8 169 | ;; 170 | libepoxy) 171 | echo 9 172 | ;; 173 | eigen) 174 | echo 10 175 | ;; 176 | webvfx) 177 | echo 11 178 | ;; 179 | x265) 180 | echo 12 181 | ;; 182 | rubberband) 183 | echo 13 184 | ;; 185 | *) 186 | echo UNKNOWN 187 | ;; 188 | esac 189 | } 190 | 191 | ################################################################# 192 | # lookup - lookup a value from an array and return it 193 | # $1 array name, $2 subdir name, that is, text string 194 | function lookup { 195 | eval echo "\${${1}[`to_key $2`]}" 196 | } 197 | 198 | ###################################################################### 199 | # LOG FUNCTIONS 200 | ###################################################################### 201 | 202 | ################################################################# 203 | # init_log_file 204 | # Write some init stuff 205 | function init_log_file { 206 | log `date` 207 | log $0 starting 208 | } 209 | 210 | ################################################################# 211 | # trace 212 | # Function that prints a trace line 213 | # $@ : arguments to be printed 214 | function trace { 215 | if test "1" = "$TRACE" ; then 216 | echo "TRACE: $@" 217 | fi 218 | } 219 | 220 | ################################################################# 221 | # debug 222 | # Function that prints a debug line 223 | # $@ : arguments to be printed 224 | function debug { 225 | if test "1" = "$DEBUG" ; then 226 | echo "DEBUG: $@" 227 | fi 228 | } 229 | 230 | ################################################################# 231 | # log 232 | # Function that prints a log line 233 | # $@ : arguments to be printed 234 | function log { 235 | echo "LOG: $@" 236 | } 237 | 238 | ################################################################# 239 | # log warning 240 | # Function that prints a warning line 241 | # $@ : arguments to be printed 242 | function warn { 243 | echo "WARN: $@" 244 | } 245 | 246 | ################################################################# 247 | # die 248 | # Function that prints a line and exists 249 | # $@ : arguments to be printed 250 | function die { 251 | echo "ERROR: $@" 252 | feedback_result FAILURE "Some kind of error occured: $@" 253 | exit -1 254 | } 255 | 256 | ################################################################# 257 | # cmd 258 | # Function that does a (non-background, non-outputting) command, after logging it 259 | function cmd { 260 | trace "Entering cmd @ = $@" 261 | log About to run command: "$@" 262 | "$@" 263 | } 264 | 265 | 266 | ###################################################################### 267 | # SETUP FUNCTIONS 268 | ###################################################################### 269 | 270 | ################################################################# 271 | # read_configuration 272 | # Reads $CONFIGFILE, parses it, and exports global variables reflecting the 273 | # content. Aborts, if the file does not exist or is not readable 274 | CONFIGURATION="" 275 | function read_configuration { 276 | trace "Entering read_configuration @ = $@" 277 | if test ! -r "$CONFIGFILE"; then 278 | warn "Unable to read config file $CONFIGFILE" 279 | return 280 | fi 281 | debug "Reading configuration from $CONFIGFILE" 282 | # This is for replacement in startup scripts 283 | for LINE in `tr "\t" "=" < $CONFIGFILE`; do 284 | debug Setting $LINE 285 | CONFIGURATION="$CONFIGURATION$LINE " 286 | #export $LINE || die "Invalid export line: $LINE. Unable to set configuration options from CONFIGFILE" 287 | done ||\ 288 | die "Unable to set configuration options from $CONFIGFILE" 289 | source "$CONFIGFILE" || die "Unable to evaluate configuration options from $CONFIGFILE" 290 | } 291 | 292 | ################################################################# 293 | # set_globals 294 | # Set up globals based on configuration 295 | # This is where the configuration options for each subproject is assembled 296 | function set_globals { 297 | trace "Entering set_globals @ = $@" 298 | # Set two convenience variables. 299 | if test 1 = "$ACTION_GET_ONLY" -o 1 = "$ACTION_GET_COMPILE_INSTALL" ; then 300 | GET=1 301 | else 302 | GET=0 303 | fi 304 | NEED_SUDO=0 305 | if test 1 = "$ACTION_GET_COMPILE_INSTALL" -o 1 = "$ACTION_COMPILE_INSTALL" ; then 306 | COMPILE_INSTALL=1 307 | if test 1 = $INSTALL_AS_ROOT ; then 308 | NEED_SUDO=1 309 | fi 310 | else 311 | COMPILE_INSTALL=0 312 | fi 313 | debug "GET=$GET, COMPILE_INSTALL=$COMPILE_INSTALL, NEED_SUDO=$NEED_SUDO" 314 | 315 | # The script sets CREATE_STARTUP_SCRIPT to true always, disable if not COMPILE_INSTALL 316 | if test 0 = "$COMPILE_INSTALL" ; then 317 | CREATE_STARTUP_SCRIPT=0 318 | fi 319 | debug "CREATE_STARTUP_SCRIPT=$CREATE_STARTUP_SCRIPT" 320 | 321 | # Subdirs list, for number of common operations 322 | # Note, the function to_key depends on this 323 | SUBDIRS="$FFMPEG_PROJECT mlt" 324 | if test "$ENABLE_MOVIT" = 1 && test "$MOVIT_HEAD" = 1 -o "$MOVIT_REVISION" != ""; then 325 | SUBDIRS="libepoxy eigen movit $SUBDIRS" 326 | fi 327 | if test "$ENABLE_FREI0R" = 1 ; then 328 | SUBDIRS="frei0r $SUBDIRS" 329 | fi 330 | if test "$ENABLE_SWFDEC" = 1 && test "$SWFDEC_HEAD" = 1 -o "$SWFDEC_REVISION" != ""; then 331 | SUBDIRS="swfdec $SUBDIRS" 332 | fi 333 | if test "$FFMPEG_SUPPORT_H264" = 1 && test "$X264_HEAD" = 1 -o "$X264_REVISION" != ""; then 334 | SUBDIRS="x264 $SUBDIRS" 335 | fi 336 | if test "$FFMPEG_SUPPORT_H265" = 1 && test "$X265_HEAD" = 1 -o "$X265_REVISION" != ""; then 337 | SUBDIRS="x265 $SUBDIRS" 338 | fi 339 | if test "$FFMPEG_SUPPORT_LIBVPX" = 1 && test "$LIBVPX_HEAD" = 1 -o "$LIBVPX_REVISION" != ""; then 340 | SUBDIRS="libvpx $SUBDIRS" 341 | fi 342 | if test "$FFMPEG_SUPPORT_MP3" = 1 && test "$ENABLE_LAME" = 1; then 343 | SUBDIRS="lame $SUBDIRS" 344 | fi 345 | if test "$ENABLE_VIDSTAB" = 1 ; then 346 | SUBDIRS="vid.stab $SUBDIRS" 347 | fi 348 | if test "$ENABLE_WEBVFX" = "1" && test "$WEBVFX_HEAD" = 1 -o "$WEBVFX_REVISION" != ""; then 349 | SUBDIRS="$SUBDIRS webvfx" 350 | fi 351 | if test "$ENABLE_RUBBERBAND" = 1 ; then 352 | SUBDIRS="rubberband $SUBDIRS" 353 | fi 354 | debug "SUBDIRS = $SUBDIRS" 355 | 356 | # REPOLOCS Array holds the repo urls 357 | if test "$FFMPEG_PROJECT" = "FFmpeg"; then 358 | REPOLOCS[0]="https://github.com/FFmpeg/FFmpeg.git" 359 | elif test "$FFMPEG_PROJECT" = "libav"; then 360 | REPOLOCS[0]="git://git.libav.org/libav.git" 361 | else 362 | die "Unknown FFMPEG_PROJECT ($FFMPEG_PFOJECT). Options are: FFmpeg or libav." 363 | fi 364 | REPOLOCS[1]="https://github.com/mltframework/mlt.git" 365 | REPOLOCS[2]="https://github.com/dyne/frei0r.git" 366 | REPOLOCS[3]="https://github.com/mirror/x264.git" 367 | REPOLOCS[4]="https://chromium.googlesource.com/webm/libvpx.git" 368 | REPOLOCS[5]="https://github.com/mltframework/swfdec.git" 369 | REPOLOCS[6]="https://ftp.osuosl.org/pub/blfs/conglomeration/lame/lame-3.99.5.tar.gz" 370 | REPOLOCS[7]="https://github.com/georgmartius/vid.stab.git" 371 | REPOLOCS[8]="https://github.com/ddennedy/movit.git" 372 | REPOLOCS[9]="https://github.com/anholt/libepoxy.git" 373 | REPOLOCS[10]="https://gitlab.com/libeigen/eigen.git" 374 | REPOLOCS[11]="https://github.com/mltframework/webvfx.git" 375 | REPOLOCS[12]="https://github.com/videolan/x265.git" 376 | REPOLOCS[13]="https://github.com/breakfastquay/rubberband.git" 377 | 378 | # REPOTYPE Array holds the repo types. (Yes, this might be redundant, but easy for me) 379 | REPOTYPES[0]="git" 380 | REPOTYPES[1]="git" 381 | REPOTYPES[2]="git" 382 | REPOTYPES[3]="git" 383 | REPOTYPES[4]="git" 384 | REPOTYPES[5]="git" 385 | REPOTYPES[6]="http-tgz" 386 | REPOTYPES[7]="git" 387 | REPOTYPES[8]="git" 388 | REPOTYPES[9]="git" 389 | REPOTYPES[10]="git" 390 | REPOTYPES[11]="git" 391 | REPOTYPES[12]="git" 392 | REPOTYPES[13]="git" 393 | 394 | # And, set up the revisions 395 | REVISIONS[0]="" 396 | if test 0 = "$FFMPEG_HEAD" -a "$FFMPEG_REVISION" ; then 397 | REVISIONS[0]="$FFMPEG_REVISION" 398 | fi 399 | # Git, just use blank or the hash. 400 | REVISIONS[1]="" 401 | if test 0 = "$MLT_HEAD" -a "$MLT_REVISION" ; then 402 | REVISIONS[1]="$MLT_REVISION" 403 | fi 404 | REVISIONS[2]="" 405 | if test 0 = "$FREI0R_HEAD" -a "$FREI0R_REVISION" ; then 406 | REVISIONS[2]="$FREI0R_REVISION" 407 | fi 408 | REVISIONS[3]="" 409 | if test 0 = "$X264_HEAD" -a "$X264_REVISION" ; then 410 | REVISIONS[3]="$X264_REVISION" 411 | fi 412 | REVISIONS[4]="" 413 | if test 0 = "$LIBVPX_HEAD" -a "$LIBVPX_REVISION" ; then 414 | REVISIONS[4]="$LIBVPX_REVISION" 415 | fi 416 | REVISIONS[5]="" 417 | if test 0 = "$SWFDEC_HEAD" -a "$SWFDEC_REVISION" ; then 418 | REVISIONS[5]="$SWFDEC_REVISION" 419 | fi 420 | REVISIONS[6]="lame-3.99.5" 421 | REVISIONS[7]="" 422 | if test 0 = "$VIDSTAB_HEAD" -a "$VIDSTAB_REVISION" ; then 423 | REVISIONS[7]="$VIDSTAB_REVISION" 424 | fi 425 | REVISIONS[8]="" 426 | if test 0 = "$MOVIT_HEAD" -a "$MOVIT_REVISION" ; then 427 | REVISIONS[8]="$MOVIT_REVISION" 428 | fi 429 | REVISIONS[9]="" 430 | if test "$LIBEPOXY_REVISION" ; then 431 | REVISIONS[9]="$LIBEPOXY_REVISION" 432 | fi 433 | REVISIONS[10]="3.2.4" 434 | REVISIONS[11]="" 435 | if test 0 = "$WEBVFX_HEAD" -a "$WEBVFX_REVISION" ; then 436 | REVISIONS[11]="$WEBVFX_REVISION" 437 | fi 438 | REVISIONS[12]="" 439 | if test 0 = "$X265_HEAD" -a "$X265_REVISION" ; then 440 | REVISIONS[12]="$X265_REVISION" 441 | fi 442 | REVISIONS[13]="" 443 | if test 0 = "$RUBBERBAND_HEAD" -a "$RUBBERBAND_REVISION" ; then 444 | REVISIONS[13]="$RUBBERBAND_REVISION" 445 | fi 446 | 447 | # Figure out the install dir - we may not install, but then we know it. 448 | FINAL_INSTALL_DIR=$INSTALL_DIR 449 | if test 1 = "$AUTO_APPEND_DATE" ; then 450 | FINAL_INSTALL_DIR="$INSTALL_DIR/`date +'%Y%m%d'`" 451 | fi 452 | debug "Using install dir FINAL_INSTALL_DIR=$FINAL_INSTALL_DIR" 453 | 454 | # Figure out the number of cores in the system. Used both by make and startup script 455 | [ "$TARGET_ARCH" = "" ] && TARGET_ARCH="$(uname -m)" 456 | [ "$TARGET_OS" = "" ] && TARGET_OS="$(uname -s)" 457 | if test "$TARGET_OS" = "Darwin"; then 458 | CPUS=$(sysctl -a hw | grep "ncpu:" | cut -d ' ' -f 2) 459 | else 460 | CPUS=$(grep "processor.*:" /proc/cpuinfo | wc -l) 461 | fi 462 | # Sanity check 463 | if test 0 = $CPUS ; then 464 | CPUS=1 465 | fi 466 | MAKEJ=$(( $CPUS + 1 )) 467 | debug "Using make -j$MAKEJ for compilation" 468 | 469 | # CONFIG Array holds the ./configure (or equiv) command for each project 470 | # CFLAGS_ Array holds additional CFLAGS for the configure/make step of a given project 471 | # LDFLAGS_ Array holds additional LDFLAGS for the configure/make step of a given project 472 | 473 | ##### 474 | # ffmpeg 475 | CONFIG[0]="./configure --prefix=$FINAL_INSTALL_DIR --enable-gpl --enable-version3 --enable-shared --enable-debug --enable-pthreads --enable-runtime-cpudetect" 476 | 477 | if [[ "$FFMPEG_REVISION" != *"0.5" ]]; then 478 | CONFIG[0]="${CONFIG[0]} --disable-doc" 479 | fi 480 | if test 1 = "$FFMPEG_SUPPORT_THEORA" ; then 481 | CONFIG[0]="${CONFIG[0]} --enable-libtheora --enable-libvorbis" 482 | fi 483 | if test 1 = "$FFMPEG_SUPPORT_MP3" ; then 484 | CONFIG[0]="${CONFIG[0]} --enable-libmp3lame" 485 | fi 486 | if test 1 = "$FFMPEG_SUPPORT_FAAC" ; then 487 | CONFIG[0]="${CONFIG[0]} --enable-libfaac --enable-nonfree" 488 | fi 489 | if test 1 = "$FFMPEG_SUPPORT_H264" ; then 490 | CONFIG[0]="${CONFIG[0]} --enable-libx264" 491 | fi 492 | if test 1 = "$FFMPEG_SUPPORT_H265" ; then 493 | CONFIG[0]="${CONFIG[0]} --enable-libx265" 494 | fi 495 | if test 1 = "$FFMPEG_SUPPORT_LIBVPX" ; then 496 | case "$FFMPEG_REVISION" in 497 | *0.5) die "libvpx not supported in ffmpeg/libav 0.5 - set FFMPEG_SUPPORT_LIBVPX=0" ;; 498 | *) CONFIG[0]="${CONFIG[0]} --enable-libvpx" ;; 499 | esac 500 | fi 501 | if test 1 = "$FFMPEG_SUPPORT_SSL" ; then 502 | CONFIG[0]="${CONFIG[0]} --enable-openssl --enable-nonfree" 503 | fi 504 | # Add optional parameters 505 | CONFIG[0]="${CONFIG[0]} $FFMPEG_ADDITIONAL_OPTIONS" 506 | CFLAGS_[0]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 507 | LDFLAGS_[0]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 508 | if test "$TARGET_OS" = "Darwin" ; then 509 | CFLAGS_[0]="${CFLAGS_[0]} -I/opt/local/include" 510 | LDFLAGS_[0]="${LDFLAGS_[0]} -L/opt/local/lib" 511 | fi 512 | 513 | ##### 514 | # mlt 515 | CONFIG[1]="cmake -GNinja -DCMAKE_INSTALL_PREFIX=$FINAL_INSTALL_DIR -DCMAKE_PREFIX_PATH=$QTDIR -DGPL=ON -DGPL3=ON -DMOD_QT=OFF -DMOD_QT6=ON -DMOD_GLAXNIMATE_QT6=ON ." 516 | # Remember, if adding more of these, to update the post-configure check. 517 | [ "$MLT_SWIG_LANGUAGES" ] && CONFIG[1]="${CONFIG[1]} -DSWIG_PYTHON=ON" 518 | if test "1" != "$ENABLE_MOVIT" ; then 519 | CONFIG[1]="${CONFIG[1]} -DMOD_MOVIT=OFF" 520 | fi 521 | if test "1" = "$MLT_DISABLE_SOX" ; then 522 | CONFIG[1]="${CONFIG[1]} -DMOD_SOX=OFF" 523 | fi 524 | CFLAGS_[1]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 525 | if test "1" = "$MLT_DISABLE_SDL" ; then 526 | CONFIG[1]="${CONFIG[1]} -DMOD_SDL1=OFF -DMOD_SDL2=OFF" 527 | CFLAGS_[1]="${CFLAGS_[1]} -DMELT_NOSDL" 528 | fi 529 | LDFLAGS_[1]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 530 | if test "$TARGET_OS" = "Darwin" ; then 531 | CFLAGS_[1]="${CFLAGS_[1]} -I/opt/local/include" 532 | LDFLAGS_[1]="${LDFLAGS_[1]} -L/opt/local/lib" 533 | fi 534 | 535 | #### 536 | # frei0r 537 | CONFIG[2]="cmake -GNinja -DCMAKE_INSTALL_PREFIX=$FINAL_INSTALL_DIR -DWITHOUT_GAVL=1 -DWITHOUT_OPENCV=1 $CMAKE_DEBUG_FLAG" 538 | CFLAGS_[2]=$CFLAGS 539 | LDFLAGS_[2]=$LDFLAGS 540 | 541 | #### 542 | # x264 543 | CONFIG[3]="./configure --prefix=$FINAL_INSTALL_DIR --disable-lavf --disable-ffms --disable-gpac --disable-swscale --enable-shared" 544 | CFLAGS_[3]=$CFLAGS 545 | [ "$TARGET_OS" = "Darwin" ] && CFLAGS_[3]="-I. -fno-common -read_only_relocs suppress ${CFLAGS_[3]} " 546 | LDFLAGS_[3]=$LDFLAGS 547 | 548 | #### 549 | # libvpx 550 | CONFIG[4]="./configure --prefix=$FINAL_INSTALL_DIR --enable-vp8 --enable-postproc --enable-multithread --disable-install-docs --disable-debug-libs --disable-examples --disable-unit-tests --extra-cflags=-std=c99" 551 | [ "$TARGET_ARCH" != "arm64" ] && CONFIG[4]="${CONFIG[4]} --enable-runtime-cpu-detect" 552 | [ "$TARGET_OS" = "Darwin" ] && CONFIG[4]="${CONFIG[4]} --disable-avx512" 553 | [ "$TARGET_OS" = "Linux" ] && CONFIG[4]="${CONFIG[4]} --enable-shared" 554 | CFLAGS_[4]=$CFLAGS 555 | LDFLAGS_[4]=$LDFLAGS 556 | 557 | ##### 558 | # swfdec 559 | CONFIG[5]="./configure --prefix=$FINAL_INSTALL_DIR --disable-gtk --disable-gstreamer" 560 | CFLAGS_[5]=$CFLAGS 561 | LDFLAGS_[5]=$LDFLAGS 562 | 563 | ##### 564 | # lame 565 | CONFIG[6]="./configure --prefix=$FINAL_INSTALL_DIR --libdir=$FINAL_INSTALL_DIR/lib --disable-decoder --disable-frontend" 566 | CFLAGS_[6]=$CFLAGS 567 | LDFLAGS_[6]=$LDFLAGS 568 | 569 | #### 570 | # vid.stab 571 | CONFIG[7]="cmake -DCMAKE_INSTALL_PREFIX:PATH=$FINAL_INSTALL_DIR" 572 | if test "$TARGET_OS" = "Darwin" ; then 573 | CONFIG[7]="${CONFIG[7]} -DUSE_OMP=OFF" 574 | fi 575 | CFLAGS_[7]=$CFLAGS 576 | LDFLAGS_[7]=$LDFLAGS 577 | 578 | ##### 579 | # movit 580 | CONFIG[8]="./autogen.sh --prefix=$FINAL_INSTALL_DIR" 581 | if test "$TARGET_OS" = "Win32" ; then 582 | CONFIG[8]="${CONFIG[8]} --host=x86-w64-mingw32" 583 | CFLAGS_[8]="$CFLAGS" 584 | elif test "$TARGET_OS" = "Darwin"; then 585 | CFLAGS_[8]="$CFLAGS -I/opt/local/include" 586 | else 587 | CFLAGS_[8]="$CFLAGS" 588 | fi 589 | CFLAGS_[8]="-I../eigen ${CFLAGS_[8]}" 590 | LDFLAGS_[8]=$LDFLAGS 591 | 592 | ##### 593 | # libepoxy 594 | CONFIG[9]="./autogen.sh --prefix=$FINAL_INSTALL_DIR" 595 | if test "$TARGET_OS" = "Win32" ; then 596 | CONFIG[9]="${CONFIG[9]} --host=x86-w64-mingw32" 597 | CFLAGS_[9]="$CFLAGS" 598 | elif test "$TARGET_OS" = "Darwin"; then 599 | CFLAGS_[9]="$CFLAGS -I/opt/local/include" 600 | else 601 | CFLAGS_[9]="$CFLAGS" 602 | fi 603 | LDFLAGS_[9]=$LDFLAGS 604 | 605 | ####### 606 | # eigen - no build required 607 | CONFIG[10]="" 608 | 609 | ##### 610 | # WebVfx 611 | if [ "$TARGET_OS" = "Darwin" ]; then 612 | if [ "$QTDIR" = "" ]; then 613 | CONFIG[11]="qmake -r -spec macx-g++ MLT_PREFIX=$FINAL_INSTALL_DIR" 614 | else 615 | CONFIG[11]="$QTDIR/bin/qmake -r -spec macx-g++ MLT_PREFIX=$FINAL_INSTALL_DIR" 616 | fi 617 | elif [ "$TARGET_OS" = "Win32" -o "$TARGET_OS" = "Win64" ]; then 618 | CONFIG[11]="$QMAKE -r -spec mkspecs/mingw LIBS+=-L${QTDIR}/lib INCLUDEPATH+=$FINAL_INSTALL_DIR/include" 619 | else 620 | if [ "$QTDIR" = "" ]; then 621 | CONFIG[11]="qmake -r" 622 | else 623 | CONFIG[11]="$QTDIR/bin/qmake -r" 624 | fi 625 | fi 626 | CONFIG[11]="${CONFIG[11]} PREFIX=$FINAL_INSTALL_DIR MLT_SOURCE=$SOURCE_DIR/mlt" 627 | CFLAGS_[11]=$CFLAGS 628 | LDFLAGS_[11]=$LDFLAGS 629 | 630 | ###### 631 | # x265 632 | CFLAGS_[12]=$CFLAGS 633 | if test "$TARGET_OS" = "Win32" -o "$TARGET_OS" = "Win64" ; then 634 | CONFIG[12]="cmake -GNinja -DCMAKE_INSTALL_PREFIX=$FINAL_INSTALL_DIR -DCMAKE_TOOLCHAIN_FILE=my.cmake -DENABLE_CLI=OFF" 635 | else 636 | CONFIG[12]="cmake -GNinja -DCMAKE_INSTALL_PREFIX=$FINAL_INSTALL_DIR -DENABLE_CLI=OFF" 637 | fi 638 | LDFLAGS_[12]=$LDFLAGS 639 | 640 | ##### 641 | # rubberband 642 | CONFIG[13]="meson setup builddir --prefix=$FINAL_INSTALL_DIR --libdir=$FINAL_INSTALL_DIR/lib" 643 | CFLAGS_[13]=$CFLAGS 644 | LDFLAGS_[13]=$LDFLAGS 645 | } 646 | 647 | ###################################################################### 648 | # FEEDBACK FUNCTIONS 649 | ###################################################################### 650 | 651 | ################################################################# 652 | # feedback_init 653 | # $1 : ProgressBar maximum 654 | # Resets the progressbar or textual output based on DCOPREF 655 | function feedback_init { 656 | trace "Entering feedback_init @ = $@" 657 | case $DCOPREF in 658 | none) 659 | log Total number of steps needed to complete $1 660 | log Press Ctrl+C to abort 661 | ;; 662 | kdialog*) 663 | cmd dcop $DCOPREF ProgressDialog setTotalSteps $1 || \ 664 | warn Unable to setTotalSteps on ProgressBar 665 | cmd dcop $DCOPREF ProgressDialog showCancelButton true || \ 666 | warn Unable to show Cancel button on kdialog instance 667 | ;; 668 | kmdr*) 669 | cmd dcop $DCOPREF KommanderIf setMaximum ProgressBar $1 || \ 670 | warn Unable to setMaximum on ProgressBar 671 | ;; 672 | esac 673 | PROGRESS=0 674 | feedback_set_progress $PROGRESS 675 | } 676 | 677 | ################################################################# 678 | # feedback_progress 679 | # $1 : ProgressBar position 680 | # Sets the progressbar position or textual output based on DCOPREF 681 | function feedback_set_progress { 682 | trace "Entering feedback_set_progress @ = $@" 683 | case $DCOPREF in 684 | none) 685 | log Number of steps completed : $1 686 | ;; 687 | kdialog*) 688 | cmd dcop $DCOPREF ProgressDialog setProgress $1 || \ 689 | warn Unable to setProgress on ProgressBar 690 | ;; 691 | kmdr*) 692 | cmd dcop $DCOPREF KommanderIf setText ProgressBar $1 || \ 693 | warn Unable to setProgress on ProgressBar 694 | ;; 695 | esac 696 | } 697 | 698 | ################################################################# 699 | # feedback_status 700 | # $@ status information 701 | # Displays/Appends status, based on DCOPREF 702 | function feedback_status { 703 | trace "Entering feedback_status @ = $@" 704 | # Need to collect $@ in a single variable for cmd to work 705 | ARG=$@ 706 | log "$ARG" 707 | } 708 | 709 | ################################################################# 710 | # feedback_result 711 | # $1 : SUCCESS, FAILURE, ABORTED 712 | # $2 : Additional information 713 | # Does the relevant feedback, and terminates. 714 | function feedback_result { 715 | trace "Entering feedback_result @ = $@" 716 | 717 | # If needed, kill the checker process 718 | if test "" != "$CHECKERPID" ; then 719 | # Kill the checker process 720 | kill -9 $CHECKERPID &> /dev/null 721 | fi 722 | 723 | log "Process has finished. Reason: $@" 724 | } 725 | 726 | 727 | ################################################################# 728 | # feedback_progress 729 | # $@ : Description of task completed 730 | # Increases the progressbar with 1 and sets the status to $@ 731 | function feedback_progress { 732 | trace "Entering feedback_progress @ = $@" 733 | PROGRESS=$(( $PROGRESS + 1 )) 734 | feedback_status $@ 735 | feedback_set_progress $PROGRESS 736 | } 737 | 738 | ################################################################# 739 | # prepare_feedback 740 | # Function to prepare the feedback. E.g. set up max progress steps 741 | # Based on configuration read and the DCOPREF variable 742 | function prepare_feedback { 743 | trace "Entering prepare_feedback @ = $@" 744 | # Figure out the number of steps 745 | # Get adds 8 if cleaning, 4 otherwise (2/1 pr. proj) 746 | # Compile/Install adds 12 (3/proj) 747 | # Script install adds 1 748 | NUMSTEPS=0 749 | if test 1 = "$GET" ; then 750 | debug Adding 3 steps for get 751 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 752 | if test 1 = "$ENABLE_FREI0R" ; then 753 | debug Adding 1 step for get frei0r 754 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 755 | fi 756 | if test 1 = "$ENABLE_MOVIT" ; then 757 | debug Adding 3 steps for get movit, libepoxy, and eigen 758 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 759 | fi 760 | if test 1 = "$ENABLE_SWFDEC" ; then 761 | debug Adding 1 step for get swfdec 762 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 763 | fi 764 | if test 1 = "$ENABLE_WEBVFX" ; then 765 | debug Adding 1 step for get webvfx 766 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 767 | fi 768 | fi 769 | if test 1 = "$GET" -a 1 = "$SOURCES_CLEAN" ; then 770 | debug Adding 3 steps for clean on get 771 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 772 | if test 1 = "$ENABLE_FREI0R" ; then 773 | debug Adding 1 step for clean frei0r 774 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 775 | fi 776 | if test 1 = "$ENABLE_MOVIT" ; then 777 | debug Adding 3 steps for clean movit, libepoxy, and eigen 778 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 779 | fi 780 | if test 1 = "$ENABLE_SWFDEC" ; then 781 | debug Adding 1 step for clean swfdec 782 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 783 | fi 784 | if test 1 = "$ENABLE_WEBVFX" ; then 785 | debug Adding 1 step for clean webvfx 786 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 787 | fi 788 | fi 789 | if test 1 = "$COMPILE_INSTALL" ; then 790 | debug Adding 9 steps for compile-install 791 | NUMSTEPS=$(( $NUMSTEPS + 9 )) 792 | if test 1 = "$ENABLE_FREI0R" ; then 793 | debug Adding 3 steps for compile-install frei0r 794 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 795 | fi 796 | if test 1 = "$ENABLE_MOVIT" ; then 797 | debug Adding 9 steps for compile-install movit, libepoxy, and eigen 798 | NUMSTEPS=$(( $NUMSTEPS + 9 )) 799 | fi 800 | if test 1 = "$ENABLE_SWFDEC" ; then 801 | debug Adding 3 steps for compile-install swfdec 802 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 803 | fi 804 | if test 1 = "$ENABLE_WEBVFX" ; then 805 | debug Adding 3 steps for compile-install webvfx 806 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 807 | fi 808 | fi 809 | if test 1 = "$CREATE_STARTUP_SCRIPT" ; then 810 | debug Adding 1 step for script creating 811 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 812 | fi 813 | log Number of steps determined to $NUMSTEPS 814 | feedback_init $NUMSTEPS 815 | } 816 | 817 | ################################################################# 818 | # check_abort 819 | # Function that checks if the user wanted to cancel what we are doing. 820 | # returns "stop" or "cont" as appropiate 821 | function check_abort { 822 | # log "$ARG" 823 | echo 824 | } 825 | 826 | ###################################################################### 827 | # GLOBAL TEST FUNCTIONS 828 | ###################################################################### 829 | 830 | ################################################################# 831 | # is_newer_equal 832 | # Compares versions strings, and returns 1 if $1 is newer than $2 833 | # This is highly ineffective, I am sorry to say... 834 | function is_newer_equal { 835 | trace "Entering is_newer_equal @ = $@" 836 | A1=`echo $1 | cut -d. -f1` 837 | A2=`echo $1 | cut -d. -f2` 838 | A3=`echo $1 | cut -d. -f3 | sed 's/^\([0-9]\{1,3\}\).*/\1/'` 839 | B1=`echo $2 | cut -d. -f1` 840 | B2=`echo $2 | cut -d. -f2` 841 | B3=`echo $2 | cut -d. -f3 | sed 's/^\([0-9]\{1,3\}\).*/\1/'` 842 | debug "A = $A1 $A2 $A3, B = $B1 $B2 $B3" 843 | test "$A1" -gt "$B1" -o \( "$A1" = "$B1" -a "$A2" -gt "$B2" \) -o \( "$A1" = "$B1" -a "$A2" = "$B2" -a "$A3" -ge "$B3" \) 844 | } 845 | 846 | ###################################################################### 847 | # ACTION GET FUNCTIONS 848 | ###################################################################### 849 | 850 | ################################################################# 851 | # make_clean_dir 852 | # Make clean in a specific directory 853 | # $1: The directory to make clean in. 854 | # Any errors are ignored. Make clean is only called if cd success. 855 | # Assumes cwd is common parent dir 856 | function make_clean_dir { 857 | trace "Entering make_clean_dir @ = $@" 858 | log Make clean for $1 called 859 | feedback_status "Cleaning out sources for $1" 860 | cmd pushd . 861 | # Special hack for ffmpeg, it sometimes requires distclean to work. 862 | if test "$FFMPEG_PROJECT" = "$1" ; then 863 | cmd cd $1 && cmd make distclean 864 | else 865 | cmd cd $1 && cmd make clean 866 | fi 867 | feedback_progress Cleaned up in $1 868 | cmd popd 869 | } 870 | 871 | ################################################################# 872 | # clean_dirs 873 | # Make clean in all directories 874 | function clean_dirs { 875 | trace "Entering clean_dirs @ = $@" 876 | feedback_status Cleaning out all subdirs 877 | cmd cd $SOURCE_DIR || mkdir -p $SOURCE_DIR 878 | cmd cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 879 | for DIR in $SUBDIRS ; do 880 | make_clean_dir $DIR 881 | done 882 | feedback_status Done cleaning out in source dirs 883 | } 884 | 885 | ################################################################# 886 | # get_subproject 887 | # $1 The sourcedir to get sources for 888 | # Get the sources for a single project 889 | # Assumes cwd is common parent dir 890 | # Errors abort 891 | function get_subproject { 892 | trace "Entering get_subproject @ = $@" 893 | feedback_status Getting or updating source for $1 - this could take some time 894 | cmd pushd . 895 | 896 | # Check for repository setyp 897 | REPOTYPE=`lookup REPOTYPES $1` 898 | REPOLOC=`lookup REPOLOCS $1` 899 | REVISION=`lookup REVISIONS $1` 900 | debug "REPOTYPE=$REPOTYPE, REPOLOC=$REPOLOC, REVISION=$REVISION" 901 | 902 | # Note that svn can check out to current directory, whereas git will not. Sigh. 903 | if test "git" = "$REPOTYPE" ; then 904 | # If the dir is there, check if it is a git repo 905 | if test -d "$1" ; then 906 | # Change to it 907 | cmd cd $1 || die "Unable to change to directory $1" 908 | debug "About to look for git repo" 909 | git --no-pager status 2>&1 | grep "fatal" &> /dev/null 910 | if test 0 != $? ; then 911 | # Found git repo 912 | debug "Found git repo, will update" 913 | feedback_status "Pulling git sources for $1" 914 | cmd git reset --hard || die "Unable to reset git tree for $1" 915 | if [ "$1" = "rubberband" ]; then 916 | MAIN_GIT_BRANCH=default 917 | elif [ "$1" = "libvpx" ]; then 918 | MAIN_GIT_BRANCH=main 919 | else 920 | MAIN_GIT_BRANCH=master 921 | fi 922 | cmd git checkout $MAIN_GIT_BRANCH || die "Unable to git checkout $MAIN_GIT_BRANCH" 923 | cmd git --no-pager pull $REPOLOC $MAIN_GIT_BRANCH || die "Unable to git pull sources for $1" 924 | cmd git checkout $REVISION || die "Unable to git checkout $REVISION" 925 | else 926 | # A dir with the expected name, but not a git repo, bailing out 927 | PWD=`pwd` 928 | die "Found a dir with the expected name $1 ($PWD), but it was not a git repo. Unable to proceed. If you have old mlt/mlt++ sources, please delete these directories, before rerunning the script." 929 | fi 930 | else 931 | # No git repo 932 | debug "No git repo, need to check out" 933 | feedback_status "Cloning git sources for $1" 934 | cmd git --no-pager clone --recurse-submodules $REPOLOC || die "Unable to git clone source for $1 from $REPOLOC" 935 | cmd cd $1 || die "Unable to change to directory $1" 936 | cmd git checkout --recurse-submodules $REVISION || die "Unable to git checkout $REVISION" 937 | fi 938 | elif test "svn" = "$REPOTYPE" ; then 939 | # Create subdir if not exist 940 | if test ! -d "$1" ; then 941 | cmd mkdir -p $1 || die "Unable to create directory $1" 942 | fi 943 | # Change to it 944 | cmd cd $1 || die "Unable to change to directory $1" 945 | FIND_STR="\(Revision\|Last\ Changed\ Date\)" 946 | debug "About to look for SVN revision info for $REPOLOC $REVISION" 947 | svn --non-interactive info | grep "$FIND_STR" 948 | if test 0 = $? ; then 949 | debug "Found existing SVN checkout" 950 | # Found svn info 951 | # For KDENLIVE: If the svn info URL matches the one we have in the REPOLOCS array, do an update, otherwise, do a switch. 952 | REPOLOCURL=`svn --non-interactive info | grep URL | awk '{print $2}'` 953 | # Now, we have to be a bit clever here, because if the user originally checked it out using 954 | # https, we can not change to http. So, we check for https in the current URL 955 | # Note, that beeing clever almost always fails at some point. But, at least we give it a try... 956 | if test "${REPOLOCURL:0:5}" = "https" ; then 957 | REPOLOC=${REPOLOC/http/https} 958 | fi 959 | if test "kdenlive" = "$1" -a $REPOLOCURL != $REPOLOC ; then 960 | warn "Existing url $REPOLOCURL for $1 does not match the url for selected version: $REPOLOC. Trying svn switch to update" 961 | feedback_status "Trying to switch repo url for $1" 962 | cmd svn --non-interactive switch $REPOLOC $REVISION || die "Unable to switch svn repo from $REPOLOCURL to $REPOLOC $REVISION" 963 | else 964 | feedback_status "Updating SVN sources for $1" 965 | cmd svn --non-interactive update $REVISION || die "Unable to update SVN repo in $1 to $REVISION" 966 | fi 967 | else 968 | # No svn info 969 | feedback_status "Getting SVN sources for $1" 970 | cmd svn --non-interactive co $REPOLOC . $REVISION || die "Unable to get SVN source for $1 from $REPOLOC $REVISION" 971 | fi 972 | elif test "http-tgz" = "$REPOTYPE" ; then 973 | if test ! -d "$1" ; then 974 | feedback_status "Downloading archive for $1" 975 | which curl > /dev/null 976 | if test 0 = $?; then 977 | cmd $(curl -L $REPOLOC | tar -xz) || die "Unable to download source for $1 from $REPOLOC" 978 | else 979 | which wget > /dev/null 980 | if test 0 = $?; then 981 | cmd $(wget -O - $REPOLOC | tar -xz) || die "Unable to download source for $1 from $REPOLOC" 982 | fi 983 | fi 984 | cmd mv "$REVISION" "$1" || due "Unable to rename $REVISION to $1" 985 | fi 986 | fi # git/svn 987 | 988 | feedback_progress Done getting or updating source for $1 989 | cmd popd 990 | } 991 | 992 | ################################################################# 993 | # get_all_sources 994 | # Gets all the sources for all subprojects 995 | function get_all_sources { 996 | trace "Entering get_all_sources @ = $@" 997 | feedback_status Getting all sources 998 | log Changing to $SOURCE_DIR 999 | cd $SOURCE_DIR || mkdir -p "$SOURCE_DIR" 1000 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 1001 | for DIR in $SUBDIRS ; do 1002 | get_subproject $DIR 1003 | done 1004 | feedback_status Done getting all sources 1005 | } 1006 | 1007 | ###################################################################### 1008 | # ACTION COMPILE-INSTALL FUNCTIONS 1009 | ###################################################################### 1010 | 1011 | ################################################################# 1012 | # mlt_format_required 1013 | # log a string that expresses a requirement 1014 | function mlt_format_required { 1015 | log 'MLTDISABLED '$1' : this is a required module. '$2'Will abort compilation.' 1016 | } 1017 | 1018 | ################################################################# 1019 | # mlt_format_optional 1020 | # log a string that expresses missing an optional 1021 | function mlt_format_optional { 1022 | log 'MLTDISABLED '$1' : this is an optional module that provides '$2'. To enable it, try installing a package called something like '$3'.' 1023 | } 1024 | 1025 | ################################################################# 1026 | # mlt_check_configure 1027 | # This is a special hack for mlt. Mlt does not allow --enable, or abort 1028 | # if something is missing, so we check all the disable files. Some are 1029 | # optional, some are required. We stop compilation if a required file is 1030 | # missing. For optionals, we report them to the log 1031 | # Oh, and it is assumed we are in the toplevel mlt source directory, when 1032 | # this is called. 1033 | function mlt_check_configure { 1034 | trace "Entering check_mlt_configure @ = $@" 1035 | cmd pushd . 1036 | DODIE=0 1037 | cmd cd src/modules || die "Unable to check mlt modules list" 1038 | for FILE in `ls disable-* 2>/dev/null` ; do 1039 | debug "Checking $FILE" 1040 | case $FILE in 1041 | # REQUIRED 1042 | disable-core) 1043 | mlt_format_required core "I have no idea why this was disabled. " 1044 | DODIE=1 1045 | ;; 1046 | disable-avformat) 1047 | mlt_format_required avformat "Did ffmpeg installation fail? " 1048 | DODIE=1 1049 | ;; 1050 | disable-xml) 1051 | mlt_format_required xml "Please install libxml2-dev. " 1052 | DODIE=1 1053 | ;; 1054 | disable-sdl2) 1055 | if test "0" = "$MLT_DISABLE_SDL" ; then 1056 | mlt_format_required sdl2 "Please install libsdl2-dev. " 1057 | DODIE=1 1058 | fi 1059 | ;; 1060 | disable-qt) 1061 | mlt_format_required qt "Please provide paths for QT on the 'Compile options' page. " 1062 | DODIE=1 1063 | ;; 1064 | 1065 | # AUDIO 1066 | disable-sox) 1067 | if test "0" = "$MLT_DISABLE_SOX" ; then 1068 | mlt_format_optional sox "sound effects/operations" "sox-dev" 1069 | fi 1070 | ;; 1071 | disable-jackrack) 1072 | mlt_format_optional jackrack "sound effects/operations" "libjack-dev" 1073 | ;; 1074 | disable-resample) 1075 | mlt_format_optional resample "audio resampling" "libsamplerate0-dev" 1076 | ;; 1077 | 1078 | # IMAGE 1079 | disable-gtk2) 1080 | mlt_format_optional gtk2 "some additional image loading support" "libgtk2-dev?" 1081 | ;; 1082 | disable-kdenlive) 1083 | mlt_format_optional kdenlive "slow motion and freeze effects" "??" 1084 | ;; 1085 | disable-frei0r) 1086 | mlt_format_optional frei0r "plugin architecture. Several additional effects and transitions" "see http://www.piksel.org/frei0r" 1087 | ;; 1088 | 1089 | # OTHERS 1090 | disable-dv) 1091 | mlt_format_optional dv "loading and saving of DV files" "libdv/libdv-dev" 1092 | ;; 1093 | disable-vorbis) 1094 | mlt_format_optional vorbis "loading and saving ogg/theora/vorbis files" "libvorbis-dev" 1095 | ;; 1096 | 1097 | # FALLBACK 1098 | disable-*) 1099 | mlt_format_optional ${FILE/disable-} "... dunno ... " "... dunno ..." 1100 | ;; 1101 | esac 1102 | done 1103 | if test 1 = "$DODIE" ; then 1104 | die "One or more required MLT modules could not be enabled" 1105 | fi 1106 | cmd popd 1107 | } 1108 | 1109 | ################################################################# 1110 | # configure_compile_install_subproject 1111 | # $1 The sourcedir to configure, compile, and install 1112 | # Configures, compiles, and installs a single subproject. 1113 | # Assumes cwd is common parent dir 1114 | # Errors abort 1115 | function configure_compile_install_subproject { 1116 | trace "Entering configure_compile_install_subproject @ = $@" 1117 | feedback_status Configuring, compiling, and installing $1 1118 | 1119 | OLDCFLAGS=$CFLAGS 1120 | OLDLD_LIBRARY_PATH=$LD_LIBRARY_PATH 1121 | cmd pushd . 1122 | 1123 | # Change to right directory 1124 | cmd cd $1 || die "Unable to change to directory $1" 1125 | 1126 | # Set cflags, log settings 1127 | log PATH=$PATH 1128 | log LD_RUN_PATH=$LD_RUN_PATH 1129 | log PKG_CONFIG_PATH=$PKG_CONFIG_PATH 1130 | export CFLAGS=`lookup CFLAGS_ $1` 1131 | log CFLAGS=$CFLAGS 1132 | export LDFLAGS=`lookup LDFLAGS_ $1` 1133 | log LDFLAGS=$LDFLAGS 1134 | 1135 | # Configure 1136 | feedback_status Configuring $1 1137 | # Special hack for libvpx 1138 | if test "libvpx" = "$1" ; then 1139 | cmd make clean 1140 | fi 1141 | 1142 | # Special hack for movit 1143 | if test "movit" = "$1" -o "mlt" = "$1"; then 1144 | if test "$ENABLE_MOVIT" = "1"; then 1145 | if test "Darwin" = "$TARGET_OS"; then 1146 | export CXXFLAGS="-std=c++11 -stdlib=libc++ $CFLAGS" 1147 | else 1148 | export CXXFLAGS="-std=c++11 $CFLAGS" 1149 | fi 1150 | else 1151 | export CXXFLAGS="$CFLAGS" 1152 | fi 1153 | fi 1154 | 1155 | # Special hack for swfdec 1156 | if test "swfdec" = "$1" ; then 1157 | debug "Need to create configure for $1" 1158 | cmd autoreconf -i || die "Unable to create configure file for $1" 1159 | if test ! -e configure ; then 1160 | die "Unable to confirm presence of configure file for $1" 1161 | fi 1162 | fi 1163 | 1164 | # Special hack for x265 1165 | if test "x265" = "$1"; then 1166 | cd source 1167 | fi 1168 | 1169 | # Special hack for eigen 1170 | if test "eigen" = "$1" ; then 1171 | cmd mkdir build 2> /dev/null 1172 | cmd cd build 1173 | fi 1174 | 1175 | MYCONFIG=`lookup CONFIG $1` 1176 | if test "$MYCONFIG" != ""; then 1177 | cmd $MYCONFIG || die "Unable to configure $1" 1178 | feedback_progress Done configuring $1 1179 | fi 1180 | 1181 | # Special hack for mlt, post-configure 1182 | if test "mlt" = "$1" ; then 1183 | mlt_check_configure 1184 | fi 1185 | 1186 | # Special hack for rubberband 1187 | if [ "rubberband" = "$1" ]; then 1188 | if [ "$TARGET_OS" = "Win32" -o "$TARGET_OS" = "Win64" ]; then 1189 | cmd sed 's/-lrubberband/-lrubberband -lfftw3-3 -lsamplerate/' -i rubberband.pc.in 1190 | fi 1191 | fi 1192 | 1193 | # Compile 1194 | feedback_status Building $1 - this could take some time 1195 | if test "movit" = "$1" ; then 1196 | cmd make -j$MAKEJ RANLIB="$RANLIB" libmovit.la || die "Unable to build $1" 1197 | elif test "rubberband" = "$1" ; then 1198 | cmd ninja -C builddir -j $MAKEJ || die "Unable to build $1" 1199 | elif test "mlt" = "$1" -o "x265" = "$1" -o "frei0r" = "$1" ; then 1200 | cmd ninja -j $MAKEJ || die "Unable to build $1" 1201 | elif test "$MYCONFIG" != ""; then 1202 | cmd make -j$MAKEJ || die "Unable to build $1" 1203 | fi 1204 | feedback_progress Done building $1 1205 | 1206 | # Install 1207 | feedback_status Installing $1 1208 | # This export is only for kdenlive, really, and only for the install step 1209 | export LD_LIBRARY_PATH=`lookup LD_LIBRARY_PATH_ $1` 1210 | log "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" 1211 | if test "1" = "$NEED_SUDO" -a "$MYCONFIG" != "" ; then 1212 | debug "Needs to be root to install - trying" 1213 | log About to run $SUDO make install 1214 | TMPNAME=`mktemp -t build-melt.installoutput.XXXXXXXXX` 1215 | # At least kdesudo does not return an error code if the program fails 1216 | # Filter output for error, and dup it to the log 1217 | $SUDO make install > $TMPNAME 2>&1 1218 | cat $TMPNAME 2>&1 1219 | # If it contains error it returns 0. 1 matches, 255 errors 1220 | # Filter X errors out too 1221 | grep -v "X Error" $TMPNAME | grep -i error 2>&1 1222 | if test 0 = $? ; then 1223 | die "Unable to install $1" 1224 | fi 1225 | elif test "rubberband" = "$1" ; then 1226 | cmd meson install -C builddir || die "Unable to install $1" 1227 | elif test "mlt" = "$1" -o "x265" = "$1" -o "frei0r" = "$1" ; then 1228 | cmd ninja install || die "Unable to install $1" 1229 | elif test "$MYCONFIG" != "" ; then 1230 | cmd make install || die "Unable to install $1" 1231 | if test "mlt" = "$1" ; then 1232 | cmd cp -a src/swig/python/{_mlt.so,mlt.py} "$FINAL_INSTALL_DIR/lib" 1233 | elif test "libepoxy" = "$1" -a "$TARGET_OS" = "Win32" ; then 1234 | cmd make install || die "Unable to install $1" 1235 | cmd install -p -c include/epoxy/wgl*.h "$FINAL_INSTALL_DIR"/include/epoxy 1236 | # libopengl32.dll is added to prebuilts to make libtool build a dll for 1237 | # libepoxy, but it is not an import lib for other projects. 1238 | cmd rm "$FINAL_INSTALL_DIR"/lib/libopengl32.dll 1239 | fi 1240 | fi 1241 | feedback_progress Done installing $1 1242 | 1243 | # Reestablish 1244 | cmd popd 1245 | export CFLAGS=$OLDCFLAGS 1246 | export LD_LIBRARY_PATH=$OLDLD_LIBRARY_PATH 1247 | } 1248 | 1249 | 1250 | ################################################################# 1251 | # configure_compile_install_all 1252 | # Configures, compiles, and installs all subprojects 1253 | function configure_compile_install_all { 1254 | trace "Entering configure_compile_install_all @ = $@" 1255 | feedback_status Configuring, compiling and installing all sources 1256 | 1257 | # Set some more vars for this operation 1258 | log "Using install dir $FINAL_INSTALL_DIR" 1259 | log "Found $CPUS cpus. Will use make -j $MAKEJ for compilation" 1260 | 1261 | # set global settings for all jobs 1262 | export PATH="$FINAL_INSTALL_DIR/bin:$PATH" 1263 | export LD_RUN_PATH="$FINAL_INSTALL_DIR/lib" 1264 | export PKG_CONFIG_PATH="$FINAL_INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH" 1265 | 1266 | log Changing to $SOURCE_DIR 1267 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 1268 | for DIR in $SUBDIRS ; do 1269 | configure_compile_install_subproject $DIR 1270 | done 1271 | feedback_status Done configuring, compiling and installing all sources 1272 | } 1273 | 1274 | ###################################################################### 1275 | # ACTION CREATE_STARTUP_SCRIPT 1276 | ###################################################################### 1277 | 1278 | 1279 | ################################################################# 1280 | # get_dir_info 1281 | # Helper function for startup script creating - returns svn rev information 1282 | # for a given directory 1283 | function get_dir_info { 1284 | # trace "Entering get_dir_info @ = $@" 1285 | pushd . &> /dev/null 1286 | cd $1 || die "Unable to change directory to $1" 1287 | REPOTYPE=`lookup REPOTYPES $1` 1288 | if test "xgit" = "x$REPOTYPE" ; then 1289 | FIND_STR="\(commit\|Date\)" 1290 | INFO_TEXT=`git --no-pager log -n1 | grep "$FIND_STR"` 1291 | else 1292 | FIND_STR="\(Revision\|Last\ Changed\ Date\)" 1293 | INFO_TEXT=`svn info | grep "$FIND_STR"` 1294 | fi 1295 | echo 1296 | echo -e $1: ${INFO_TEXT:-Warning: No $REPOTYPE information found in $SOURCE_DIR/$1.} 1297 | echo 1298 | popd &> /dev/null 1299 | } 1300 | 1301 | ################################################################# 1302 | # sys_info 1303 | # Returns some information about the system 1304 | function sys_info { 1305 | echo 1306 | echo uname -a at time of compilation: 1307 | uname -a 1308 | echo Information about cc at the time of compilation: 1309 | LANG=C cc -v 2>&1 1310 | if which dpkg ; then 1311 | echo Found dpkg - running dpkg -l to grep libc6 1312 | dpkg -l | grep libc6 1313 | else 1314 | if which rpm ; then 1315 | echo Found rpm - running rpm -qa to grep libc6 1316 | rpm -qa | grep libc 1317 | else 1318 | echo Found neither dpkg or rpm... 1319 | fi 1320 | fi 1321 | } 1322 | 1323 | ################################################################# 1324 | # create_startup_script 1325 | # Creates a startup script. Note, that the actual script gets 1326 | # embedded by the Makefile 1327 | function create_startup_script { 1328 | trace "Entering create_startup_script @ = $@" 1329 | pushd . 1330 | 1331 | log Changing to $FINAL_INSTALL_DIR 1332 | cd $FINAL_INSTALL_DIR || die "Unable to change to directory $FINAL_INSTALL_DIR" 1333 | 1334 | TMPFILE=`mktemp -t build-melt.env.XXXXXXXXX` 1335 | log Creating environment script in $TMPFILE 1336 | cat > $TMPFILE < $TMPFILE < /dev/null 1483 | wait $1 1484 | for CP in `ps --ppid $1 -o pid=` ; do 1485 | kill_recursive $CP 1486 | done 1487 | fi 1488 | } 1489 | 1490 | ################################################################# 1491 | # keep_checking_abort 1492 | # Checks if the user indicated an abort through 1493 | function keep_checking_abort { 1494 | while test x`check_abort` = "xcont" ; do 1495 | sleep 1 1496 | done 1497 | feedback_result ABORTED "User requested abort" 1498 | # If we reach here, user aborted, kill everything in sight... 1499 | kill_recursive $MAINPID 1500 | exit 1501 | } 1502 | 1503 | ################################################################# 1504 | # main 1505 | # Collects all the steps 1506 | function main { 1507 | { 1508 | sleep 1 1509 | init_log_file 1510 | read_configuration 1511 | set_globals 1512 | } 2>&1 1513 | 1514 | # Setup abort handling 1515 | # If anyone know of a better way to get ones pid from within a subshell, let me know... 1516 | MAINPID=`/bin/bash -c "echo \\$PPID"` 1517 | # debug "Main is running with pid $MAINPID" 1518 | keep_checking_abort & 1519 | CHECKERPID=$! 1520 | # debug "Checker process is running with pid=$CHECKERPID" 1521 | 1522 | # Special case for sudo getting 1523 | SUDO="" 1524 | log "Checking for sudo requirement" 2>&1 1525 | if test "1" = "$NEED_SUDO" ; then 1526 | log "sudo is needed" 1527 | echo You have chosen to install as root. 1528 | echo 1529 | echo 'Please provide your sudo password below. (If you have recently provided your sudo password to this script, you may not have to do that, because the password is cached).' 1530 | echo 1531 | echo The password will be handled securely by the sudo program. 1532 | echo 1533 | echo If you fail to provide the password, you will have to provide it later when installing the different projects. 1534 | sudo -v 1535 | if test 0 != $? ; then 1536 | die "Unable to proceed" 1537 | fi 1538 | SUDO=sudo 1539 | fi 1540 | log "Done checking for sudo requirement" 2>&1 1541 | 1542 | { 1543 | prepare_feedback 1544 | perform_action 1545 | } 2>&1 1546 | 1547 | # All is well, that ends well 1548 | exit 0 1549 | } 1550 | 1551 | parse_args "$@" 1552 | # Call main, but if detach is given, put it in the background 1553 | if test 1 = "$DETACH"; then 1554 | main & 1555 | # Note, that we assume caller has setup stdin & stdout redirection 1556 | disown -a 1557 | else 1558 | main 1559 | fi 1560 | -------------------------------------------------------------------------------- /build/build-melted.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script builds melted and rugen and many of their dependencies. 4 | # It can accept a configuration file, default: build-melted.conf 5 | 6 | # List of programs used: 7 | # bash, test, tr, awk, ps, make, cmake, cat, sed, curl or wget, and possibly others 8 | 9 | # Author: Dan Dennedy 10 | # Version: 22 11 | # License: GPL2 12 | 13 | ################################################################################ 14 | # ARGS AND GLOBALS 15 | ################################################################################ 16 | 17 | # These are all of the configuration variables with defaults 18 | INSTALL_DIR="$HOME/melted" 19 | AUTO_APPEND_DATE=1 20 | SOURCE_DIR="$INSTALL_DIR/src" 21 | ACTION_GET_COMPILE_INSTALL=1 22 | ACTION_GET_ONLY=0 23 | ACTION_COMPILE_INSTALL=0 24 | SOURCES_CLEAN=1 25 | INSTALL_AS_ROOT=0 26 | CREATE_STARTUP_SCRIPT=1 27 | RUGEN_HEAD=1 28 | RUGEN_REVISION= 29 | MELTED_HEAD=1 30 | MELTED_REVISION= 31 | ENABLE_FREI0R=1 32 | FREI0R_HEAD=1 33 | FREI0R_REVISION= 34 | ENABLE_SWFDEC=0 35 | SWFDEC_HEAD=1 36 | SWFDEC_REVISION= 37 | X264_HEAD=1 38 | X264_REVISION= 39 | LIBVPX_HEAD=1 40 | LIBVPX_REVISION= 41 | ENABLE_LAME=1 42 | FFMPEG_HEAD=1 43 | FFMPEG_REVISION= 44 | FFMPEG_SUPPORT_H264=1 45 | FFMPEG_SUPPORT_LIBVPX=1 46 | FFMPEG_SUPPORT_THEORA=1 47 | FFMPEG_SUPPORT_MP3=1 48 | FFMPEG_SUPPORT_FAAC=0 49 | FFMPEG_ADDITIONAL_OPTIONS= 50 | MLT_HEAD=1 51 | MLT_REVISION= 52 | # QT_INCLUDE_DIR="$(pkg-config --variable=prefix QtCore)/include" 53 | QT_INCLUDE_DIR= 54 | # QT_LIB_DIR="$(pkg-config --variable=prefix QtCore)/lib" 55 | QT_LIB_DIR= 56 | MLT_DISABLE_SOX=0 57 | 58 | ################################################################################ 59 | # Location of config file - if not overriden on command line 60 | CONFIGFILE=build-melted.conf 61 | 62 | # If defined to 1, outputs trace log lines 63 | TRACE=0 64 | 65 | # If defined to 1, outputs debug log lines 66 | DEBUG=0 67 | 68 | # We need to set LANG to C to avoid e.g. svn from getting to funky 69 | export LANG=C 70 | 71 | # User CFLAGS and LDFLAGS sometimes prevent more recent local headers. 72 | # Also, you can adjust some flags here. 73 | export CFLAGS= 74 | export CXXFLAGS= 75 | export LDFLAGS= 76 | 77 | ################################################################################ 78 | # FUNCTION SECTION 79 | ################################################################################ 80 | 81 | ################################################################# 82 | # usage 83 | # Reports legal options to this script 84 | function usage { 85 | echo "Usage: $0 [-c config-file] [-t] [-h]" 86 | echo "Where:" 87 | echo -e "\t-c config-file\tDefaults to $CONFIGFILE" 88 | echo -e "\t-t\t\tSpawn into sep. process" 89 | } 90 | 91 | ################################################################# 92 | # parse_args 93 | # Parses the arguments passed in $@ and sets some global vars 94 | function parse_args { 95 | CONFIGFILEOPT="" 96 | DETACH=0 97 | while getopts ":tc:d:l:" OPT; do 98 | case $OPT in 99 | c ) CONFIGFILEOPT=$OPTARG 100 | echo Setting configfile to $CONFIGFILEOPT 101 | ;; 102 | t ) DETACH=1;; 103 | h ) usage 104 | exit 0;; 105 | * ) echo "Unknown option $OPT" 106 | usage 107 | exit 1;; 108 | esac 109 | done 110 | 111 | # Check configfile 112 | if test "$CONFIGFILEOPT" != ""; then 113 | if test ! -r "$CONFIGFILEOPT" ; then 114 | echo "Unable to read config-file $CONFIGFILEOPT" 115 | exit 1 116 | fi 117 | CONFIGFILE="$CONFIGFILEOPT" 118 | fi 119 | } 120 | ###################################################################### 121 | # DATA HANDLING FUNCTIONS 122 | ###################################################################### 123 | 124 | ################################################################# 125 | # to_key 126 | # Returns a numeric key from a known subproject 127 | # $1 : string: ffmpeg, mlt, etc. 128 | function to_key { 129 | case $1 in 130 | FFmpeg) 131 | echo 0 132 | ;; 133 | mlt) 134 | echo 1 135 | ;; 136 | melted) 137 | echo 2 138 | ;; 139 | frei0r) 140 | echo 3 141 | ;; 142 | x264) 143 | echo 4 144 | ;; 145 | libvpx) 146 | echo 5 147 | ;; 148 | rugen) 149 | echo 6 150 | ;; 151 | swfdec) 152 | echo 7 153 | ;; 154 | lame) 155 | echo 8 156 | ;; 157 | *) 158 | echo UNKNOWN 159 | ;; 160 | esac 161 | } 162 | 163 | ################################################################# 164 | # lookup - lookup a value from an array and return it 165 | # $1 array name, $2 subdir name, that is, text string 166 | function lookup { 167 | eval echo "\${${1}[`to_key $2`]}" 168 | } 169 | 170 | ###################################################################### 171 | # LOG FUNCTIONS 172 | ###################################################################### 173 | 174 | ################################################################# 175 | # init_log_file 176 | # Write some init stuff 177 | function init_log_file { 178 | log `date` 179 | log $0 starting 180 | } 181 | 182 | ################################################################# 183 | # trace 184 | # Function that prints a trace line 185 | # $@ : arguments to be printed 186 | function trace { 187 | if test "1" = "$TRACE" ; then 188 | echo "TRACE: $@" 189 | fi 190 | } 191 | 192 | ################################################################# 193 | # debug 194 | # Function that prints a debug line 195 | # $@ : arguments to be printed 196 | function debug { 197 | if test "1" = "$DEBUG" ; then 198 | echo "DEBUG: $@" 199 | fi 200 | } 201 | 202 | ################################################################# 203 | # log 204 | # Function that prints a log line 205 | # $@ : arguments to be printed 206 | function log { 207 | echo "LOG: $@" 208 | } 209 | 210 | ################################################################# 211 | # log warning 212 | # Function that prints a warning line 213 | # $@ : arguments to be printed 214 | function warn { 215 | echo "WARN: $@" 216 | } 217 | 218 | ################################################################# 219 | # die 220 | # Function that prints a line and exists 221 | # $@ : arguments to be printed 222 | function die { 223 | echo "ERROR: $@" 224 | feedback_result FAILURE "Some kind of error occured: $@" 225 | exit -1 226 | } 227 | 228 | ################################################################# 229 | # cmd 230 | # Function that does a (non-background, non-outputting) command, after logging it 231 | function cmd { 232 | trace "Entering cmd @ = $@" 233 | log About to run command: "$@" 234 | "$@" 235 | } 236 | 237 | 238 | ###################################################################### 239 | # SETUP FUNCTIONS 240 | ###################################################################### 241 | 242 | ################################################################# 243 | # read_configuration 244 | # Reads $CONFIGFILE, parses it, and exports global variables reflecting the 245 | # content. Aborts, if the file does not exist or is not readable 246 | CONFIGURATION="" 247 | function read_configuration { 248 | trace "Entering read_configuration @ = $@" 249 | if test ! -r "$CONFIGFILE"; then 250 | warn "Unable to read config file $CONFIGFILE" 251 | return 252 | fi 253 | debug "Reading configuration from $CONFIGFILE" 254 | # This is for replacement in kdenlive_start 255 | for LINE in `tr "\t" "=" < $CONFIGFILE`; do 256 | debug Setting $LINE 257 | CONFIGURATION="$CONFIGURATION$LINE " 258 | #export $LINE || die "Invalid export line: $LINE. Unable to set configuration options from CONFIGFILE" 259 | done ||\ 260 | die "Unable to set configuration options from $CONFIGFILE" 261 | source "$CONFIGFILE" || die "Unable to evaluate configuration options from $CONFIGFILE" 262 | } 263 | 264 | ################################################################# 265 | # set_globals 266 | # Set up globals based on configuration 267 | # This is where the configuration options for each subproject is assembled 268 | function set_globals { 269 | trace "Entering set_globals @ = $@" 270 | # Set two convenience variables. 271 | if test 1 = "$ACTION_GET_ONLY" -o 1 = "$ACTION_GET_COMPILE_INSTALL" ; then 272 | GET=1 273 | else 274 | GET=0 275 | fi 276 | NEED_SUDO=0 277 | if test 1 = "$ACTION_GET_COMPILE_INSTALL" -o 1 = "$ACTION_COMPILE_INSTALL" ; then 278 | COMPILE_INSTALL=1 279 | if test 1 = $INSTALL_AS_ROOT ; then 280 | NEED_SUDO=1 281 | fi 282 | else 283 | COMPILE_INSTALL=0 284 | fi 285 | debug "GET=$GET, COMPILE_INSTALL=$COMPILE_INSTALL, NEED_SUDO=$NEED_SUDO" 286 | 287 | # The script sets CREATE_STARTUP_SCRIPT to true always, disable if not COMPILE_INSTALL 288 | if test 0 = "$COMPILE_INSTALL" ; then 289 | CREATE_STARTUP_SCRIPT=0 290 | fi 291 | debug "CREATE_STARTUP_SCRIPT=$CREATE_STARTUP_SCRIPT" 292 | 293 | # Subdirs list, for number of common operations 294 | # Note, the function to_key depends on this 295 | SUBDIRS="FFmpeg mlt melted rugen" 296 | if test "$ENABLE_FREI0R" = 1 ; then 297 | SUBDIRS="frei0r $SUBDIRS" 298 | fi 299 | if test "$ENABLE_SWFDEC" = 1 && test "$SWFDEC_HEAD" = 1 -o "$SWFDEC_REVISION" != ""; then 300 | SUBDIRS="swfdec $SUBDIRS" 301 | fi 302 | if test "$FFMPEG_SUPPORT_H264" = 1 && test "$X264_HEAD" = 1 -o "$X264_REVISION" != ""; then 303 | SUBDIRS="x264 $SUBDIRS" 304 | fi 305 | if test "$FFMPEG_SUPPORT_LIBVPX" = 1 && test "$LIBVPX_HEAD" = 1 -o "$LIBVPX_REVISION" != ""; then 306 | SUBDIRS="libvpx $SUBDIRS" 307 | fi 308 | if test "$FFMPEG_SUPPORT_MP3" = 1 && test "$ENABLE_LAME" = 1; then 309 | SUBDIRS="lame $SUBDIRS" 310 | fi 311 | debug "SUBDIRS = $SUBDIRS" 312 | 313 | # REPOLOCS Array holds the repo urls 314 | REPOLOCS[0]="https://github.com/FFmpeg/FFmpeg.git" 315 | REPOLOCS[1]="https://github.com/mltframework/mlt.git" 316 | REPOLOCS[2]="https://github.com/mltframework/melted.git" 317 | REPOLOCS[3]="https://github.com/dyne/frei0r.git" 318 | REPOLOCS[4]="https://github.com/mirror/x264.git" 319 | REPOLOCS[5]="https://chromium.googlesource.com/webm/libvpx.git" 320 | REPOLOCS[6]="https://github.com/mltframework/rugen.git" 321 | REPOLOCS[7]="https://github.com/mltframework/swfdec.git" 322 | REPOLOCS[8]="https://ftp.osuosl.org/pub/blfs/conglomeration/lame/lame-3.99.5.tar.gz" 323 | 324 | # REPOTYPE Array holds the repo types. (Yes, this might be redundant, but easy for me) 325 | REPOTYPES[0]="git" 326 | REPOTYPES[1]="git" 327 | REPOTYPES[2]="git" 328 | REPOTYPES[3]="git" 329 | REPOTYPES[4]="git" 330 | REPOTYPES[5]="git" 331 | REPOTYPES[6]="git" 332 | REPOTYPES[7]="git" 333 | REPOTYPES[8]="http-tgz" 334 | 335 | # And, set up the revisions 336 | REVISIONS[0]="" 337 | if test 0 = "$FFMPEG_HEAD" -a "$FFMPEG_REVISION" ; then 338 | REVISIONS[0]="$FFMPEG_REVISION" 339 | fi 340 | # Git, just use blank or the hash. 341 | REVISIONS[1]="" 342 | if test 0 = "$MLT_HEAD" -a "$MLT_REVISION" ; then 343 | REVISIONS[1]="$MLT_REVISION" 344 | fi 345 | REVISIONS[2]="" 346 | if test 0 = "$MELTED_HEAD" -a "$MELTED_REVISION" ; then 347 | REVISIONS[2]="$MELTED_REVISION" 348 | fi 349 | REVISIONS[3]="" 350 | if test 0 = "$FREI0R_HEAD" -a "$FREI0R_REVISION" ; then 351 | REVISIONS[3]="$FREI0R_REVISION" 352 | fi 353 | REVISIONS[4]="" 354 | if test 0 = "$X264_HEAD" -a "$X264_REVISION" ; then 355 | REVISIONS[4]="$X264_REVISION" 356 | fi 357 | REVISIONS[5]="" 358 | if test 0 = "$LIBVPX_HEAD" -a "$LIBVPX_REVISION" ; then 359 | REVISIONS[5]="$LIBVPX_REVISION" 360 | fi 361 | REVISIONS[6]="" 362 | if test 0 = "$RUGEN_HEAD" -a "$RUGEN_REVISION" ; then 363 | REVISIONS[6]="$RUGEN_REVISION" 364 | fi 365 | REVISIONS[7]="" 366 | if test 0 = "$SWFDEC_HEAD" -a "$SWFDEC_REVISION" ; then 367 | REVISIONS[7]="$SWFDEC_REVISION" 368 | fi 369 | REVISIONS[8]="lame-3.99.5" 370 | 371 | # Figure out the install dir - we may not install, but then we know it. 372 | FINAL_INSTALL_DIR=$INSTALL_DIR 373 | if test 1 = "$AUTO_APPEND_DATE" ; then 374 | FINAL_INSTALL_DIR="$INSTALL_DIR/`date +'%Y%m%d'`" 375 | fi 376 | debug "Using install dir FINAL_INSTALL_DIR=$FINAL_INSTALL_DIR" 377 | 378 | # Figure out the number of cores in the system. Used both by make and startup script 379 | TARGET_OS="$(uname -s)" 380 | if test "$TARGET_OS" = "Darwin"; then 381 | CPUS=$(sysctl -a hw | grep "ncpu:" | cut -d ' ' -f 2) 382 | else 383 | CPUS=$(grep "processor.*:" /proc/cpuinfo | wc -l) 384 | fi 385 | # Sanity check 386 | if test 0 = $CPUS ; then 387 | CPUS=1 388 | fi 389 | MAKEJ=$(( $CPUS + 1 )) 390 | debug "Using make -j$MAKEJ for compilation" 391 | 392 | # CONFIG Array holds the ./configure (or equiv) command for each project 393 | # CFLAGS_ Array holds additional CFLAGS for the configure/make step of a given project 394 | # LDFLAGS_ Array holds additional LDFLAGS for the configure/make step of a given project 395 | 396 | ##### 397 | # ffmpeg 398 | CONFIG[0]="./configure --prefix=$FINAL_INSTALL_DIR --disable-doc --enable-gpl --enable-version3 --enable-shared --enable-debug --enable-pthreads --enable-runtime-cpudetect" 399 | if test 1 = "$FFMPEG_SUPPORT_THEORA" ; then 400 | CONFIG[0]="${CONFIG[0]} --enable-libtheora --enable-libvorbis" 401 | fi 402 | if test 1 = "$FFMPEG_SUPPORT_MP3" ; then 403 | CONFIG[0]="${CONFIG[0]} --enable-libmp3lame" 404 | fi 405 | if test 1 = "$FFMPEG_SUPPORT_FAAC" ; then 406 | CONFIG[0]="${CONFIG[0]} --enable-libfaac --enable-nonfree" 407 | fi 408 | if test 1 = "$FFMPEG_SUPPORT_H264" ; then 409 | CONFIG[0]="${CONFIG[0]} --enable-libx264" 410 | fi 411 | if test 1 = "$FFMPEG_SUPPORT_LIBVPX" ; then 412 | CONFIG[0]="${CONFIG[0]} --enable-libvpx" 413 | fi 414 | # Add optional parameters 415 | CONFIG[0]="${CONFIG[0]} $FFMPEG_ADDITIONAL_OPTIONS" 416 | CFLAGS_[0]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 417 | LDFLAGS_[0]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 418 | 419 | ##### 420 | # mlt 421 | CONFIG[1]="./configure --prefix=$FINAL_INSTALL_DIR --enable-gpl --enable-linsys --swig-languages=python" 422 | # Remember, if adding more of these, to update the post-configure check. 423 | [ "$TARGET_OS" = "Darwin" ] && CONFIG[1]="${CONFIG[1]} --disable-jackrack" 424 | [ "$QT_INCLUDE_DIR" ] && CONFIG[1]="${CONFIG[1]} --qt-includedir=$QT_INCLUDE_DIR" 425 | [ "$QT_LIB_DIR" ] && CONFIG[1]="${CONFIG[1]} --qt-libdir=$QT_LIB_DIR" 426 | if test "1" = "$MLT_DISABLE_SOX" ; then 427 | CONFIG[1]="${CONFIG[1]} --disable-sox" 428 | fi 429 | CFLAGS_[1]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 430 | # Temporary patch until makefile for MLT corrected? 431 | #CFLAGS_[1]="${CFLAGS_[1]} -I$FINAL_INSTALL_DIR/include/libavcodec/ -I$FINAL_INSTALL_DIR/include/libavformat/ -I$FINAL_INSTALL_DIR/include/libswscale/ -I$FINAL_INSTALL_DIR/include/libavdevice" 432 | LDFLAGS_[1]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 433 | # Note in the above, that we always looks for frei0r. User can do own install 434 | # it will be picked up. 435 | 436 | ##### 437 | # melted 438 | CONFIG[2]="./configure --prefix=$FINAL_INSTALL_DIR --enable-gpl" 439 | CFLAGS_[2]="-I$FINAL_INSTALL_DIR/include $CFLAGS" 440 | LDFLAGS_[2]="-L$FINAL_INSTALL_DIR/lib $LDFLAGS" 441 | 442 | #### 443 | # frei0r 444 | CONFIG[3]="cmake -DCMAKE_INSTALL_PREFIX=$FINAL_INSTALL_DIR -DWITHOUT_GAVL=1 -DWITHOUT_OPENCV=1 $CMAKE_DEBUG_FLAG" 445 | CFLAGS_[3]=$CFLAGS 446 | LDFLAGS_[3]=$LDFLAGS 447 | 448 | #### 449 | # x264 450 | CONFIG[4]="./configure --prefix=$FINAL_INSTALL_DIR --disable-lavf --disable-ffms --disable-gpac --disable-swscale --enable-shared" 451 | CFLAGS_[4]=$CFLAGS 452 | [ "$TARGET_OS" = "Darwin" ] && CFLAGS_[4]="-I. -fno-common -read_only_relocs suppress ${CFLAGS_[4]} " 453 | LDFLAGS_[4]=$LDFLAGS 454 | 455 | #### 456 | # libvpx 457 | CONFIG[5]="./configure --prefix=$FINAL_INSTALL_DIR --enable-vp8 --enable-postproc --enable-multithread --enable-runtime-cpu-detect --disable-install-docs --disable-debug-libs --disable-examples --disable-unit-tests --extra-cflags=-std=c99" 458 | [ "$TARGET_OS" = "Linux" ] && CONFIG[5]="${CONFIG[5]} --enable-shared" 459 | CFLAGS_[5]=$CFLAGS 460 | # [ "$TARGET_OS" = "Darwin" ] && CFLAGS_[5]="-I. -fno-common -read_only_relocs suppress ${CFLAGS_[5]} " 461 | LDFLAGS_[5]=$LDFLAGS 462 | 463 | ##### 464 | # rugen 465 | CONFIG[6]="./autogen.sh && ./configure --prefix=$FINAL_INSTALL_DIR" 466 | CFLAGS_[6]=$CFLAGS 467 | LDFLAGS_[6]=$LDFLAGS 468 | 469 | ##### 470 | # swfdec 471 | CONFIG[7]="./configure --prefix=$FINAL_INSTALL_DIR --libdir=$FINAL_INSTALL_DIR/lib --disable-gtk --disable-gstreamer" 472 | CFLAGS_[7]=$CFLAGS 473 | LDFLAGS_[7]=$LDFLAGS 474 | 475 | ##### 476 | # lame 477 | CONFIG[8]="./configure --prefix=$FINAL_INSTALL_DIR --libdir=$FINAL_INSTALL_DIR/lib --disable-decoder --disable-frontend" 478 | CFLAGS_[8]=$CFLAGS 479 | LDFLAGS_[8]=$LDFLAGS 480 | } 481 | 482 | ###################################################################### 483 | # FEEDBACK FUNCTIONS 484 | ###################################################################### 485 | 486 | ################################################################# 487 | # feedback_init 488 | # $1 : ProgressBar maximum 489 | # Resets the progressbar or textual output based on DCOPREF 490 | function feedback_init { 491 | trace "Entering feedback_init @ = $@" 492 | case $DCOPREF in 493 | none) 494 | log Total number of steps needed to complete $1 495 | log Press Ctrl+C to abort 496 | ;; 497 | kdialog*) 498 | cmd dcop $DCOPREF ProgressDialog setTotalSteps $1 || \ 499 | warn Unable to setTotalSteps on ProgressBar 500 | cmd dcop $DCOPREF ProgressDialog showCancelButton true || \ 501 | warn Unable to show Cancel button on kdialog instance 502 | ;; 503 | kmdr*) 504 | cmd dcop $DCOPREF KommanderIf setMaximum ProgressBar $1 || \ 505 | warn Unable to setMaximum on ProgressBar 506 | ;; 507 | esac 508 | PROGRESS=0 509 | feedback_set_progress $PROGRESS 510 | } 511 | 512 | ################################################################# 513 | # feedback_progress 514 | # $1 : ProgressBar position 515 | # Sets the progressbar position or textual output based on DCOPREF 516 | function feedback_set_progress { 517 | trace "Entering feedback_set_progress @ = $@" 518 | case $DCOPREF in 519 | none) 520 | log Number of steps completed : $1 521 | ;; 522 | kdialog*) 523 | cmd dcop $DCOPREF ProgressDialog setProgress $1 || \ 524 | warn Unable to setProgress on ProgressBar 525 | ;; 526 | kmdr*) 527 | cmd dcop $DCOPREF KommanderIf setText ProgressBar $1 || \ 528 | warn Unable to setProgress on ProgressBar 529 | ;; 530 | esac 531 | } 532 | 533 | ################################################################# 534 | # feedback_status 535 | # $@ status information 536 | # Displays/Appends status, based on DCOPREF 537 | function feedback_status { 538 | trace "Entering feedback_status @ = $@" 539 | # Need to collect $@ in a single variable for cmd to work 540 | ARG=$@ 541 | log "$ARG" 542 | } 543 | 544 | ################################################################# 545 | # feedback_result 546 | # $1 : SUCCESS, FAILURE, ABORTED 547 | # $2 : Additional information 548 | # Does the relevant feedback, and terminates. 549 | function feedback_result { 550 | trace "Entering feedback_result @ = $@" 551 | 552 | # If needed, kill the checker process 553 | if test "" != "$CHECKERPID" ; then 554 | # Kill the checker process 555 | kill -9 $CHECKERPID &> /dev/null 556 | fi 557 | 558 | log "Process has finished. Reason: $@" 559 | } 560 | 561 | 562 | ################################################################# 563 | # feedback_progress 564 | # $@ : Description of task completed 565 | # Increases the progressbar with 1 and sets the status to $@ 566 | function feedback_progress { 567 | trace "Entering feedback_progress @ = $@" 568 | PROGRESS=$(( $PROGRESS + 1 )) 569 | feedback_status $@ 570 | feedback_set_progress $PROGRESS 571 | } 572 | 573 | ################################################################# 574 | # prepare_feedback 575 | # Function to prepare the feedback. E.g. set up max progress steps 576 | # Based on configuration read and the DCOPREF variable 577 | function prepare_feedback { 578 | trace "Entering prepare_feedback @ = $@" 579 | # Figure out the number of steps 580 | # Get adds 8 if cleaning, 4 otherwise (2/1 pr. proj) 581 | # Compile/Install adds 12 (3/proj) 582 | # Script install adds 1 583 | NUMSTEPS=0 584 | if test 1 = "$GET" ; then 585 | debug Adding 3 steps for get 586 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 587 | if test 1 = "$ENABLE_FREI0R" ; then 588 | debug Adding 1 step for get frei0r 589 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 590 | fi 591 | if test 1 = "$ENABLE_SWFDEC" ; then 592 | debug Adding 1 step for get swfdec 593 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 594 | fi 595 | fi 596 | if test 1 = "$GET" -a 1 = "$SOURCES_CLEAN" ; then 597 | debug Adding 3 steps for clean on get 598 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 599 | if test 1 = "$ENABLE_FREI0R" ; then 600 | debug Adding 1 step for clean frei0r 601 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 602 | fi 603 | if test 1 = "$ENABLE_SWFDEC" ; then 604 | debug Adding 1 step for clean swfdec 605 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 606 | fi 607 | fi 608 | if test 1 = "$COMPILE_INSTALL" ; then 609 | debug Adding 9 steps for compile-install 610 | NUMSTEPS=$(( $NUMSTEPS + 9 )) 611 | if test 1 = "$ENABLE_FREI0R" ; then 612 | debug Adding 3 steps for compile-install frei0r 613 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 614 | fi 615 | if test 1 = "$ENABLE_SWFDEC" ; then 616 | debug Adding 3 steps for compile-install swfdec 617 | NUMSTEPS=$(( $NUMSTEPS + 3 )) 618 | fi 619 | fi 620 | if test 1 = "$CREATE_STARTUP_SCRIPT" ; then 621 | debug Adding 1 step for script creating 622 | NUMSTEPS=$(( $NUMSTEPS + 1 )) 623 | fi 624 | log Number of steps determined to $NUMSTEPS 625 | feedback_init $NUMSTEPS 626 | } 627 | 628 | ################################################################# 629 | # check_abort 630 | # Function that checks if the user wanted to cancel what we are doing. 631 | # returns "stop" or "cont" as appropiate 632 | function check_abort { 633 | # log "$ARG" 634 | echo 635 | } 636 | 637 | ###################################################################### 638 | # GLOBAL TEST FUNCTIONS 639 | ###################################################################### 640 | 641 | ################################################################# 642 | # is_newer_equal 643 | # Compares versions strings, and returns 1 if $1 is newer than $2 644 | # This is highly ineffective, I am sorry to say... 645 | function is_newer_equal { 646 | trace "Entering is_newer_equal @ = $@" 647 | A1=`echo $1 | cut -d. -f1` 648 | A2=`echo $1 | cut -d. -f2` 649 | A3=`echo $1 | cut -d. -f3 | sed 's/^\([0-9]\{1,3\}\).*/\1/'` 650 | B1=`echo $2 | cut -d. -f1` 651 | B2=`echo $2 | cut -d. -f2` 652 | B3=`echo $2 | cut -d. -f3 | sed 's/^\([0-9]\{1,3\}\).*/\1/'` 653 | debug "A = $A1 $A2 $A3, B = $B1 $B2 $B3" 654 | test "$A1" -gt "$B1" -o \( "$A1" = "$B1" -a "$A2" -gt "$B2" \) -o \( "$A1" = "$B1" -a "$A2" = "$B2" -a "$A3" -ge "$B3" \) 655 | } 656 | 657 | ###################################################################### 658 | # ACTION GET FUNCTIONS 659 | ###################################################################### 660 | 661 | ################################################################# 662 | # make_clean_dir 663 | # Make clean in a specific directory 664 | # $1: The directory to make clean in. 665 | # Any errors are ignored. Make clean is only called if cd success. 666 | # Assumes cwd is common parent dir 667 | function make_clean_dir { 668 | trace "Entering make_clean_dir @ = $@" 669 | log Make clean for $1 called 670 | feedback_status "Cleaning out sources for $1" 671 | cmd pushd . 672 | # Special hack for ffmpeg, it sometimes requires distclean to work. 673 | if test "FFmpeg" = "$1" ; then 674 | cmd cd $1 && cmd make distclean 675 | else 676 | cmd cd $1 && cmd make clean 677 | fi 678 | feedback_progress Cleaned up in $1 679 | cmd popd 680 | } 681 | 682 | ################################################################# 683 | # clean_dirs 684 | # Make clean in all directories 685 | function clean_dirs { 686 | trace "Entering clean_dirs @ = $@" 687 | feedback_status Cleaning out all subdirs 688 | cmd cd $SOURCE_DIR || mkdir -p $SOURCE_DIR 689 | cmd cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 690 | for DIR in $SUBDIRS ; do 691 | make_clean_dir $DIR 692 | done 693 | feedback_status Done cleaning out in source dirs 694 | } 695 | 696 | ################################################################# 697 | # get_subproject 698 | # $1 The sourcedir to get sources for 699 | # Get the sources for a single project 700 | # Assumes cwd is common parent dir 701 | # Errors abort 702 | function get_subproject { 703 | trace "Entering get_subproject @ = $@" 704 | feedback_status Getting or updating source for $1 - this could take some time 705 | cmd pushd . 706 | 707 | # Check for repository setyp 708 | REPOTYPE=`lookup REPOTYPES $1` 709 | REPOLOC=`lookup REPOLOCS $1` 710 | REVISION=`lookup REVISIONS $1` 711 | debug "REPOTYPE=$REPOTYPE, REPOLOC=$REPOLOC, REVISION=$REVISION" 712 | 713 | # Note that svn can check out to current directory, whereas git will not. Sigh. 714 | if test "git" = "$REPOTYPE" ; then 715 | # If the dir is there, check if it is a git repo 716 | if test -d "$1" ; then 717 | # Change to it 718 | cmd cd $1 || die "Unable to change to directory $1" 719 | debug "About to look for git repo" 720 | git --no-pager status 2>&1 | grep "fatal" &> /dev/null 721 | if test 0 != $? ; then 722 | # Found git repo 723 | debug "Found git repo, will update" 724 | feedback_status "Pulling git sources for $1" 725 | cmd git reset --hard || die "Unable to reset git tree for $1" 726 | cmd git checkout master || die "Unable to git checkout master" 727 | cmd git --no-pager pull $REPOLOC master || die "Unable to git pull sources for $1" 728 | cmd git checkout $REVISION || die "Unable to git checkout $REVISION" 729 | else 730 | # A dir with the expected name, but not a git repo, bailing out 731 | PWD=`pwd` 732 | die "Found a dir with the expected name $1 ($PWD), but it was not a git repo. Unable to proceed. If you have old mlt/mlt++ sources, please delete these directories, before rerunning the script." 733 | fi 734 | else 735 | # No git repo 736 | debug "No git repo, need to check out" 737 | feedback_status "Cloning git sources for $1" 738 | cmd git --no-pager clone $REPOLOC || die "Unable to git clone source for $1 from $REPOLOC" 739 | cmd cd $1 || die "Unable to change to directory $1" 740 | cmd git checkout $REVISION || die "Unable to git checkout $REVISION" 741 | fi 742 | elif test "svn" = "$REPOTYPE" ; then 743 | # Create subdir if not exist 744 | if test ! -d "$1" ; then 745 | cmd mkdir -p $1 || die "Unable to create directory $1" 746 | fi 747 | # Change to it 748 | cmd cd $1 || die "Unable to change to directory $1" 749 | FIND_STR="\(Revision\|Last\ Changed\ Date\)" 750 | debug "About to look for SVN revision info for $REPOLOC $REVISION" 751 | svn --non-interactive info | grep "$FIND_STR" 752 | if test 0 = $? ; then 753 | debug "Found existing SVN checkout" 754 | # Found svn info 755 | # For KDENLIVE: If the svn info URL matches the one we have in the REPOLOCS array, do an update, otherwise, do a switch. 756 | REPOLOCURL=`svn --non-interactive info | grep URL | awk '{print $2}'` 757 | # Now, we have to be a bit clever here, because if the user originally checked it out using 758 | # https, we can not change to http. So, we check for https in the current URL 759 | # Note, that beeing clever almost always fails at some point. But, at least we give it a try... 760 | if test "${REPOLOCURL:0:5}" = "https" ; then 761 | REPOLOC=${REPOLOC/http/https} 762 | fi 763 | if test "kdenlive" = "$1" -a $REPOLOCURL != $REPOLOC ; then 764 | warn "Existing url $REPOLOCURL for $1 does not match the url for selected version: $REPOLOC. Trying svn switch to update" 765 | feedback_status "Trying to switch repo url for $1" 766 | cmd svn --non-interactive switch $REPOLOC $REVISION || die "Unable to switch svn repo from $REPOLOCURL to $REPOLOC $REVISION" 767 | else 768 | feedback_status "Updating SVN sources for $1" 769 | cmd svn --non-interactive update $REVISION || die "Unable to update SVN repo in $1 to $REVISION" 770 | fi 771 | else 772 | # No svn info 773 | feedback_status "Getting SVN sources for $1" 774 | cmd svn --non-interactive co $REPOLOC . $REVISION || die "Unable to get SVN source for $1 from $REPOLOC $REVISION" 775 | fi 776 | elif test "http-tgz" = "$REPOTYPE" ; then 777 | if test ! -d "$1" ; then 778 | feedback_status "Downloading archive for $1" 779 | which curl > /dev/null 780 | if test 0 = $?; then 781 | cmd $(curl -L $REPOLOC | tar -xz) || die "Unable to download source for $1 from $REPOLOC" 782 | else 783 | which wget > /dev/null 784 | if test 0 = $?; then 785 | cmd $(wget -O - $REPOLOC | tar -xz) || die "Unable to download source for $1 from $REPOLOC" 786 | fi 787 | fi 788 | cmd mv "$REVISION" "$1" || due "Unable to rename $REVISION to $1" 789 | fi 790 | fi # git/svn 791 | 792 | feedback_progress Done getting or updating source for $1 793 | cmd popd 794 | } 795 | 796 | ################################################################# 797 | # get_all_sources 798 | # Gets all the sources for all subprojects 799 | function get_all_sources { 800 | trace "Entering get_all_sources @ = $@" 801 | feedback_status Getting all sources 802 | log Changing to $SOURCE_DIR 803 | cd $SOURCE_DIR || mkdir -p "$SOURCE_DIR" 804 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 805 | for DIR in $SUBDIRS ; do 806 | get_subproject $DIR 807 | done 808 | feedback_status Done getting all sources 809 | } 810 | 811 | ###################################################################### 812 | # ACTION COMPILE-INSTALL FUNCTIONS 813 | ###################################################################### 814 | 815 | ################################################################# 816 | # mlt_format_required 817 | # log a string that expresses a requirement 818 | function mlt_format_required { 819 | log 'MLTDISABLED '$1' : this is a required module. '$2'Will abort compilation.' 820 | } 821 | 822 | ################################################################# 823 | # mlt_format_optional 824 | # log a string that expresses missing an optional 825 | function mlt_format_optional { 826 | log 'MLTDISABLED '$1' : this is an optional module that provides '$2'. To enable it, try installing a package called something like '$3'.' 827 | } 828 | 829 | ################################################################# 830 | # mlt_check_configure 831 | # This is a special hack for mlt. Mlt does not allow --enable, or abort 832 | # if something is missing, so we check all the disable files. Some are 833 | # optional, some are required. We stop compilation if a required file is 834 | # missing. For optionals, we report them to the log 835 | # Oh, and it is assumed we are in the toplevel mlt source directory, when 836 | # this is called. 837 | function mlt_check_configure { 838 | trace "Entering check_mlt_configure @ = $@" 839 | cmd pushd . 840 | DODIE=0 841 | cmd cd src/modules || die "Unable to check mlt modules list" 842 | for FILE in `ls disable-* 2>/dev/null` ; do 843 | debug "Checking $FILE" 844 | case $FILE in 845 | # REQUIRED 846 | disable-core) 847 | mlt_format_required core "I have no idea why this was disabled. " 848 | DODIE=1 849 | ;; 850 | disable-avformat) 851 | mlt_format_required avformat "Did ffmpeg installation fail? " 852 | DODIE=1 853 | ;; 854 | disable-xml) 855 | mlt_format_required xml "Please install libxml2-dev. " 856 | DODIE=1 857 | ;; 858 | disable-sdl2) 859 | mlt_format_required sdl2 "Please install libsdl2-dev. " 860 | DODIE=1 861 | ;; 862 | disable-qt) 863 | mlt_format_required qt "Please provide paths for QT on the 'Compile options' page. " 864 | DODIE=1 865 | ;; 866 | 867 | # AUDIO 868 | disable-sox) 869 | if test "0" = "$MLT_DISABLE_SOX" ; then 870 | mlt_format_optional sox "sound effects/operations" "sox-dev" 871 | DODIE=1 872 | fi 873 | ;; 874 | disable-jackrack) 875 | mlt_format_optional jackrack "sound effects/operations" "libjack-dev" 876 | ;; 877 | disable-resample) 878 | mlt_format_optional resample "audio resampling" "libsamplerate0-dev" 879 | ;; 880 | 881 | # IMAGE 882 | disable-gtk2) 883 | mlt_format_optional gtk2 "some additional image loading support" "libgtk2-dev?" 884 | ;; 885 | disable-kdenlive) 886 | mlt_format_optional kdenlive "slow motion and freeze effects" "??" 887 | ;; 888 | disable-frei0r) 889 | mlt_format_optional frei0r "plugin architecture. Several additional effects and transitions" "see http://www.piksel.org/frei0r" 890 | ;; 891 | 892 | # OTHERS 893 | disable-dv) 894 | mlt_format_optional dv "loading and saving of DV files" "libdv/libdv-dev" 895 | ;; 896 | disable-vorbis) 897 | mlt_format_optional vorbis "loading and saving ogg/theora/vorbis files" "libvorbis-dev" 898 | ;; 899 | 900 | # FALLBACK 901 | disable-*) 902 | mlt_format_optional ${FILE/disable-} "... dunno ... " "... dunno ..." 903 | ;; 904 | esac 905 | done 906 | if test 1 = "$DODIE" ; then 907 | die "One or more required MLT modules could not be enabled" 908 | fi 909 | cmd popd 910 | } 911 | 912 | ################################################################# 913 | # configure_compile_install_subproject 914 | # $1 The sourcedir to configure, compile, and install 915 | # Configures, compiles, and installs a single subproject. 916 | # Assumes cwd is common parent dir 917 | # Errors abort 918 | function configure_compile_install_subproject { 919 | trace "Entering configure_compile_install_subproject @ = $@" 920 | feedback_status Configuring, compiling, and installing $1 921 | 922 | OLDCFLAGS=$CFLAGS 923 | OLDLD_LIBRARY_PATH=$LD_LIBRARY_PATH 924 | cmd pushd . 925 | 926 | # Change to right directory 927 | cmd cd $1 || die "Unable to change to directory $1" 928 | 929 | # Set cflags, log settings 930 | log PATH=$PATH 931 | log LD_RUN_PATH=$LD_RUN_PATH 932 | log PKG_CONFIG_PATH=$PKG_CONFIG_PATH 933 | export CFLAGS=`lookup CFLAGS_ $1` 934 | log CFLAGS=$CFLAGS 935 | export LDFLAGS=`lookup LDFLAGS_ $1` 936 | log LDFLAGS=$LDFLAGS 937 | 938 | # Configure 939 | feedback_status Configuring $1 940 | # Special hack for libvpx 941 | if test "libvpx" = "$1" ; then 942 | cmd make clean 943 | fi 944 | 945 | # Special hack for swfdec 946 | if test "swfdec" = "$1" ; then 947 | debug "Need to create configure for $1" 948 | cmd autoreconf -i || die "Unable to create configure file for $1" 949 | if test ! -e configure ; then 950 | die "Unable to confirm presence of configure file for $1" 951 | fi 952 | fi 953 | 954 | cmd `lookup CONFIG $1` || die "Unable to configure $1" 955 | feedback_progress Done configuring $1 956 | 957 | # Special hack for mlt, post-configure 958 | if test "mlt" = "$1" ; then 959 | mlt_check_configure 960 | fi 961 | 962 | # Compile 963 | feedback_status Building $1 - this could take some time 964 | cmd make -j$MAKEJ || die "Unable to build $1" 965 | feedback_progress Done building $1 966 | 967 | # Install 968 | feedback_status Installing $1 969 | # This export is only for kdenlive, really, and only for the install step 970 | export LD_LIBRARY_PATH=`lookup LD_LIBRARY_PATH_ $1` 971 | log "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" 972 | if test "1" = "$NEED_SUDO" ; then 973 | debug "Needs to be root to install - trying" 974 | log About to run $SUDO make install 975 | TMPNAME=`mktemp -t build-melted.installoutput.XXXXXXXXX` 976 | # At least kdesudo does not return an error code if the program fails 977 | # Filter output for error, and dup it to the log 978 | $SUDO make install > $TMPNAME 2>&1 979 | cat $TMPNAME 2>&1 980 | # If it contains error it returns 0. 1 matches, 255 errors 981 | # Filter X errors out too 982 | grep -v "X Error" $TMPNAME | grep -v error.h | grep -i error 2>&1 983 | if test 0 = $? ; then 984 | die "Unable to install $1" 985 | fi 986 | else 987 | cmd make install || die "Unable to install $1" 988 | fi 989 | feedback_progress Done installing $1 990 | 991 | # Reestablish 992 | cmd popd 993 | export CFLAGS=$OLDCFLAGS 994 | export LD_LIBRARY_PATH=$OLDLD_LIBRARY_PATH 995 | } 996 | 997 | 998 | ################################################################# 999 | # configure_compile_install_all 1000 | # Configures, compiles, and installs all subprojects 1001 | function configure_compile_install_all { 1002 | trace "Entering configure_compile_install_all @ = $@" 1003 | feedback_status Configuring, compiling and installing all sources 1004 | 1005 | # Set some more vars for this operation 1006 | log "Using install dir $FINAL_INSTALL_DIR" 1007 | log "Found $CPUS cpus. Will use make -j $MAKEJ for compilation" 1008 | 1009 | # set global settings for all jobs 1010 | export PATH="$FINAL_INSTALL_DIR/bin:$PATH" 1011 | export LD_RUN_PATH="$FINAL_INSTALL_DIR/lib" 1012 | export PKG_CONFIG_PATH="$FINAL_INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH" 1013 | 1014 | log Changing to $SOURCE_DIR 1015 | cd $SOURCE_DIR || die "Unable to change to directory $SOURCE_DIR" 1016 | for DIR in $SUBDIRS ; do 1017 | configure_compile_install_subproject $DIR 1018 | done 1019 | feedback_status Done configuring, compiling and installing all sources 1020 | } 1021 | 1022 | ###################################################################### 1023 | # ACTION CREATE_STARTUP_SCRIPT 1024 | ###################################################################### 1025 | 1026 | 1027 | ################################################################# 1028 | # get_dir_info 1029 | # Helper function for startup script creating - returns svn rev information 1030 | # for a given directory 1031 | function get_dir_info { 1032 | # trace "Entering get_dir_info @ = $@" 1033 | pushd . &> /dev/null 1034 | cd $1 || die "Unable to change directory to $1" 1035 | REPOTYPE=`lookup REPOTYPES $1` 1036 | if test "xgit" = "x$REPOTYPE" ; then 1037 | FIND_STR="\(commit\|Date\)" 1038 | INFO_TEXT=`git --no-pager log -n1 | grep "$FIND_STR"` 1039 | else 1040 | FIND_STR="\(Revision\|Last\ Changed\ Date\)" 1041 | INFO_TEXT=`svn info | grep "$FIND_STR"` 1042 | fi 1043 | echo 1044 | echo -e $1: ${INFO_TEXT:-Warning: No $REPOTYPE information found in $SOURCE_DIR/$1.} 1045 | echo 1046 | popd &> /dev/null 1047 | } 1048 | 1049 | ################################################################# 1050 | # sys_info 1051 | # Returns some information about the system 1052 | function sys_info { 1053 | echo 1054 | echo uname -a at time of compilation: 1055 | uname -a 1056 | echo Information about cc at the time of compilation: 1057 | LANG=C cc -v 2>&1 1058 | if which dpkg ; then 1059 | echo Found dpkg - running dpkg -l to grep libc6 1060 | dpkg -l | grep libc6 1061 | else 1062 | if which rpm ; then 1063 | echo Found rpm - running rpm -qa to grep libc6 1064 | rpm -qa | grep libc 1065 | else 1066 | echo Found neither dpkg or rpm... 1067 | fi 1068 | fi 1069 | if test 1 = "$USE_KDE4" ; then 1070 | echo Information about kde 4 at the time of compilation: 1071 | kde4-config -v 1072 | else 1073 | echo Information about kde 3 at the time of compilation: 1074 | kde-config -v 1075 | fi 1076 | } 1077 | 1078 | ################################################################# 1079 | # create_startup_script 1080 | # Creates a startup script. Note, that the actual script gets 1081 | # embedded by the Makefile 1082 | function create_startup_script { 1083 | trace "Entering create_startup_script @ = $@" 1084 | pushd . 1085 | 1086 | log Changing to $FINAL_INSTALL_DIR 1087 | cd $FINAL_INSTALL_DIR || die "Unable to change to directory $FINAL_INSTALL_DIR" 1088 | 1089 | ARCHIVE="https://s3.amazonaws.com/misc.meltymedia/mltframework.org/build-melted-extras.tar.gz" 1090 | which curl > /dev/null 1091 | if test 0 = $?; then 1092 | cmd $(curl -L $ARCHIVE | tar -xz) || die "Unable to download startup scripts from $ARCHIVE" 1093 | else 1094 | which wget > /dev/null 1095 | if test 0 = $?; then 1096 | cmd $(wget -O - $ARCHIVE | tar -xz) || die "Unable to download startup scripts from $ARCHIVE" 1097 | fi 1098 | fi 1099 | 1100 | feedback_progress Done creating startup and environment script 1101 | popd 1102 | } 1103 | 1104 | ################################################################# 1105 | # perform_action 1106 | # Actually do what the user wanted 1107 | function perform_action { 1108 | trace "Entering perform_action @ = $@" 1109 | # Test that may fail goes here, before we do anything 1110 | if test 1 = "$USE_KDE4" ; then 1111 | test_kde4_available 1112 | fi 1113 | if test 1 = "$GET" -a 1 = "$SOURCES_CLEAN"; then 1114 | clean_dirs 1115 | fi 1116 | if test 1 = "$GET"; then 1117 | get_all_sources 1118 | fi 1119 | if test 1 = "$COMPILE_INSTALL" ; then 1120 | sys_info 1121 | configure_compile_install_all 1122 | fi 1123 | if test 1 = "$CREATE_STARTUP_SCRIPT" ; then 1124 | create_startup_script 1125 | fi 1126 | feedback_result SUCCESS "Everything succeeded" 1127 | } 1128 | 1129 | ################################################################################ 1130 | # MAIN AND FRIENDS 1131 | ################################################################################ 1132 | 1133 | ################################################################# 1134 | # kill_recursive 1135 | # The intention of this is to be able to kill all children, whenever the 1136 | # user aborts. 1137 | # This does not really work very very well, but its the best I can offer. 1138 | # It may leave some defunct around(?) 1139 | # $1 pid 1140 | function kill_recursive { 1141 | trace "Entering kill_recursive @ = $@" 1142 | if test "$1" != "$$"; then 1143 | # Stop it from spawning more kids 1144 | kill -9 $1 &> /dev/null 1145 | wait $1 1146 | for CP in `ps --ppid $1 -o pid=` ; do 1147 | kill_recursive $CP 1148 | done 1149 | fi 1150 | } 1151 | 1152 | ################################################################# 1153 | # keep_checking_abort 1154 | # Checks if the user indicated an abort through 1155 | function keep_checking_abort { 1156 | while test x`check_abort` = "xcont" ; do 1157 | sleep 1 1158 | done 1159 | feedback_result ABORTED "User requested abort" 1160 | # If we reach here, user aborted, kill everything in sight... 1161 | kill_recursive $MAINPID 1162 | exit 1163 | } 1164 | 1165 | ################################################################# 1166 | # main 1167 | # Collects all the steps 1168 | function main { 1169 | { 1170 | sleep 1 1171 | init_log_file 1172 | read_configuration 1173 | set_globals 1174 | } 2>&1 1175 | 1176 | # Setup abort handling 1177 | # If anyone know of a better way to get ones pid from within a subshell, let me know... 1178 | MAINPID=`/bin/bash -c "echo \\$PPID"` 1179 | # debug "Main is running with pid $MAINPID" 1180 | keep_checking_abort & 1181 | CHECKERPID=$! 1182 | # debug "Checker process is running with pid=$CHECKERPID" 1183 | 1184 | # Special case for sudo getting 1185 | SUDO="" 1186 | log "Checking for sudo requirement" 2>&1 1187 | if test "1" = "$NEED_SUDO" ; then 1188 | log "sudo is needed" 1189 | echo You have chosen to install as root. 1190 | echo 1191 | echo 'Please provide your sudo password below. (If you have recently provided your sudo password to this script, you may not have to do that, because the password is cached).' 1192 | echo 1193 | echo The password will be handled securely by the sudo program. 1194 | echo 1195 | echo If you fail to provide the password, you will have to provide it later when installing the different projects. 1196 | sudo -v 1197 | if test 0 != $? ; then 1198 | die "Unable to proceed" 1199 | fi 1200 | SUDO=sudo 1201 | fi 1202 | log "Done checking for sudo requirement" 2>&1 1203 | 1204 | { 1205 | prepare_feedback 1206 | perform_action 1207 | } 2>&1 1208 | 1209 | # All is well, that ends well 1210 | exit 0 1211 | } 1212 | 1213 | parse_args "$@" 1214 | # Call main, but if detach is given, put it in the background 1215 | if test 1 = "$DETACH"; then 1216 | main & 1217 | # Note, that we assume caller has setup stdin & stdout redirection 1218 | disown -a 1219 | else 1220 | main 1221 | fi 1222 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # Docker Command Lines 2 | 3 | ## Build Qt 6 for Linux 4 | 5 | docker build --rm -t mltframework/qt:6.4.3-ubuntu20.04 docker/qt6-build 6 | docker run -it --rm -v $PWD:/mnt mltframework/qt:6.4.3-ubuntu20.04 7 | s3cmd --acl-public put qt-6.4.3-ubuntu20.04-x86_64.txz s3://misc.meltymedia/shotcut-build/ 8 | 9 | ## Build Shotcut for Linux 10 | 11 | docker build --rm -t mltframework/shotcut-build:qt6.4.3-ubuntu20.04 docker/shotcut-build 12 | mkdir work; cd work 13 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/shotcut/master/scripts/build-shotcut.sh 14 | docker run -it --rm -v $PWD:/root/shotcut mltframework/shotcut-build:qt6.4.3-ubuntu20.04 ./build-shotcut.sh 15 | 16 | Artifacts will be in work. 17 | -------------------------------------------------------------------------------- /docker/mlt-build/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | LABEL maintainer="dan@dennedy.org" 3 | 4 | RUN apt-get update -qq \ 5 | && apt-get install -yqq gcc-mingw-w64-x86-64 libqt4-opengl-dev git automake \ 6 | autoconf libtool intltool g++ yasm nasm libmp3lame-dev libsamplerate-dev \ 7 | libxml2-dev ladspa-sdk libjack-dev libsox-dev libsdl2-dev libgtk2.0-dev \ 8 | liboil-dev libsoup2.4-dev libqt4-dev libexif-dev libdv-dev libtheora-dev \ 9 | libvorbis-dev cmake kdelibs5-dev libqjson-dev libqimageblitz-dev libeigen3-dev \ 10 | xutils-dev libegl1-mesa-dev libfftw3-dev swig python-dev python-magic flex \ 11 | gettext gperf intltool libffi-dev libltdl-dev libssl-dev libxml-parser-perl \ 12 | make openssl patch perl pkg-config python ruby scons sed unzip wget xz-utils \ 13 | bison nsis libcurl4-openssl-dev autopoint p7zip bzip2 zip curl mingw-w64 \ 14 | libxkbcommon-x11-0 15 | 16 | WORKDIR /opt 17 | RUN curl https://s3.amazonaws.com/misc.meltymedia/shotcut-build/mxe-gcc-5.1.0-x64.tar.bz2 | tar xj 18 | 19 | WORKDIR /root 20 | RUN curl https://s3.amazonaws.com/misc.meltymedia/shotcut-build/qt-5.6.1-ubuntu14.04-x86_64.tar.bz2 | tar xj 21 | RUN curl https://s3.amazonaws.com/misc.meltymedia/shotcut-build/qt-5.6.1-x64-mingw510r0-seh.tar.bz2 | tar xj 22 | RUN curl https://s3.amazonaws.com/misc.meltymedia/shotcut-build/qt-5.6.1-x86-mingw482-posix-sjlj.tar.bz2 | tar xj 23 | 24 | ADD https://s3.amazonaws.com/misc.meltymedia/shotcut-build/gtk%2B-bundle_2.24.10-20120208_win32.zip ./ 25 | ADD https://s3.amazonaws.com/misc.meltymedia/shotcut-build/gtk%2B-bundle_2.22.1-20101229_win64.zip ./ 26 | ADD https://s3.amazonaws.com/misc.meltymedia/shotcut-build/mlt-prebuilt-mingw32.tar.bz2 ./ 27 | ADD https://s3.amazonaws.com/misc.meltymedia/shotcut-build/mlt-prebuilt-mingw32-x64.tar.bz2 ./ 28 | ADD https://s3.amazonaws.com/misc.meltymedia/shotcut-build/ladspa_plugins-win-0.4.15.tar.bz2 ./ 29 | ADD https://s3.amazonaws.com/misc.meltymedia/shotcut-build/swh-plugins-win64-0.4.15.tar.bz2 ./ 30 | 31 | WORKDIR /root/shotcut 32 | VOLUME /root/shotcut 33 | ENV PATH /opt/mxe/gcc-5.1.0/usr/bin:$PATH 34 | ENTRYPOINT ["/bin/bash"] 35 | CMD ["/root/shotcut/build-shotcut.sh"] 36 | -------------------------------------------------------------------------------- /docker/mxe/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:9 2 | LABEL maintainer="dan@dennedy.org" 3 | 4 | RUN apt-get -qq update && \ 5 | apt-get install -yqq apt-utils && apt-get install -y build-essential wget \ 6 | autoconf automake bison flex gperf autopoint intltool libtool-bin python \ 7 | ruby scons unzip p7zip-full libgdk-pixbuf2.0-dev git libffi-dev lzip 8 | 9 | WORKDIR /opt 10 | 11 | CMD git clone https://github.com/mxe/mxe.git mxe && \ 12 | cd mxe && \ 13 | make JOBS=6 MXE_TARGETS='i686-w64-mingw32.shared x86_64-w64-mingw32.shared' gcc && \ 14 | cd /opt && \ 15 | tar cJf ~/mxe-gcc-5.5.0.txz mxe 16 | -------------------------------------------------------------------------------- /docker/qt6-build/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 AS base 2 | LABEL maintainer="dan@dennedy.org" 3 | 4 | FROM base as build 5 | 6 | # Add deb-src lines to make apt-get build-dep work. 7 | RUN cat /etc/apt/sources.list | sed "s/deb /deb-src /" >> /etc/apt/sources.list 8 | ARG DEBIAN_FRONTEND=noninteractive 9 | RUN apt-get -qq update && \ 10 | apt-get -yqq upgrade && \ 11 | apt-get -yqq build-dep qt5-default && \ 12 | apt-get -yqq install curl libxslt-dev libwebp-dev flex bison gperf ruby \ 13 | s3cmd libxcb1-dev libxcb-util-dev gpg software-properties-common \ 14 | g++ clang-10 libclang-10-dev libvulkan-dev ninja-build && \ 15 | curl https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - >/etc/apt/trusted.gpg.d/kitware.gpg && \ 16 | apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' && \ 17 | apt-get update -qq && \ 18 | apt-get install -yqq cmake 19 | 20 | WORKDIR /root 21 | RUN curl -L https://download.qt.io/official_releases/qt/6.4/6.4.3/single/qt-everywhere-src-6.4.3.tar.xz | tar xJ 22 | 23 | RUN cmake -S qt-everywhere-src-6.4.3 -B build -G Ninja -Wno-dev \ 24 | -D CMAKE_INSTALL_PREFIX=/root/Qt/6.4.3/gcc_64 \ 25 | -D CMAKE_BUILD_TYPE=Release \ 26 | -D FEATURE_sql=ON \ 27 | -D QT_BUILD_EXAMPLES=OFF \ 28 | -D QT_BUILD_TESTS=OFF \ 29 | -D BUILD_qt3d=OFF \ 30 | -D BUILD_qtwebengine=OFF \ 31 | -D FEATURE_openssl_runtime=ON 32 | RUN cmake --build build --parallel --target install 33 | RUN cd /root && \ 34 | printf "[Paths]\nPrefix=..\n" > Qt/6.4.3/gcc_64/bin/qt.conf && \ 35 | cp -p /usr/lib/x86_64-linux-gnu/libicu*.so.66 Qt/6.4.3/gcc_64/lib 36 | 37 | FROM base 38 | ARG DEBIAN_FRONTEND=noninteractive 39 | RUN apt-get -qq update && apt-get -yqq install xz-utils 40 | 41 | WORKDIR /root 42 | COPY --from=build /root/Qt/ /root/Qt/ 43 | 44 | CMD tar cJf /mnt/qt-6.4.3-ubuntu20.04-x86_64.txz Qt 45 | -------------------------------------------------------------------------------- /docker/shotcut-build/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | LABEL maintainer="dan@dennedy.org" 3 | 4 | ARG DEBIAN_FRONTEND=noninteractive 5 | RUN apt-get update -qq && \ 6 | apt-get -yqq upgrade && \ 7 | apt-get install -yqq git automake autoconf libmp3lame-dev libepoxy-dev \ 8 | libtool intltool nasm yasm python3-pip ninja-build gfortran \ 9 | libmp3lame-dev libsamplerate-dev libarchive-dev libpotrace-dev \ 10 | libxml2-dev ladspa-sdk libjack-dev libsox-dev libsdl2-dev libgtk2.0-dev \ 11 | libxslt1-dev libexif-dev libdv-dev libtheora-dev libwebp-dev libfftw3-dev \ 12 | libvorbis-dev libeigen3-dev libxkbcommon-x11-0 libegl1-mesa-dev \ 13 | gettext gperf intltool swig python3.9-dev python-is-python3 flex bison make \ 14 | xutils-dev libffi-dev libltdl-dev libssl-dev libxml-parser-perl \ 15 | openssl patch perl pkg-config ruby scons sed unzip wget xz-utils \ 16 | libcurl4-openssl-dev autopoint p7zip bzip2 zip curl libva-dev \ 17 | apt-transport-https ca-certificates gnupg software-properties-common \ 18 | libdouble-conversion-dev va-driver-all libxcb-xinerama0 libxcb-icccm4 \ 19 | libxcb-image0 libxcb-keysyms1 libxcb-render-util0 liblist-moreutils-perl && \ 20 | curl https://apt.kitware.com/keys/kitware-archive-latest.asc | gpg --dearmor - >/etc/apt/trusted.gpg.d/kitware.gpg && \ 21 | apt-add-repository 'ppa:ubuntu-toolchain-r/test' && \ 22 | apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' && \ 23 | apt-get update -qq && \ 24 | apt-get install -yqq g++-10 cmake libclang-cpp10 && \ 25 | pip3 install meson 26 | 27 | ENV CC=gcc-10 CXX=g++-10 28 | WORKDIR /root 29 | COPY --from=mltframework/qt:6.4.3-ubuntu20.04 /root/Qt Qt 30 | 31 | WORKDIR /root/shotcut 32 | ENTRYPOINT ["/bin/bash"] 33 | CMD ["/root/shotcut/build-shotcut.sh"] 34 | -------------------------------------------------------------------------------- /teamcity/flowblade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by teamcity to retrieve the flowblade script and run it 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | # Get Script 11 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/mlt-scripts/master/build/build-flowblade.sh 12 | echo 'INSTALL_DIR="$(pwd)/flowblade"' >> build-flowblade.conf 13 | echo 'AUTO_APPEND_DATE=0' >> build-flowblade.conf 14 | echo 'SOURCE_DIR="$(pwd)/src"' >> build-flowblade.conf 15 | chmod 755 build-flowblade.sh 16 | 17 | # Run Script 18 | ./build-flowblade.sh 2>&1 | tee output.txt 19 | 20 | # Check for need to retry 21 | if grep "Unable to git clone source for" output.txt 22 | then 23 | minutes=60 24 | while [ $minutes -gt 0 ]; do 25 | echo "Git clone failed. Retrying in $minutes minutes." 26 | sleep 60 27 | minutes=$((minutes-1)) 28 | done 29 | ./build-flowblade.sh 2>&1 | tee output.txt 30 | fi 31 | 32 | if grep "Some kind of error occured" output.txt; then 33 | echo "Build failed" 34 | exit 1 35 | fi 36 | 37 | # Create Archive 38 | tar -cjvf flowblade.tar.bz2 flowblade 39 | rm -Rf flowblade src build-flowblade.conf build-flowblade.sh output.txt 40 | -------------------------------------------------------------------------------- /teamcity/kdenlive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by teamcity to retrieve the kdenlive script and run it 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | # Get Script 11 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/mlt-scripts/master/build/build-kdenlive.sh 12 | echo 'INSTALL_DIR="$(pwd)/kdenlive"' >> build-kdenlive.conf 13 | echo 'AUTO_APPEND_DATE=0' >> build-kdenlive.conf 14 | echo 'SOURCE_DIR="$(pwd)/src"' >> build-kdenlive.conf 15 | chmod 755 build-kdenlive.sh 16 | 17 | # Run Script 18 | ./build-kdenlive.sh 2>&1 | tee output.txt 19 | 20 | # Check for need to retry 21 | if grep "Unable to git clone source for" output.txt 22 | then 23 | minutes=60 24 | while [ $minutes -gt 0 ]; do 25 | echo "Git clone failed. Retrying in $minutes minutes." 26 | sleep 60 27 | minutes=$((minutes-1)) 28 | done 29 | ./build-kdenlive.sh 2>&1 | tee output.txt 30 | fi 31 | 32 | if grep "Some kind of error occured" output.txt; then 33 | echo "Build failed" 34 | exit 1 35 | fi 36 | 37 | # Create Archive 38 | tar -cjvf kdenlive.tar.bz2 kdenlive 39 | rm -Rf kdenlive src build-kdenlive.conf build-kdenlive.sh output.txt 40 | -------------------------------------------------------------------------------- /teamcity/melt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by teamcity to retrieve the melt script and run it 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | # Get Script 11 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/mlt-scripts/master/build/build-melt.sh 12 | echo 'INSTALL_DIR="$(pwd)/melt"' >> build-melt.conf 13 | echo 'AUTO_APPEND_DATE=0' >> build-melt.conf 14 | echo 'SOURCE_DIR="$(pwd)/src"' >> build-melt.conf 15 | echo 'FFMPEG_ADDITIONAL_OPTIONS=--disable-videotoolbox' >> build-melt.conf 16 | echo "FFMPEG_HEAD=0" >> build-melt.conf 17 | echo "FFMPEG_REVISION=origin/release/6.1" >> build-melt.conf 18 | chmod 755 build-melt.sh 19 | 20 | # Run Script 21 | ./build-melt.sh 2>&1 | tee output.txt 22 | 23 | # Check for need to retry 24 | if grep "Unable to git clone source for" output.txt 25 | then 26 | minutes=60 27 | while [ $minutes -gt 0 ]; do 28 | echo "Git clone failed. Retrying in $minutes minutes." 29 | sleep 60 30 | minutes=$((minutes-1)) 31 | done 32 | ./build-melt.sh 2>&1 | tee output.txt 33 | fi 34 | 35 | if grep "Some kind of error occured" output.txt; then 36 | echo "Build failed" 37 | exit 1 38 | fi 39 | 40 | # Create Archive 41 | tar -cjvf melt.tar.bz2 melt 42 | rm -Rf melt src build-melt.conf build-melt.sh output.txt 43 | -------------------------------------------------------------------------------- /teamcity/melted.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by teamcity to retrieve the melted script and run it 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | # Get Script 11 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/mlt-scripts/master/build/build-melted.sh 12 | echo 'INSTALL_DIR="$(pwd)/melted"' >> build-melted.conf 13 | echo 'AUTO_APPEND_DATE=0' >> build-melted.conf 14 | echo 'SOURCE_DIR="$(pwd)/src"' >> build-melted.conf 15 | chmod 755 build-melted.sh 16 | 17 | # Run Script 18 | ./build-melted.sh 2>&1 | tee output.txt 19 | 20 | # Check for need to retry 21 | if grep "Unable to git clone source for" output.txt 22 | then 23 | minutes=60 24 | while [ $minutes -gt 0 ]; do 25 | echo "Git clone failed. Retrying in $minutes minutes." 26 | sleep 60 27 | minutes=$((minutes-1)) 28 | done 29 | ./build-melted.sh 2>&1 | tee output.txt 30 | fi 31 | 32 | if grep "Some kind of error occured" output.txt; then 33 | echo "Build failed" 34 | exit 1 35 | fi 36 | 37 | # Create Archive 38 | tar -cjvf melted.tar.bz2 melted 39 | rm -Rf melted src build-melted.conf build-melted.sh output.txt 40 | -------------------------------------------------------------------------------- /teamcity/openshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by teamcity to retrieve the openshot script and run it 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | # Get Script 11 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/mlt-scripts/master/build/build-openshot.sh 12 | echo 'INSTALL_DIR="$(pwd)/openshot"' >> build-openshot.conf 13 | echo 'AUTO_APPEND_DATE=0' >> build-openshot.conf 14 | echo 'SOURCE_DIR="$(pwd)/src"' >> build-openshot.conf 15 | chmod 755 build-openshot.sh 16 | 17 | # Run Script 18 | ./build-openshot.sh 2>&1 | tee output.txt 19 | 20 | # Check for need to retry 21 | if grep "Unable to git clone source for" output.txt 22 | then 23 | minutes=60 24 | while [ $minutes -gt 0 ]; do 25 | echo "Git clone failed. Retrying in $minutes minutes." 26 | sleep 60 27 | minutes=$((minutes-1)) 28 | done 29 | ./build-openshot.sh 2>&1 | tee output.txt 30 | fi 31 | 32 | if grep "Some kind of error occured" output.txt; then 33 | echo "Build failed" 34 | exit 1 35 | fi 36 | 37 | # Create Archive 38 | tar -cjvf openshot.tar.bz2 openshot 39 | rm -Rf openshot src build-openshot.conf build-openshot.sh output.txt 40 | -------------------------------------------------------------------------------- /teamcity/shotcut.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by teamcity to retrieve the shotcut script and run it 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | function usage { 11 | echo "Usage: $0 [-o target-os] [-s] [-v version]" 12 | echo "Where:" 13 | echo -e "\t-o target-os\tDefaults to $(uname -s); use Win32 or Win64 to cross-compile" 14 | echo -e "\t-s\t\tbuild SDK (Linux and Windows only)" 15 | echo -e "\t-v shotcut-version\tOverride the version computed from date" 16 | } 17 | 18 | SDK= 19 | TARGET_OS="$(uname -s)" 20 | SHOTCUT_VERSION= 21 | 22 | while getopts ":so:v:" OPT; do 23 | case $OPT in 24 | s ) SDK=1;; 25 | h ) usage 26 | exit 0;; 27 | o ) TARGET_OS=$OPTARG;; 28 | v ) SHOTCUT_VERSION=$OPTARG;; 29 | * ) echo "Unknown option $OPT" 30 | usage 31 | exit 1;; 32 | esac 33 | done 34 | 35 | # Get Script 36 | if [ ! -f build-shotcut.sh ]; then 37 | wget --no-check-certificate https://raw.githubusercontent.com/mltframework/shotcut/master/scripts/build-shotcut.sh 38 | chmod 755 build-shotcut.sh 39 | echo 'INSTALL_DIR="$PWD/shotcut"' >> build-shotcut.conf 40 | echo 'SOURCE_DIR="$PWD/src"' >> build-shotcut.conf 41 | [ "$SDK" = "1" ] && echo 'DEBUG_BUILD=1' >> build-shotcut.conf 42 | [ "$SHOTCUT_VERSION" != "" ] && echo 'SHOTCUT_VERSION=$SHOTCUT_VERSION' >> build-shotcut.conf 43 | fi 44 | 45 | # Run Script 46 | if [ "$TARGET_OS" = "Darwin" ]; then 47 | ./build-shotcut.sh "$@" 2>&1 | tee output.txt 48 | else 49 | docker run --rm -v $PWD:/root/shotcut ddennedy/shotcut-build ./build-shotcut.sh "$@" 2>&1 | tee output.txt 50 | fi 51 | 52 | # Check for need to retry 53 | if grep "Unable to git clone source for" output.txt 54 | then 55 | minutes=60 56 | while [ $minutes -gt 0 ]; do 57 | echo "Git clone failed. Retrying in $minutes minutes." 58 | sleep 60 59 | minutes=$((minutes-1)) 60 | done 61 | if [ "$TARGET_OS" = "Darwin" ]; then 62 | ./build-shotcut.sh "$@" 2>&1 | tee output.txt 63 | else 64 | docker run --rm -v $PWD:/root/shotcut ddennedy/shotcut-build ./build-shotcut.sh "$@" 2>&1 | tee output.txt 65 | fi 66 | fi 67 | 68 | if grep "Some kind of error occured" output.txt; then 69 | echo "Build failed" 70 | exit 1 71 | fi 72 | 73 | # For Windows sign and make installer 74 | if [ "$TARGET_OS" = "Win32" -o "$TARGET_OS" = "Win64" ] && [ "$SDK" != "1" ]; then 75 | echo "Making Windows installer" 76 | cd shotcut/Shotcut 77 | osslsigncode sign -pkcs12 "$HOME/CodeSignCertificates.p12" -readpass "$HOME/CodeSignCertificates.pass" \ 78 | -n "Shotcut" -i "https://www.meltytech.com" -t "http://timestamp.digicert.com" \ 79 | -in shotcut.exe -out shotcut-signed.exe 80 | mv shotcut-signed.exe shotcut.exe 81 | cd .. 82 | zip -gr shotcut.zip Shotcut 83 | makensis shotcut.nsi 84 | osslsigncode sign -pkcs12 "$HOME/CodeSignCertificates.p12" -readpass "$HOME/CodeSignCertificates.pass" \ 85 | -n "Shotcut Installer" -i "https://www.meltytech.com" -t "http://timestamp.digicert.com" \ 86 | -in shotcut-setup.exe -out shotcut-setup-signed.exe 87 | mv shotcut-setup-signed.exe shotcut-setup.exe 88 | cd .. 89 | fi 90 | 91 | # Cleanup 92 | rm -rf src 93 | rm *.sh 94 | rm *.conf 95 | rm output.txt 96 | -------------------------------------------------------------------------------- /teamcity/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script is used by teamcity to retrieve all the test scripts and run them. 4 | # Author: Brian Matherly 5 | # License: GPL2 6 | 7 | set -o nounset 8 | set -o errexit 9 | 10 | test_latest() 11 | { 12 | # Run the tests that require a fresh build of the latest mlt. 13 | # Get it and compile it. 14 | echo 'INSTALL_DIR="$(pwd)/melt"' >> build-melt.conf 15 | echo 'AUTO_APPEND_DATE=0' >> build-melt.conf 16 | echo 'SOURCE_DIR="$(pwd)/src"' >> build-melt.conf 17 | ./build/build-melt.sh 18 | 19 | # Test must run in the melt directory 20 | pushd melt 21 | # Run the YML test 22 | ../test/test_yml.sh 23 | 24 | # Run the A/V sync test 25 | ../test/test_avsync.sh 26 | 27 | # Run the qtests 28 | ../test/test_qtest.sh -s "$PWD/../src/mlt" 29 | popd 30 | 31 | # Cleanup 32 | rm -Rf melt src build-melt.* 33 | } 34 | 35 | test_libav_regression() 36 | { 37 | # Run the script 38 | ./test/test_libav_regression.sh 39 | } 40 | 41 | test_latest 42 | test_libav_regression 43 | -------------------------------------------------------------------------------- /test/report_results.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script provides useful functions for the mlt test scripts. The output 4 | # can be configured to be human readable or compatible with teamcity test 5 | # reports. 6 | # 7 | # Author: Brian Matherly 8 | # License: GPL2 9 | 10 | declare -r GREEN_ESC="\E[0;32m" 11 | declare -r RED_ESC="\E[0;31m" 12 | declare -r NORMAL_ESC="\E[0;10m" 13 | 14 | declare suite_name="" 15 | declare test_name="" 16 | declare -i teamcity_format=0 17 | 18 | report_tc_format() 19 | { 20 | teamcity_format=1 21 | } 22 | 23 | report_suite_start() 24 | { 25 | suite_name=$1 26 | if [ $teamcity_format -eq 1 ]; then 27 | echo "##teamcity[testSuiteStarted name='$suite_name']" 28 | else 29 | echo -en $GREEN_ESC 30 | echo "Started test suite: $suite_name" 31 | echo -en $NORMAL_ESC 32 | fi 33 | } 34 | 35 | report_suite_finish() 36 | { 37 | if [ $teamcity_format -eq 1 ]; then 38 | echo "##teamcity[testSuiteFinished name='$suite_name']" 39 | else 40 | echo -en $GREEN_ESC 41 | echo "Finished test suite: $suite_name" 42 | echo -en $NORMAL_ESC 43 | fi 44 | } 45 | 46 | report_test_start() 47 | { 48 | test_name=$1 49 | if [ $teamcity_format -eq 1 ]; then 50 | echo "##teamcity[testStarted name='$test_name' captureStandardOutput='true']" 51 | else 52 | echo -en $GREEN_ESC 53 | echo "Started test: $test_name" 54 | echo -en $NORMAL_ESC 55 | fi 56 | } 57 | 58 | report_test_finish() 59 | { 60 | if [ $teamcity_format -eq 1 ]; then 61 | echo "##teamcity[testFinished name='$test_name']" 62 | else 63 | echo -en $GREEN_ESC 64 | echo "Finished test: $test_name" 65 | echo -en $NORMAL_ESC 66 | fi 67 | } 68 | 69 | report_test_fail() 70 | { 71 | fail_message=$1 72 | if [ $teamcity_format -eq 1 ]; then 73 | echo "##teamcity[testFailed name='$test_name' message='$fail_message']" 74 | else 75 | echo -en $RED_ESC 76 | echo "Failed test: $test_name" 77 | echo " $fail_message" 78 | echo -en $NORMAL_ESC 79 | fi 80 | } 81 | -------------------------------------------------------------------------------- /test/test_avsync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script tests the A/V sync of various formats using the blipflash 4 | # producer and consumer. 5 | # 6 | # Author: Brian Matherly 7 | # License: GPL2 8 | 9 | # Set up path for melt 10 | source source-me 11 | # Include reporting functions 12 | source ../test/report_results.sh 13 | 14 | declare -r TEST_DURATION=200 # 200 frames 15 | declare -r RESULTS_FILE="results.txt" 16 | declare -r TMP_FILE="tmp_output" 17 | declare -r ONE_FRAME_MS="33.4" # 29.97 plus a little slop for rounding errors 18 | 19 | TEST_NAME[0]="avformat-avi" 20 | TEST_CMDS[0]="melt -silent -profile dv_ntsc blipflash out=$TEST_DURATION -consumer avformat:$TMP_FILE.avi acodec=mp2 terminate_on_pause=1; 21 | melt -silent -profile dv_ntsc avformat:$TMP_FILE.avi -consumer blipflash:$RESULTS_FILE terminate_on_pause=1;" 22 | 23 | TEST_NAME[1]="avformat-dv" 24 | TEST_CMDS[1]="melt -silent -profile dv_ntsc blipflash out=$TEST_DURATION -consumer avformat:$TMP_FILE.dv pix_fmt=yuv422p terminate_on_pause=1; 25 | melt -silent -profile dv_ntsc avformat:$TMP_FILE.dv -consumer blipflash:$RESULTS_FILE terminate_on_pause=1" 26 | 27 | TEST_NAME[2]="avformat-mkv" 28 | TEST_CMDS[2]="melt -silent -profile dv_ntsc blipflash out=$TEST_DURATION -consumer avformat:$TMP_FILE.mkv terminate_on_pause=1; 29 | melt -silent -profile dv_ntsc avformat:$TMP_FILE.mkv -consumer blipflash:$RESULTS_FILE terminate_on_pause=1" 30 | 31 | TEST_NAME[3]="avformat-mov" 32 | TEST_CMDS[3]="melt -silent -profile dv_ntsc blipflash out=$TEST_DURATION -consumer avformat:$TMP_FILE.mov strict=-2 terminate_on_pause=1; 33 | melt -silent -profile dv_ntsc avformat:$TMP_FILE.mov -consumer blipflash:$RESULTS_FILE terminate_on_pause=1" 34 | 35 | TEST_NAME[4]="avformat-mp4" 36 | TEST_CMDS[4]="melt -silent -profile dv_ntsc blipflash out=$TEST_DURATION -consumer avformat:$TMP_FILE.mp4 strict=-2 terminate_on_pause=1; 37 | melt -silent -profile dv_ntsc avformat:$TMP_FILE.mp4 -consumer blipflash:$RESULTS_FILE terminate_on_pause=1" 38 | 39 | TEST_NAME[5]="avformat-mpg" 40 | TEST_CMDS[5]="melt -silent -profile dv_ntsc blipflash out=$TEST_DURATION -consumer avformat:$TMP_FILE.mpg vcodec=mpeg2video terminate_on_pause=1; 41 | melt -silent -profile dv_ntsc avformat:$TMP_FILE.mpg -consumer blipflash:$RESULTS_FILE terminate_on_pause=1" 42 | 43 | print_help() 44 | { 45 | cat < -$ONE_FRAME_MS)" | bc` 91 | if [ -z "$in_sync" ] || [ "$in_sync" -ne "1" ]; then 92 | report_test_fail "Out of sync. Offset: $offset" 93 | fi 94 | fi 95 | fi 96 | 97 | rm -f $RESULTS_FILE 98 | rm -f $TMP_FILE.* 99 | report_test_finish 100 | done 101 | } 102 | 103 | parse_args "$@" 104 | report_suite_start "avsync" 105 | run_tests 106 | report_suite_finish 107 | 108 | -------------------------------------------------------------------------------- /test/test_libav_regression.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script compiles mlt against all supported branches of ffmpeg and libav. 4 | # 5 | # Author: Brian Matherly 6 | # License: GPL2 7 | 8 | source ./test/report_results.sh 9 | 10 | FFBRANCH[0]="ffmpeg_master" 11 | FFBRANCH[1]="ffmpeg_4_0" 12 | FFBRANCH[2]="ffmpeg_4_1" 13 | FFBRANCH[3]="ffmpeg_4_2" 14 | FFBRANCH[4]="ffmpeg_4_3" 15 | FFBRANCH[5]="ffmpeg_4_4" 16 | 17 | CONFIG[0]=' 18 | FFMPEG_HEAD=1 19 | FFMPEG_PROJECT="FFmpeg"' 20 | CONFIG[1]=' 21 | FFMPEG_HEAD=0 22 | FFMPEG_REVISION="origin/release/4.0" 23 | FFMPEG_PROJECT="FFmpeg" 24 | FFMPEG_SUPPORT_H264=0 25 | FFMPEG_SUPPORT_H265=0 26 | FFMPEG_SUPPORT_LIBVPX=0 27 | FFMPEG_SUPPORT_THEORA=0 28 | FFMPEG_SUPPORT_MP3=0 29 | FFMPEG_SUPPORT_FAAC=0' 30 | CONFIG[2]=' 31 | FFMPEG_HEAD=0 32 | FFMPEG_REVISION="origin/release/4.1" 33 | FFMPEG_PROJECT="FFmpeg" 34 | FFMPEG_SUPPORT_H264=0 35 | FFMPEG_SUPPORT_H265=0 36 | FFMPEG_SUPPORT_LIBVPX=0 37 | FFMPEG_SUPPORT_THEORA=0 38 | FFMPEG_SUPPORT_MP3=0 39 | FFMPEG_SUPPORT_FAAC=0' 40 | CONFIG[3]=' 41 | FFMPEG_HEAD=0 42 | FFMPEG_REVISION="origin/release/4.2" 43 | FFMPEG_PROJECT="FFmpeg" 44 | FFMPEG_SUPPORT_H264=0 45 | FFMPEG_SUPPORT_H265=0 46 | FFMPEG_SUPPORT_LIBVPX=0 47 | FFMPEG_SUPPORT_THEORA=0 48 | FFMPEG_SUPPORT_MP3=0 49 | FFMPEG_SUPPORT_FAAC=0' 50 | CONFIG[4]=' 51 | FFMPEG_HEAD=0 52 | FFMPEG_REVISION="origin/release/4.3" 53 | FFMPEG_PROJECT="FFmpeg" 54 | FFMPEG_SUPPORT_H264=0 55 | FFMPEG_SUPPORT_H265=0 56 | FFMPEG_SUPPORT_LIBVPX=0 57 | FFMPEG_SUPPORT_THEORA=0 58 | FFMPEG_SUPPORT_MP3=0 59 | FFMPEG_SUPPORT_FAAC=0' 60 | CONFIG[5]=' 61 | FFMPEG_HEAD=0 62 | FFMPEG_REVISION="origin/release/4.4" 63 | FFMPEG_PROJECT="FFmpeg" 64 | FFMPEG_SUPPORT_H264=0 65 | FFMPEG_SUPPORT_H265=0 66 | FFMPEG_SUPPORT_LIBVPX=0 67 | FFMPEG_SUPPORT_THEORA=0 68 | FFMPEG_SUPPORT_MP3=0 69 | FFMPEG_SUPPORT_FAAC=0' 70 | 71 | declare archive_artifact=0 72 | 73 | print_help() 74 | { 75 | cat <> build-melt.conf 115 | echo 'SOURCE_DIR="$PWD/src"' >> build-melt.conf 116 | echo 'AUTO_APPEND_DATE=0' >> build-melt.conf 117 | echo 'ENABLE_FREI0R=0' >> build-melt.conf 118 | echo 'ENABLE_SWFDEC=0' >> build-melt.conf 119 | echo 'ENABLE_MOVIT=0' >> build-melt.conf 120 | echo 'ENABLE_VIDSTAB=0' >> build-melt.conf 121 | echo 'ENABLE_WEBVFX=0' >> build-melt.conf 122 | echo 'ENABLE_RUBBERBAND=0' >> build-melt.conf 123 | 124 | for param in ${CONFIG[$1]} ; do 125 | echo $param >> build-melt.conf 126 | done 127 | } 128 | 129 | cleanup_test() 130 | { 131 | rm -Rf melt src/FFmpeg src/libav build-melt.conf 132 | } 133 | 134 | run_tests() 135 | { 136 | 137 | branch_count=${#CONFIG[@]} 138 | echo "$branch_count branches to build" 139 | 140 | for (( i=0; i<${branch_count}; i++ )); 141 | do 142 | report_test_start ${FFBRANCH[$i]} 143 | init_test $i 144 | 145 | ./build/build-melt.sh 146 | if [ $? -ne 0 ] || [ ! -f "melt/bin/melt" ]; then 147 | report_test_fail "Failed to build melt against ${FFBRANCH[$i]}" 148 | fi 149 | 150 | if [ "$archive_artifact" -ne "0" ]; then 151 | tar -czvf ${FFBRANCH[$i]}.tar.gz melt 152 | fi 153 | 154 | cleanup_test 155 | report_test_finish 156 | done 157 | } 158 | 159 | parse_args "$@" 160 | report_suite_start "libav_regression" 161 | init_suite 162 | run_tests 163 | cleanup_suite 164 | report_suite_finish 165 | -------------------------------------------------------------------------------- /test/test_qtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script runs the QTest tests 4 | # 5 | # If the RadixRespondsToLocale teset fails then run this command: 6 | # sudo locale-gen de_DE 7 | # 8 | # Author: Brian Matherly 9 | # License: GPL2 10 | 11 | # Set up path for melt 12 | source source-me 13 | # Include reporting functions 14 | source ../test/report_results.sh 15 | 16 | declare MLT_SOURCE_PATH="" 17 | 18 | print_help() 19 | { 20 | cat < Specify the mlt [s]ource path (required) 26 | -t Report in [t]eamcity format 27 | ------------------------------------------------------------------------- 28 | EOM 29 | } 30 | 31 | parse_args() 32 | { 33 | while getopts "ehs:t" opt; do 34 | case $opt in 35 | e) set -e;; 36 | h) print_help; exit 0;; 37 | s) MLT_SOURCE_PATH=$OPTARG;; 38 | t) report_tc_format;; 39 | *) echo "unknown arg: $opt"; print_help; exit 1;; 40 | esac 41 | done 42 | 43 | if [ "x$MLT_SOURCE_PATH" == "x" ]; then 44 | echo "The path to the MLT source must be provided using the -s argument" 45 | print_help 46 | exit 1 47 | fi 48 | } 49 | 50 | filter_results() 51 | { 52 | # This function filters results from "make check" and converts them to the 53 | # standard reporting format (Teamcity or not) as configured. 54 | while read data 55 | do 56 | # Detect the test suite start 57 | if [[ $data == *initTestCase* ]]; then 58 | suitename=${data%%::*} 59 | suitename=${suitename##*:} 60 | report_suite_start $suitename 61 | fi 62 | 63 | # Process output and report pass/fail 64 | case $data in 65 | 'PASS '*) 66 | testname=${data##*:} 67 | testname=${testname%%()*} 68 | report_test_start $testname 69 | echo $data 70 | report_test_finish 71 | ;; 72 | 'FAIL! '*) 73 | testname=${data##*:} 74 | testname=${testname%%()*} 75 | report_test_start $testname 76 | echo $data 77 | failmsg=${data#*)} 78 | report_test_fail "$failmsg" 79 | ;; 80 | *) 81 | echo $data 82 | ;; 83 | esac 84 | 85 | # Detect the test suite end 86 | if [[ $data == Totals:* ]]; then 87 | report_suite_finish 88 | fi 89 | done 90 | } 91 | 92 | compile_tests() 93 | { 94 | report_test_start "Compile" 95 | pushd $MLT_SOURCE_PATH/src/tests 96 | if [ "$QTDIR" = "" ]; then 97 | qmake -r tests.pro 98 | else 99 | $QTDIR/bin/qmake -r tests.pro 100 | fi 101 | make 102 | RETVAL=$? 103 | popd 104 | 105 | if [ $RETVAL -eq 0 ]; then 106 | report_test_finish 107 | else 108 | report_test_fail "Failed to compile qtest suite" 109 | fi 110 | } 111 | 112 | run_tests() 113 | { 114 | pushd $MLT_SOURCE_PATH/src/tests 115 | make check | filter_results 116 | popd 117 | } 118 | 119 | parse_args "$@" 120 | report_suite_start "qtest" 121 | compile_tests 122 | run_tests 123 | report_suite_finish "qtest" 124 | -------------------------------------------------------------------------------- /test/test_yml.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script tests all the service metadata for correctness. It does this by 4 | # using kwalify to test against each .yml file to be checked against the schema. 5 | # Additionally, it runs melt to make sure melt can parse the file. 6 | # 7 | # Author: Brian Matherly 8 | # License: GPL2 9 | 10 | source ../test/report_results.sh 11 | 12 | print_help() 13 | { 14 | cat < /dev/null; 49 | if [ $? -ne 0 ]; then 50 | report_test_fail "failed to run kwalify -f share/mlt/metaschema.yaml $file" 51 | fi 52 | 53 | ./melt -query $service_type=$service_name > /dev/null; 54 | if [ $? -ne 0 ]; then 55 | report_test_fail "failed to run melt -query $service_type=$service_name" 56 | fi 57 | report_test_finish 58 | done 59 | } 60 | 61 | parse_args "$@" 62 | report_suite_start "yml" 63 | run_tests 64 | report_suite_finish 65 | 66 | --------------------------------------------------------------------------------