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

b765f7
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.9.2 mypaintlib-master"
3b09af
DEPS_NATIVE="cmake-3.6.2"
e14835
e14835
PK_DIRNAME="opentoonz"
e14835
PK_URL="https://github.com/opentoonz/$PK_DIRNAME.git"
fda0a7
PK_LICENSE_FILES="README.md LICENSE.txt thirdparty/tiff-4.0.3/COPYRIGHT stuff/library/mypaint?brushes/Licenses.txt"
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=
31c087
    local LOCAL_PNG_LIB="libpng16.so"
31c087
    local LOCAL_GLUT_LIB="libglut.so"
cf8c28
    if [ ! -z "$HOST" ]; then
cf8c28
        LOCAL_OPTIONS="--host=$HOST"
cf8c28
    fi
cf8c28
    if [ "$PLATFORM" = "win" ]; then
cd1b9d
        LOCAL_CMAKE_OPTIONS="$LOCAL_CMAKE_OPTIONS -DCMAKE_SYSTEM_NAME=Windows"
3a63fb
        LOCAL_PNG_LIB="libpng16.dll.a"
31c087
        LOCAL_GLUT_LIB="libfreeglut.dll.a"
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" \
cd1b9d
              -DPNG_PNG_INCLUDE_DIR="$ENVDEPS_PACKET_DIR/include" \
31c087
              -DPNG_LIBRARY="$ENVDEPS_PACKET_DIR/lib/$LOCAL_PNG_LIB" \
31c087
              -DGLUT_LIB="$ENVDEPS_PACKET_DIR/lib/$LOCAL_GLUT_LIB" \
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
31c087
        true
31c087
        #cp --remove-destination "$BUILD_PACKET_DIR/$PK_DIRNAME/thirdparty/tiff-4.0.3/libtiff/.libs/libtiff-5.dll" "$INSTALL_PACKET_DIR/bin/" || return 1
31c087
        #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/"
31c087
        
31c087
        local LOCAL_DIR="/usr/local/$HOST/sys-root/$HOST/lib/"
f23bb2
        cp "$LOCAL_DIR"/libgcc*.dll        "$TARGET" || return 1
f23bb2
        cp "$LOCAL_DIR"/libstdc*.dll       "$TARGET" || return 1
31c087
        cp "$LOCAL_DIR"/libquadmath*.dll   "$TARGET" || return 1
31c087
        cp "$LOCAL_DIR"/libgfortran*.dll   "$TARGET" || return 1
31c087
31c087
        local LOCAL_DIR="/usr/local/$HOST/sys-root/bin/"
f23bb2
        cp "$LOCAL_DIR"/libwinpthread*.dll "$TARGET" || return 1
f23bb2
        cp "$LOCAL_DIR"/libgettextlib*.dll "$TARGET" || return 1
f23bb2
        cp "$LOCAL_DIR"/libintl*.dll       "$TARGET" || return 1
31c087
        cp "$LOCAL_DIR"/libiconv*.dll      "$TARGET" || return 1
f23bb2
f23bb2
        # add icon
f23bb2
        cp "$BUILD_PACKET_DIR/$PK_DIRNAME/toonz/sources/toonz/toonz.ico" "$TARGET" || return 1
99b145
    else
99b145
        local TARGET="$INSTALL_PACKET_DIR/lib/"
b16af1
        copy_system_gcc_libs               "$TARGET" || return 1
b16af1
        copy_system_lib libudev            "$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/"
31c087
        copy_system_license gcc                    "$TARGET" || return 1
31c087
        copy_system_license mingw-w64              "$TARGET" || return 1
31c087
        copy_system_license gettext                "$TARGET" || return 1
31c087
        copy_system_license iconv                  "$TARGET" || return 1
cf8c28
    else
b16af1
        copy_system_license gcc                    "$TARGET" || return 1
8344ff
        copy_system_license libudev                "$TARGET" || return 1
cf8c28
    fi
e14835
}