aboutsummaryrefslogtreecommitdiff
path: root/tools/make_distrib.sh
blob: e532076c97e7397ec4791a8b90dcd66c36f7fcf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file.

if [ -z "$1" ]; then
  echo "ERROR: Please specify a build target: linux32, linux64 or macosx64"
else
  cd ..

  export DISTRIB_PLATFORM="$1"
  export DISTRIB_PATH="./binary_distrib/$1"
  export DISTRIB_BIN_PATH="$DISTRIB_PATH/bin"
  export DISTRIB_DOCS_PATH="$DISTRIB_PATH/docs"
  export OUT_PATH="./out"
  export OUT_DOCS_PATH="./out/docs"
  export SOURCE_PATH="./java"
  export JOGAMP_PATH="./third_party/jogamp"
  export TOOLS_DISTRIB_PATH="./tools/distrib/$1"
  export EXCLUDE_FILE="./tools/distrib/EXCLUDE_FILES.txt"

  if [ ! -d "$DISTRIB_BIN_PATH" ]; then
    mkdir -p "$DISTRIB_BIN_PATH"
  fi

  # Create the JCEF documentation.
#  cd tools
#  ./make_docs.sh
#  cd ..

  # Copy documentation to the docs directory.
  cp -rf $OUT_DOCS_PATH $DISTRIB_DOCS_PATH

  # Create README.txt
  python tools/make_readme.py --output-dir $DISTRIB_PATH/ --platform $DISTRIB_PLATFORM

  # Copy miscellaneous files to the root directory.
  cp -f ./LICENSE.txt $DISTRIB_PATH
  cp -f $JOGAMP_PATH/*.LICENSE.txt $DISTRIB_PATH
  rsync -a --exclude-from $EXCLUDE_FILE $TOOLS_DISTRIB_PATH/ $DISTRIB_PATH/

  if [ $1 == "macosx64" ]; then
    export OUT_BINARY_PATH="./jcef_build/native/Release"
    if [ ! -d "$OUT_BINARY_PATH" ]; then
      echo "ERROR: Native Release build output path does not exist"
      exit 1
    fi

    # Copy test program source file to the tests directory.
    cp -rf $SOURCE_PATH/tests $DISTRIB_PATH

    # Everything else is contained in the app bundle.
    cp -rf $OUT_BINARY_PATH/jcef_app.app $DISTRIB_BIN_PATH
  else
    export DISTRIB_LIB_PATH="$DISTRIB_PATH/bin/lib/$1"
    export JOGAMP_JAR_PATH="$JOGAMP_PATH/jar"
    export OUT_BINARY_PATH="$OUT_PATH/Release"

    # Alternately look in the CMake output path.
    if [ ! -d "$OUT_BINARY_PATH" ]; then
      export OUT_BINARY_PATH="./jcef_build/native/Release"
    fi
    if [ ! -d "$OUT_BINARY_PATH" ]; then
      echo "ERROR: Native Release build output path does not exist"
      exit 1
    fi
  
    # Create the JCEF JAR file.
    cd tools
    ./make_jar.sh $1
    cd ..

    # Copy JAR files to the bin directory.
    cp -f $JOGAMP_JAR_PATH/gluegen-rt.jar $DISTRIB_BIN_PATH
    cp -f $JOGAMP_JAR_PATH/jogl-all.jar $DISTRIB_BIN_PATH

    if [ $1 == "linux32" ]; then
      export JOGAMP_JAR_SUFFIX="i586"
    else
      export JOGAMP_JAR_SUFFIX="amd64"
    fi
    cp -f $JOGAMP_JAR_PATH/gluegen-rt-natives-linux-$JOGAMP_JAR_SUFFIX.jar $DISTRIB_BIN_PATH
    cp -f $JOGAMP_JAR_PATH/jogl-all-natives-linux-$JOGAMP_JAR_SUFFIX.jar $DISTRIB_BIN_PATH
    cp -f $OUT_PATH/$1/jcef.jar $DISTRIB_BIN_PATH

    # Copy test program source and JAR file to the bin directory.
    cp -rf $SOURCE_PATH/tests $DISTRIB_BIN_PATH
    cp -f $OUT_PATH/$1/jcef-tests.jar $DISTRIB_BIN_PATH

    # Copy CEF Release files to the lib directory.
    if [ ! -d "$DISTRIB_LIB_PATH" ]; then
      mkdir -p "$DISTRIB_LIB_PATH"
    fi

    cp -f $OUT_BINARY_PATH/chrome-sandbox $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/libjcef.so $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/jcef_helper $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/icudtl.dat $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/libcef.so $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/libEGL.so $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/libGLESv2.so $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/natives_blob.bin $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/snapshot_blob.bin $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/v8_context_snapshot.bin $DISTRIB_LIB_PATH
    cp -f $OUT_BINARY_PATH/*.pak $DISTRIB_LIB_PATH
    cp -rf $OUT_BINARY_PATH/locales/ $DISTRIB_LIB_PATH
    cp -rf $OUT_BINARY_PATH/swiftshader/ $DISTRIB_LIB_PATH
  fi

  cd tools
fi