aboutsummaryrefslogtreecommitdiff
path: root/tools/make_distrib.sh
blob: cd2fd54b4d6dce7b9695fd455b07fcc343178d3d (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
#!/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
  DIR="$( cd "$( dirname "$0" )" && cd .. && pwd )"
  DISTRIB_PLATFORM="$1"
  DISTRIB_PATH="${DIR}/binary_distrib/$1"
  DISTRIB_BIN_PATH="$DISTRIB_PATH/bin"
  DISTRIB_DOCS_PATH="$DISTRIB_PATH/docs"
  OUT_PATH="${DIR}/out"
  OUT_DOCS_PATH="${DIR}/out/docs"
  SOURCE_PATH="${DIR}/java"
  JOGAMP_PATH="${DIR}/third_party/jogamp"
  TOOLS_DISTRIB_PATH="${DIR}/tools/distrib/$1"
  EXCLUDE_FILE="${DIR}/tools/distrib/EXCLUDE_FILES.txt"

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

  # Create the JCEF documentation.
  "${DIR}"/tools/make_docs.sh

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

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

  # Copy miscellaneous files to the root directory.
  cp -f "${DIR}"/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
    OUT_BINARY_PATH="${DIR}/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
    DISTRIB_LIB_PATH="$DISTRIB_PATH/bin/lib/$1"
    JOGAMP_JAR_PATH="$JOGAMP_PATH/jar"
    OUT_BINARY_PATH="$OUT_PATH/Release"

    # Alternately look in the CMake output path.
    if [ ! -d "$OUT_BINARY_PATH" ]; then
      OUT_BINARY_PATH="${DIR}/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.
    "${DIR}"/tools/make_jar.sh $1

    # 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
      JOGAMP_JAR_SUFFIX="i586"
    else
      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"/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
fi