Blame docker-builder-data/build/script/packet/opentoonz-master.sh

339e9b
DEPS="jpeg-9b png-1.6.26 lz4-master lzo-2.10 lzma-5.2.3 glew-2.0.0 freeglut-3.0.0 superlu-5.2.1 openblas-master boost-1.61.0 qt-5.7"
3b09af
DEPS_NATIVE="cmake-3.6.2"
e14835
e14835
PK_DIRNAME="opentoonz"
e14835
PK_URL="https://github.com/opentoonz/$PK_DIRNAME.git"
99b145
PK_LICENSE_FILES="README.md LICENSE.txt thirdparty/tiff-4.0.3/COPYRIGHT"
e14835
cf8c28
PK_CONFIGURE_OPTIONS=
cf8c28
99b145
source $INCLUDE_SCRIPT_DIR/inc-pkall-git.sh
e14835
cf8c28
if [ "$PLATFORM" = "linux" ]; then
cf8c28
    DEPS="$DEPS usb-1.0.20 sdl-2.0.5"
cf8c28
fi
cf8c28
183b24
pkhook_version() {
183b24
    cat "$PK_DIRNAME/toonz/sources/toonz/main.cpp" \
183b24
    | grep "const.char.\*applicationFullName.=.\"OpenToonz." \
183b24
    | cut -d \" -f 2 \
183b24
    | cut -d " " -f 2 \
183b24
    || return 1
183b24
}
183b24
e14835
pkbuild() {
cf8c28
    local LOCAL_OPTIONS=
cf8c28
    local LOCAL_CMAKE_OPTIONS=
cf8c28
    if [ ! -z "$HOST" ]; then
cf8c28
        LOCAL_OPTIONS="--host=$HOST"
cf8c28
    fi
cf8c28
    if [ "$PLATFORM" = "win" ]; then
cf8c28
        LOCAL_CMAKE_OPTIONS="-DCMAKE_SYSTEM_NAME=Windows"
cf8c28
    fi
cf8c28
e0593e
    if ! check_packet_function $NAME build.libtiff; then
e0593e
        cd "$BUILD_PACKET_DIR/$PK_DIRNAME/thirdparty/tiff-4.0.3"
e0593e
        if ! check_packet_function $NAME build.libtiff.configure; then
cf8c28
            CFLAGS="$CFLAGS -fPIC" ./configure $LOCAL_OPTIONS || return 1
cf8c28
           set_done $NAME build.libtiff.configure
e0593e
        fi
cf8c28
        make clean
e0593e
        make -j${THREADS} || return 1
e0593e
        set_done $NAME build.libtiff
e14835
    fi
cf5576
cf8c28
    rm -rf "$BUILD_PACKET_DIR/$PK_DIRNAME/toonz/build"
e0593e
    mkdir -p "$BUILD_PACKET_DIR/$PK_DIRNAME/toonz/build"
e0593e
    cd "$BUILD_PACKET_DIR/$PK_DIRNAME/toonz/build"
e0593e
    if ! check_packet_function $NAME build.configure; then
e0593e
        if ! cmake \
e0593e
              -DCMAKE_PREFIX_PATH="$ENVDEPS_PACKET_DIR" \
e0593e
              -DCMAKE_MODULE_PATH="$ENVDEPS_NATIVE_PACKET_DIR/share/cmake-3.6.2/Modules" \
e0593e
              -DCMAKE_INSTALL_PREFIX="$INSTALL_PACKET_DIR" \
cf8c28
              $LOCAL_CMAKE_OPTIONS \
cf8c28
              $PK_CONFIGURE_OPTIONS \
e0593e
              ../sources; \
e0593e
        then
e0593e
            return 1
e0593e
        fi
e0593e
        set_done $NAME build.configure
cf5576
    fi
cf8c28
    
cf8c28
    make -j${THREADS} || return 1
e14835
}
e14835
e14835
pkinstall() {
e14835
    cd "$BUILD_PACKET_DIR/$PK_DIRNAME/toonz/build"
e0593e
    make install || return 1
cf8c28
    if [ "$PLATFORM" = "win" ]; then
cf8c28
        cp --remove-destination "$BUILD_PACKET_DIR/$PK_DIRNAME/thirdparty/tiff-4.0.3/libtiff/.libs/libtiff-5.dll" "$INSTALL_PACKET_DIR/bin/" || return 1
cf8c28
        cp --remove-destination "$BUILD_PACKET_DIR/$PK_DIRNAME/thirdparty/tiff-4.0.3/libtiff/.libs/libtiffxx-5.dll" "$INSTALL_PACKET_DIR/bin/" || return 1
cf8c28
    else
cf8c28
        cp --remove-destination "$FILES_PACKET_DIR/launch-opentoonz.sh" "$INSTALL_PACKET_DIR/bin" || return 1
cf8c28
        cp --remove-destination $BUILD_PACKET_DIR/$PK_DIRNAME/thirdparty/tiff-4.0.3/libtiff/.libs/libtiff.so* "$INSTALL_PACKET_DIR/lib" || return 1
cf8c28
        cp --remove-destination $BUILD_PACKET_DIR/$PK_DIRNAME/thirdparty/tiff-4.0.3/libtiff/.libs/libtiffxx.so* "$INSTALL_PACKET_DIR/lib" || return 1
cf8c28
    fi
99b145
99b145
    if [ "$PLATFORM" = "win" ]; then
99b145
        local TARGET="$INSTALL_PACKET_DIR/bin/"
99b145
        local LOCAL_DIR="/usr/$HOST/sys-root/mingw/bin/"
99b145
        cp $LOCAL_DIR/libgcc*.dll        "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libgfortran*.dll   "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libquadmath*.dll   "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libstdc*.dll       "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libwinpthread*.dll "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/zlib*.dll          "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libgettextlib*.dll "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libintl*.dll       "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/iconv*.dll         "$TARGET" || return 1
99b145
        cp $LOCAL_DIR/libtermcap*.dll    "$TARGET" || return 1
99b145
    else
99b145
        local TARGET="$INSTALL_PACKET_DIR/lib/"
99b145
        copy_system_lib libudev          "$TARGET" || return 1
99b145
        copy_system_lib libgfortran      "$TARGET" || return 1
99b145
    fi
cf8c28
}
cf8c28
99b145
pkhook_postlicense() {
99b145
    local TARGET="$LICENSE_PACKET_DIR"
cf8c28
    if [ "$PLATFORM" = "win" ]; then
cf8c28
        local LOCAL_DIR="/usr/$HOST/sys-root/mingw/bin/"
99b145
        copy_system_license "mingw$ARCH-gcc gcc"   "$TARGET" || return 1
99b145
        copy_system_license mingw$ARCH-winpthreads "$TARGET" || return 1
99b145
        copy_system_license mingw$ARCH-gettext     "$TARGET" || return 1
99b145
        copy_system_license mingw$ARCH-win-iconv   "$TARGET" || return 1
99b145
        copy_system_license mingw$ARCH-termcap     "$TARGET" || return 1
cf8c28
    else
8344ff
        copy_system_license libudev                "$TARGET" || return 1
6c649b
        copy_system_license gfortran               "$TARGET" || return 1
cf8c28
    fi
e14835
}