From e4a26a2cfe730c1b1f7ed4907c49dbda14b434fb Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Fri, 29 Nov 2019 22:29:15 -0800 Subject: [PATCH] Use CMake build system (#15397) --- .gitignore | 15 + CMakeLists.txt | 34 +++ INSTALL | 46 +++ build.py | 492 ------------------------------ configure | 317 +++++++++++++++++++ deploy/.gitignore | 2 - deploy/README.md | 44 --- deploy/brandelf.c | 212 ------------- deploy/build-and-package.sh | 6 - deploy/docker-build.sh | 62 ---- deploy/package.sh | 120 -------- phantomjs.pro | 3 - src/linenoise/linenoise.pri | 9 - src/mongoose/mongoose.pri | 7 - src/phantomjs.pro | 103 ------- src/qcommandline/qcommandline.pri | 7 - 16 files changed, 412 insertions(+), 1067 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 INSTALL delete mode 100755 build.py create mode 100755 configure delete mode 100644 deploy/.gitignore delete mode 100644 deploy/README.md delete mode 100644 deploy/brandelf.c delete mode 100755 deploy/build-and-package.sh delete mode 100755 deploy/docker-build.sh delete mode 100755 deploy/package.sh delete mode 100644 phantomjs.pro delete mode 100644 src/linenoise/linenoise.pri delete mode 100644 src/mongoose/mongoose.pri delete mode 100644 src/phantomjs.pro delete mode 100644 src/qcommandline/qcommandline.pri diff --git a/.gitignore b/.gitignore index 7c8a9c08af..53ef2055d3 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,18 @@ bin/ *.class build/ .gradle/ + +# CMake +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps +*_autogen + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..c23e11f497 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.5.0) +project(phantomjs) + +set (CMAKE_CXX_STANDARD 11) + +find_package(Qt5 COMPONENTS Core Network WebKitWidgets REQUIRED) +find_package(Threads REQUIRED) + +message("Using Qt version ${Qt5Core_VERSION}") +if (Qt5Core_VERSION VERSION_LESS 5.5.0) + message(FATAL_ERROR "This version of Qt is not supported. Please use Qt 5.5 or later") +endif() + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +file(GLOB_RECURSE PHANTOMJS_SOURCES src/*.cpp) +include_directories(src) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(THIRDPARTY_SOURCES src/mongoose/mongoose.c src/qcommandline/qcommandline.cpp src/linenoise/src/linenoise.c) +include_directories(src/linenoise/src) +include_directories(src/mongoose) +include_directories(src/qcommandline) + +set(EXTRA_LIBS dl) + +add_executable(${PROJECT_NAME} src/phantomjs.qrc src/ghostdriver/ghostdriver.qrc ${PHANTOMJS_SOURCES} ${THIRDPARTY_SOURCES}) +target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS} Qt5::Core Qt5::Network Qt5::WebKitWidgets Threads::Threads) +install(TARGETS ${PROJECT_NAME} DESTINATION bin) + +add_custom_target(check COMMAND python test/run-tests.py -v) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000000..6c8b5ea651 --- /dev/null +++ b/INSTALL @@ -0,0 +1,46 @@ +Installation Instructions +************************* + +System requirements: + + * C++ toolchain such as g++ 7 or later + * CMake version 3.5 or later + * Qt 5 toolkit + * Python 2.7 (to run the tests) + + +Installation on Linux +--------------------- + +On Debian/Ubuntu, the requirements can be fulfilled by installing these packages: + + sudo apt install g++ cmake qt5-default libqt5webkit5-dev python + +After unpacking the source tarball or cloning the repository: + + ./configure && make + +Do a quick sanity check: + + ./bin/phantomjs --version + +Run the test suite: + + make check + +Install it (may require sudo): + + make install + + +Installation on Windows +----------------------- + +To be written. + + +Installation on macOS +--------------------- + +To be written. + diff --git a/build.py b/build.py deleted file mode 100755 index 344c484f38..0000000000 --- a/build.py +++ /dev/null @@ -1,492 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# This file is part of the PhantomJS project from Ofi Labs. -# -# Copyright (C) 2014 Milian Wolff, KDAB -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -import argparse -import os -import platform -import sys -import subprocess -import re -import multiprocessing - -root = os.path.abspath(os.path.dirname(__file__)) -third_party_names = ["libicu", "libxml", "openssl", "zlib"] -third_party_path = os.path.join(root, "src", "qt", "3rdparty") - -openssl_search_paths = [{ - "name": "Brew", - "header": "/usr/local/opt/openssl/include/openssl/opensslv.h", - "flags": [ - "-I/usr/local/opt/openssl/include", - "-L/usr/local/opt/openssl/lib" - ] -}, { - "name": "MacPorts", - "header": "/opt/local/include/openssl/opensslv.h", - "flags": [ - "-I/opt/local/include", - "-L/opt/local/lib" - ] -}] - -# check if path points to an executable -# source: http://stackoverflow.com/a/377028 -def isExe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - -# find path to executable in PATH environment variable, similar to UNIX which command -# source: http://stackoverflow.com/a/377028 -def which(program): - if isExe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - path = path.strip("") - exe_file = os.path.join(path, program) - if isExe(exe_file): - return exe_file - return None - -# returns the path to the QMake executable which gets built in our internal QtBase fork -def qmakePath(): - exe = "qmake" - if platform.system() == "Windows": - exe += ".exe" - return os.path.abspath("src/qt/qtbase/bin/" + exe) - -# returns paths for 3rd party libraries (Windows only) -def findThirdPartyDeps(): - include_dirs = [] - lib_dirs = [] - for dep in third_party_names: - include_dirs.append("-I") - include_dirs.append(os.path.join(third_party_path, dep, "include")) - lib_dirs.append("-L") - lib_dirs.append(os.path.join(third_party_path, dep, "lib")) - return (include_dirs, lib_dirs) - -class PhantomJSBuilder(object): - options = {} - makeCommand = [] - - def __init__(self, options): - self.options = options - - # setup make command or equivalent with arguments - if platform.system() == "Windows": - makeExe = which("jom.exe") - if not makeExe: - makeExe = "nmake" - self.makeCommand = [makeExe, "/NOLOGO"] - else: - flags = [] - if self.options.jobs: - # number of jobs explicitly given - flags = ["-j", self.options.jobs] - elif not re.match("-j\s*[0-9]+", os.getenv("MAKEFLAGS", "")): - # if the MAKEFLAGS env var does not contain any "-j N", set a sane default - flags = ["-j", multiprocessing.cpu_count()] - self.makeCommand = ["make"] - self.makeCommand.extend(flags) - - # if there is no git subdirectory, automatically go into no-git - # mode - if not os.path.isdir(".git"): - self.options.skip_git = True - - # run the given command in the given working directory - def execute(self, command, workingDirectory): - # python 2 compatibility: manually convert to strings - command = [str(c) for c in command] - workingDirectory = os.path.abspath(workingDirectory) - print("Executing in %s: %s" % (workingDirectory, " ".join(command))) - if self.options.dry_run: - return 0 - process = subprocess.Popen(command, stdout=sys.stdout, stderr=sys.stderr, cwd=workingDirectory) - process.wait() - return process.returncode - - # run git clean in the specified path - def gitClean(self, path): - if self.options.skip_git: return 0 - return self.execute(["git", "clean", "-xfd"], path) - - # run make, nmake or jom in the specified path - def make(self, path): - return self.execute(self.makeCommand, path) - - # run qmake in the specified path - def qmake(self, path, options): - qmake = qmakePath() - # verify that qmake was properly built - if not isExe(qmake) and not self.options.dry_run: - raise RuntimeError("Could not find QMake executable: %s" % qmake) - command = [qmake] - if self.options.qmake_args: - command.extend(self.options.qmake_args) - if options: - command.extend(options) - return self.execute(command, path) - - # returns a list of platform specific Qt Base configure options - def platformQtConfigureOptions(self): - platformOptions = [] - if platform.system() == "Windows": - platformOptions = [ - "-mp", - "-static-runtime", - "-no-cetest", - "-no-angle", - "-icu", - "-openssl", - "-openssl-linked", - ] - deps = findThirdPartyDeps() - platformOptions.extend(deps[0]) - platformOptions.extend(deps[1]) - else: - # Unix platform options - platformOptions = [ - # use the headless QPA platform - "-qpa", "phantom", - # explicitly compile with SSL support, so build will fail if headers are missing - "-openssl", "-openssl-linked", - # disable unnecessary Qt features - "-no-openvg", - "-no-eglfs", - "-no-egl", - "-no-glib", - "-no-gtkstyle", - "-no-cups", - "-no-sm", - "-no-xinerama", - "-no-xkb", - "-no-xcb", - "-no-kms", - "-no-linuxfb", - "-no-directfb", - "-no-mtdev", - "-no-libudev", - "-no-evdev", - "-no-pulseaudio", - "-no-alsa", - "-no-feature-PRINTPREVIEWWIDGET" - ] - - if self.options.silent: - platformOptions.append("-silent") - - if platform.system() == "Darwin": - # Mac OS specific options - # NOTE: fontconfig is not required on Darwin (we use Core Text for font enumeration) - platformOptions.extend([ - "-no-pkg-config", - "-no-c++11", # Build fails on mac right now with C++11 TODO: is this still valid? - ]) - # Dirty hack to find OpenSSL libs - openssl = os.getenv("OPENSSL", "") - if openssl == "": - # search for OpenSSL - openssl_found = False - for search_path in openssl_search_paths: - if os.path.exists(search_path["header"]): - openssl_found = True - platformOptions.extend(search_path["flags"]) - print("Found OpenSSL installed via %s" % search_path["name"]) - - if not openssl_found: - raise RuntimeError("Could not find OpenSSL") - else: - if os.path.exists(openssl + "/include/openssl/opensslv.h"): - openssl_found = True - openssl_include = "-I" + openssl + "/include" - openssl_lib = "-L" + openssl + "/lib" - platformOptions.extend([openssl_include, openssl_lib]) - print("Using OpenSSL at %s" % openssl) - - if not openssl_found: - raise RuntimeError("No OpenSSL specified: OPENSSL environment variable not found") - else: - # options specific to other Unixes, like Linux, BSD, ... - platformOptions.extend([ - "-fontconfig", # Fontconfig for better font matching - "-icu", # ICU for QtWebKit (which provides the OSX headers) but not QtBase - ]) - return platformOptions - - # configure Qt Base - def configureQtBase(self): - print("configuring Qt Base, please wait...") - - configureExe = os.path.abspath("src/qt/qtbase/configure") - if platform.system() == "Windows": - configureExe += ".bat" - - configure = [configureExe, - "-static", - "-opensource", - "-confirm-license", - # we use an in-source build for now and never want to install - "-prefix", os.path.abspath("src/qt/qtbase"), - # use the bundled libraries, vs. system-installed ones - "-qt-zlib", - "-qt-libpng", - "-qt-libjpeg", - "-qt-pcre", - # disable unnecessary Qt features - "-nomake", "examples", - "-nomake", "tools", - "-nomake", "tests", - "-no-audio-backend", - "-no-dbus", - "-no-gstreamer", - "-no-journald", - "-no-opengl", - "-no-qml-debug", - "-no-sql-db2", - "-no-sql-ibase", - "-no-sql-mysql", - "-no-sql-oci", - "-no-sql-odbc", - "-no-sql-psql", - "-no-sql-sqlite", - "-no-sql-sqlite2", - "-no-sql-tds", - "-no-tslib", - "-no-xcb-xlib", - "-D", "QT_NO_GRAPHICSVIEW", - "-D", "QT_NO_GRAPHICSEFFECT", - "-D", "QT_NO_STYLESHEET", - "-D", "QT_NO_STYLE_CDE", - "-D", "QT_NO_STYLE_CLEANLOOKS", - "-D", "QT_NO_STYLE_MOTIF", - "-D", "QT_NO_STYLE_PLASTIQUE", - "-D", "QT_NO_PRINTPREVIEWDIALOG" - ] - configure.extend(self.platformQtConfigureOptions()) - if self.options.qt_config: - configure.extend(self.options.qt_config) - - if self.options.debug: - configure.append("-debug") - elif self.options.release: - configure.append("-release") - else: - # build Release by default - configure.append("-release") - - if self.execute(configure, "src/qt/qtbase") != 0: - raise RuntimeError("Configuration of Qt Base failed.") - - # build Qt Base - def buildQtBase(self): - if self.options.skip_qtbase: - print("Skipping build of Qt Base") - return - - if self.options.git_clean_qtbase: - self.gitClean("src/qt/qtbase") - - if self.options.git_clean_qtbase or not self.options.skip_configure_qtbase: - self.configureQtBase() - - print("building Qt Base, please wait...") - if self.make("src/qt/qtbase") != 0: - raise RuntimeError("Building Qt Base failed.") - - # build Qt WebKit - def buildQtWebKit(self): - if self.options.skip_qtwebkit: - print("Skipping build of Qt WebKit") - return - - if self.options.git_clean_qtwebkit: - self.gitClean("src/qt/qtwebkit") - - os.putenv("SQLITE3SRCDIR", os.path.abspath("src/qt/qtbase/src/3rdparty/sqlite")) - - print("configuring Qt WebKit, please wait...") - configureOptions = [ - # disable some webkit features we do not need - "WEBKIT_CONFIG-=build_tests", - "WEBKIT_CONFIG-=build_webkit2", - "WEBKIT_CONFIG-=have_glx", - "WEBKIT_CONFIG-=have_qtquick", - "WEBKIT_CONFIG-=have_qtsensors", - "WEBKIT_CONFIG-=have_qttestlib", - "WEBKIT_CONFIG-=have_qttestsupport", - "WEBKIT_CONFIG-=have_xcomposite", - "WEBKIT_CONFIG-=have_xrender", - "WEBKIT_CONFIG-=netscape_plugin_api", - "WEBKIT_CONFIG-=use_gstreamer", - "WEBKIT_CONFIG-=use_gstreamer010", - "WEBKIT_CONFIG-=use_native_fullscreen_video", - "WEBKIT_CONFIG-=use_webp", - "WEBKIT_CONFIG-=video", - "WEBKIT_CONFIG-=web_audio", - "WEBKIT_TOOLS_CONFIG-=build_imagediff", - "WEBKIT_TOOLS_CONFIG-=build_minibrowser", - "WEBKIT_TOOLS_CONFIG-=build_qttestsupport", - "WEBKIT_TOOLS_CONFIG-=build_test_npapi", - "WEBKIT_TOOLS_CONFIG-=build_wtr", - ] - if self.options.webkit_qmake_args: - configureOptions.extend(self.options.webkit_qmake_args) - if self.qmake("src/qt/qtwebkit", configureOptions) != 0: - raise RuntimeError("Configuration of Qt WebKit failed.") - - print("building Qt WebKit, please wait...") - if self.make("src/qt/qtwebkit") != 0: - raise RuntimeError("Building Qt WebKit failed.") - - # build PhantomJS - def buildPhantomJS(self): - print("Configuring PhantomJS, please wait...") - if self.qmake(".", self.options.phantomjs_qmake_args) != 0: - raise RuntimeError("Configuration of PhantomJS failed.") - print("Building PhantomJS, please wait...") - if self.make(".") != 0: - raise RuntimeError("Building PhantomJS failed.") - - # ensure the git submodules are all available - def ensureSubmodulesAvailable(self): - if self.options.skip_git: return - if self.execute(["git", "submodule", "init"], ".") != 0: - raise RuntimeError("Initialization of git submodules failed.") - if self.execute(["git", "submodule", "update", "--init"], ".") != 0: - raise RuntimeError("Initial update of git submodules failed.") - - # run all build steps required to get a final PhantomJS binary at the end - def run(self): - self.ensureSubmodulesAvailable(); - self.buildQtBase() - self.buildQtWebKit() - self.buildPhantomJS() - -# parse command line arguments and return the result -def parseArguments(): - parser = argparse.ArgumentParser(description="Build PhantomJS from sources.") - parser.add_argument("-r", "--release", action="store_true", - help="Enable compiler optimizations.") - parser.add_argument("-d", "--debug", action="store_true", - help="Build with debug symbols enabled.") - parser.add_argument("-j", "--jobs", type=int, - help="How many parallel compile jobs to use. Defaults to %d." % multiprocessing.cpu_count()) - parser.add_argument("-c", "--confirm", action="store_true", - help="Silently confirm the build.") - parser.add_argument("-n", "--dry-run", action="store_true", - help="Only print what would be done without actually executing anything.") - - # NOTE: silent build does not exist on windows apparently - if platform.system() != "Windows": - parser.add_argument("-s", "--silent", action="store_true", - help="Reduce output during compilation.") - - advanced = parser.add_argument_group("advanced options") - advanced.add_argument("--qmake-args", type=str, action="append", - help="Additional arguments that will be passed to all QMake calls.") - advanced.add_argument("--webkit-qmake-args", type=str, action="append", - help="Additional arguments that will be passed to the Qt WebKit QMake call.") - advanced.add_argument("--phantomjs-qmake-args", type=str, action="append", - help="Additional arguments that will be passed to the PhantomJS QMake call.") - advanced.add_argument("--qt-config", type=str, action="append", - help="Additional arguments that will be passed to Qt Base configure.") - advanced.add_argument("--git-clean-qtbase", action="store_true", - help="Run git clean in the Qt Base folder.\n" - "ATTENTION: This will remove all untracked files!") - advanced.add_argument("--git-clean-qtwebkit", action="store_true", - help="Run git clean in the Qt WebKit folder.\n" - "ATTENTION: This will remove all untracked files!") - advanced.add_argument("--skip-qtbase", action="store_true", - help="Skip Qt Base completely and do not build it.\n" - "Only enable this option when Qt Base was built " - "previously and no update is required.") - advanced.add_argument("--skip-configure-qtbase", action="store_true", - help="Skip configure step of Qt Base, only build it.\n" - "Only enable this option when the environment has " - "not changed and only an update of Qt Base is required.") - advanced.add_argument("--skip-qtwebkit", action="store_true", - help="Skip Qt WebKit completely and do not build it.\n" - "Only enable this option when Qt WebKit was built " - "previously and no update is required.") - advanced.add_argument("--skip-configure-qtwebkit", action="store_true", - help="Skip configure step of Qt WebKit, only build it.\n" - "Only enable this option when neither the environment nor Qt Base " - "has changed and only an update of Qt WebKit is required.") - advanced.add_argument("--skip-git", action="store_true", - help="Skip all actions that require Git. For use when building from " - "a tarball release.") - options = parser.parse_args() - if options.debug and options.release: - raise RuntimeError("Cannot build with both debug and release mode enabled.") - return options - -# main entry point which gets executed when this script is run -def main(): - # change working directory to the folder this script lives in - os.chdir(os.path.dirname(os.path.realpath(__file__))) - - try: - options = parseArguments() - if not options.confirm: - print("""\ ----------------------------------------- - WARNING ----------------------------------------- - -Building PhantomJS from source takes a very long time, anywhere from 30 minutes -to several hours (depending on the machine configuration). It is recommended to -use the premade binary packages on supported operating systems. - -For details, please go the the web site: http://phantomjs.org/download.html. -""") - while True: - sys.stdout.write("Do you want to continue (Y/n)? ") - sys.stdout.flush() - answer = sys.stdin.readline().strip().lower() - if answer == "n": - print("Cancelling PhantomJS build.") - return - elif answer == "y" or answer == "": - break - else: - print("Invalid answer, try again.") - - builder = PhantomJSBuilder(options) - builder.run() - except RuntimeError as error: - sys.stderr.write("\nERROR: Failed to build PhantomJS! %s\n" % error) - sys.stderr.flush() - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/configure b/configure new file mode 100755 index 0000000000..a8a75d5663 --- /dev/null +++ b/configure @@ -0,0 +1,317 @@ +#!/bin/sh + +# Autotools-style (./configure) wrapper for CMake +# +# +# *** IMPORTANT *** +# +# You must include the GNUInstallDirs module (which comes with +# CMake) in your project. Just put "include (GNUInstallDirs)" in +# you CMakeLists.txt and you should be good. +# +# This script was originally written for Squash +# by Evan Nemerson +# , but has been spun off into a separate +# repository. Please feel free to copy it into your own repository, +# though I would appreciate it if you would post improvements, bugs, +# feature requests, etc. to the issue tracker at +# . +# +# To the extent possible under law, the author(s) hereby waive all +# copyright and related or neighboring rights to this work. For +# details, see + +TOP_SRCDIR="$(dirname $0)" + +if [ "${CMAKE_CMD}" = "" ]; then + CMAKE_CMD="cmake" +fi + +BUILD_TYPE="Debug" +PREFIX=/usr/local +LIBDIR= +CMAKE_ARGS= + +if [ -e "${TOP_SRCDIR}/.configure-custom.sh" ]; then + . "${TOP_SRCDIR}/.configure-custom.sh" +fi + +quote() { + echo "$1" | sed -e "s|'|'\\\\''|g; 1s/^/'/; \$s/\$/'/" +} + +extract_var_string() { + VAR_NAME=$1 + VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//') + if [ "x$2" != "x" ]; then + VAR_VALUE=$2 + else + VAR_VALUE=yes + fi + + if [ "x$3" != "x" ]; then + VAR_UC_NAME=$3 + else + VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g') + fi +} + +set_config_var() { + is_with=n + case "$1" in + "--enable-"*) + name="${1#--enable-}" + cfg="${ENABLE_VARS}" + ;; + "--disable-"*) + name="${1#--disable-}"; + cfg="${DISABLE_VARS}"; + ;; + "--with-"*) + # IFS="=" read -ra WITHARGS <<< "${1}" + name="${1#--with-}" + cfg="${WITH_VARS}" + is_with=y + ;; + esac + + found=n + for varstring in $cfg; do + extract_var_string $(echo "${varstring}" | tr '|' ' ') + if [ "x$VAR_NAME" = "x$name" ]; then + found=y + break; + fi + done + + if [ "$found" = "y" ]; then + if [ "x$is_with" = "xy" ]; then + CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")" + else + CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")" + fi + else + echo "Unknown parameter: ${1}" + exit 1 + fi +} + +prefix_to_offset() { + expr $(echo "${1}" | awk '{ print length }') + 1 +} + +print_help() { + cat <&2 + -h, --help display this help and exit + --disable-debug disable debugging mode + --pass-thru pass remaining arguments through to CMake + + --prefix=PREFIX install architecture-independent files in PREFIX + [$PREFIX] + --bindir=DIR user executables [PREFIX/bin] + --sbindir=DIR system admin executables [PREFIX/sbin] + --libexecdir=DIR program executables [PREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [PREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PROJECT_NAME] +EOF + + first=y + for varstring in ${ENABLE_VARS}; do + if [ $first = 'y' ]; then + echo "" + first=n + fi + extract_var_string $(echo "${varstring}" | tr '|' ' ') + var_doc_name="ENABLE_${VAR_UC_NAME}_DOC" + eval "docstring=\$$var_doc_name" + if [ "x${docstring}" = "x" ]; then + printf " --enable-%-14s enable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')" + else + printf " --enable-%-14s %s\n" "${VAR_NAME}" "$docstring" + fi + done + + first=y + for varstring in ${DISABLE_VARS}; do + if [ $first = 'y' ]; then + echo "" + first=n + fi + extract_var_string $(echo "${varstring}" | tr '|' ' ') + var_doc_name="DISABLE_${VAR_UC_NAME}_DOC" + eval "docstring=\$$var_doc_name" + if [ "x${docstring}" = "x" ]; then + printf " --disable-%-13s disable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')" + else + printf " --disable-%-13s %s\n" "${VAR_NAME}" "$docstring" + fi + done + + first=y + for varstring in ${WITH_VARS}; do + if [ $first = 'y' ]; then + echo "" + first=n + fi + extract_var_string $(echo "${varstring}" | tr '|' ' ') + var_doc_name="WITH_${VAR_UC_NAME}_DOC" + eval "docstring=\$$var_doc_name" + paraminfo="${VAR_NAME}=${VAR_VALUE}" + if [ "x${docstring}" = "x" ]; then + printf " --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')" + else + printf " --with-%-16s %s\n" "$paraminfo" "$docstring" + fi + done + + exit 0 +} + +while [ $# != 0 ]; do + case "$1" in + "--prefix="*) + PREFIX="${1#*=}";; + "--prefix") + PREFIX="${2}"; shift;; + "--bindir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "${1#*=}")";; + "--bindir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "$2")"; shift;; + "--sbindir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "${1#*=}")";; + "--sbindir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "$2")"; shift;; + "--libexecdir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "${1#*=}")";; + "--libexecdir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "$2")"; shift;; + "--sysconfdir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "${1#*=}")";; + "--sysconfdir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "$2")"; shift;; + "--sharedstatedir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "${1#*=}")";; + "--sharedstatedir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "$2")"; shift;; + "--localstatedir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "${1#*=}")";; + "--localstatedir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "$2")"; shift;; + "--libdir="*) + LIBDIR="${1#*=}";; + "--libdir") + LIBDIR="${2}"; shift;; + "--includedir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "${1#*=}")";; + "--includedir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "$2")"; shift;; + "--oldincludedir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "${1#*=}")";; + "--oldincludedir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "$2")"; shift;; + "--datarootdir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "${1#*=}")";; + "--datarootdir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "$2")"; shift;; + "--datadir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "${1#*=}")";; + "--datadir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "$2")"; shift;; + "--infodir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "${1#*=}")";; + "--infodir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "$2")"; shift;; + "--localedir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "${1#*=}")";; + "--localedir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "$2")"; shift;; + "--mandir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "${1#*=}")";; + "--mandir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "$2")"; shift;; + "--docdir="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "${1#*=}")";; + "--docdir") + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "$2")"; shift;; + + "CC="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$(quote "${1#*=}")";; + "CXX="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$(quote "${1#*=}")";; + "CFLAGS="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_FLAGS=$(quote "${1#*=}")";; + "CXXFLAGS="*) + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=$(quote "${1#*=}")";; + "LDFLAGS="*) + LDFLAGS="$LDFLAGS ${1#*=}";; + + "--help") + print_help;; + "-h") + print_help;; + + # This flag is the only one which may be a bit surprising to + # people. Autotools always builds with debugging symbols enabled + # (AFAIK), but for cmake you have to do -DCMAKE_BUILD_TYPE=Debug. + # Unfortunately this can change other things as well, so although + # I realize there is no --disable-debug flag I thought it would be + # prudent to support one here. + "--disable-debug") + BUILD_TYPE="Release";; + + "--pass-thru") + while [ $# != 1 ]; do + shift; + CMAKE_ARGS="$CMAKE_ARGS $(quote "${1}")"; + done;; + + "--enable-"*) + set_config_var "$1" + ;; + + "--disable-"*) + set_config_var "$1" + ;; + + "--with-"*) + name=$(echo "${1#--with-}" | awk '{split($1,v,"="); print v[1]}') + case "${1}" in + "--with-${name}="*) + set_config_var "--with-${name}" "${1#--with-${name}=}";; + "--with-${name}") + set_config_var "$1" "$2"; + shift;; + esac + ;; + + *) + echo "$0: error: unrecognized option: \`$1'" >&2 + echo "Try \`$0 --help' for more information" >&2 + exit -1 + esac; + shift +done + +if [ "x${LIBDIR}" = "x" ]; then + LIBDIR="${PREFIX}/lib" +fi + +# Unlike CFLAGS/CXXFLAGS/CC/CXX, LDFLAGS isn't handled by CMake, so we +# need to parse it here. +if [ "x${LDFLAGS}" != "x" ]; then + for varname in EXE MODULE SHARED STATIC; do + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_${varname}_LINKER_FLAGS=$(quote "$LDFLAGS")" + done +fi + +eval "${CMAKE_CMD}" "${TOP_SRCDIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_INSTALL_LIBDIR="${LIBDIR}" ${CMAKE_ARGS} diff --git a/deploy/.gitignore b/deploy/.gitignore deleted file mode 100644 index 3c2196584b..0000000000 --- a/deploy/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vagrant -/brandelf diff --git a/deploy/README.md b/deploy/README.md deleted file mode 100644 index 7f23b7d7f3..0000000000 --- a/deploy/README.md +++ /dev/null @@ -1,44 +0,0 @@ -Packaging PhantomJS -=================== - -This directory contains various scripts to assist with making PhantomJS -packages. - -Packaging for Linux -------------------- - -Linux building/packaging is best done in a container to ensure -isolation. We use [Docker](https://www.docker.com/) to automate the -process. Please see the [Docker documentation](https://docs.docker.com/) -for instructions on installing Docker. For OS X or Windows host, -please use [Docker Toolbox](https://www.docker.com/docker-toolbox). - -Once you have Docker installed, run these commands from the top level -of the PhantomJS source repository: - -```bash - $ git clean -xfd . - $ docker run -v $PWD:/src debian:wheezy /src/deploy/docker-build.sh -``` - -For the 32-bit version: - -```bash - $ git clean -xfd . - $ docker run -v $PWD:/src tubia/debian:wheezy /src/deploy/docker-build.sh -``` - -The built binary will be extracted out of the container and copied to -the current directory. - - -Packaging for OS X ------------------- - -Run `deploy/build-and-package.sh`. That's it. - -However, if you have previously built the sources in release mode, you -should clean your tree to make sure all the debugging symbols gets -compiled: - - $ make clean && cd src/qt && make clean && cd ../.. diff --git a/deploy/brandelf.c b/deploy/brandelf.c deleted file mode 100644 index 530297bbf2..0000000000 --- a/deploy/brandelf.c +++ /dev/null @@ -1,212 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 David O'Brien - * Copyright (c) 1996 Søren Schmidt - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -//NOTE: commented out to make it compile on linux -// __FBSDID("$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.25.22.2 2012/03/16 03:22:37 eadler Exp $"); - -#include -//NOTE: changed path to make it compile on linux -#include -#include -#include -#include -#include -#include -#include -#include - -static int elftype(const char *); -static const char *iselftype(int); -static void printelftypes(void); -static void usage(void); - -struct ELFtypes { - const char *str; - int value; -}; -/* XXX - any more types? */ -static struct ELFtypes elftypes[] = { - { "FreeBSD", ELFOSABI_FREEBSD }, - { "Linux", ELFOSABI_LINUX }, - { "Solaris", ELFOSABI_SOLARIS }, - { "SVR4", ELFOSABI_SYSV } -}; - -int -main(int argc, char **argv) -{ - - const char *strtype = "FreeBSD"; - int type = ELFOSABI_FREEBSD; - int retval = 0; - int ch, change = 0, force = 0, listed = 0; - - while ((ch = getopt(argc, argv, "f:lt:v")) != -1) - switch (ch) { - case 'f': - if (change) - errx(1, "f option incompatible with t option"); - force = 1; - type = atoi(optarg); - if (errno == ERANGE || type < 0 || type > 255) { - warnx("invalid argument to option f: %s", - optarg); - usage(); - } - break; - case 'l': - printelftypes(); - listed = 1; - break; - case 'v': - /* does nothing */ - break; - case 't': - if (force) - errx(1, "t option incompatible with f option"); - change = 1; - strtype = optarg; - break; - default: - usage(); - } - argc -= optind; - argv += optind; - if (!argc) { - if (listed) - exit(0); - else { - warnx("no file(s) specified"); - usage(); - } - } - - if (!force && (type = elftype(strtype)) == -1) { - warnx("invalid ELF type '%s'", strtype); - printelftypes(); - usage(); - } - - while (argc) { - int fd; - char buffer[EI_NIDENT]; - - if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) { - warn("error opening file %s", argv[0]); - retval = 1; - goto fail; - } - if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) { - warnx("file '%s' too short", argv[0]); - retval = 1; - goto fail; - } - if (buffer[0] != ELFMAG0 || buffer[1] != ELFMAG1 || - buffer[2] != ELFMAG2 || buffer[3] != ELFMAG3) { - warnx("file '%s' is not ELF format", argv[0]); - retval = 1; - goto fail; - } - if (!change && !force) { - fprintf(stdout, - "File '%s' is of brand '%s' (%u).\n", - argv[0], iselftype(buffer[EI_OSABI]), - buffer[EI_OSABI]); - if (!iselftype(type)) { - warnx("ELF ABI Brand '%u' is unknown", - type); - printelftypes(); - } - } - else { - buffer[EI_OSABI] = type; - lseek(fd, 0, SEEK_SET); - if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) { - warn("error writing %s %d", argv[0], fd); - retval = 1; - goto fail; - } - } -fail: - close(fd); - argc--; - argv++; - } - - return retval; -} - -static void -usage(void) -{ - (void)fprintf(stderr, - "usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n"); - exit(1); -} - -static const char * -iselftype(int etype) -{ - size_t elfwalk; - - for (elfwalk = 0; - elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); - elfwalk++) - if (etype == elftypes[elfwalk].value) - return elftypes[elfwalk].str; - return 0; -} - -static int -elftype(const char *elfstrtype) -{ - size_t elfwalk; - - for (elfwalk = 0; - elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); - elfwalk++) - if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0) - return elftypes[elfwalk].value; - return -1; -} - -static void -printelftypes(void) -{ - size_t elfwalk; - - fprintf(stderr, "known ELF types are: "); - for (elfwalk = 0; - elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); - elfwalk++) - fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str, - elftypes[elfwalk].value); - fprintf(stderr, "\n"); -} diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh deleted file mode 100755 index d11501fa93..0000000000 --- a/deploy/build-and-package.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -cd `dirname $0`/.. - -./build.py --confirm --release --git-clean-qtbase --git-clean-qtwebkit "$@" || exit 1 - diff --git a/deploy/docker-build.sh b/deploy/docker-build.sh deleted file mode 100755 index 5ceb089317..0000000000 --- a/deploy/docker-build.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash - -set -e - -SOURCE_PATH=/src -BUILD_PATH=$HOME/build - -# In case the old package URL is still being used -sed -i 's/http\.debian\.net/httpredir\.debian\.org/g' /etc/apt/sources.list - -echo "Installing packages for development tools..." && sleep 1 -apt-get -y update -apt-get install -y build-essential git flex bison gperf python ruby git libfontconfig1-dev -echo - -echo "Preparing to download Debian source package..." -echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list -apt-get -y update -echo - -OPENSSL_TARGET='linux-x86_64' -if [ `getconf LONG_BIT` -eq 32 ]; then - OPENSSL_TARGET='linux-generic32' -fi -echo "Recompiling OpenSSL for ${OPENSSL_TARGET}..." && sleep 1 -apt-get source openssl -cd openssl-1.0.1e -OPENSSL_FLAGS='no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 no-ssl3-method enable-rfc3779 enable-cms' -./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib ${OPENSSL_FLAGS} ${OPENSSL_TARGET} -make depend && make && make install -cd .. -echo - -echo "Building the static version of ICU library..." && sleep 1 -apt-get source icu -cd icu-4.8.1.1/source -./configure --prefix=/usr --enable-static --disable-shared -make && make install -cd .. -echo - -echo "Recreating the build directory $BUILD_PATH..." -rm -rf $BUILD_PATH && mkdir -p $BUILD_PATH -echo - -echo "Transferring the source: $SOURCE_PATH -> $BUILD_PATH. Please wait..." -cd $BUILD_PATH && cp -rp $SOURCE_PATH . && cd src -echo - -echo "Compiling PhantomJS..." && sleep 1 -python build.py --confirm --release --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit -echo - -echo "Stripping the executable..." && sleep 1 -ls -l bin/phantomjs -strip bin/phantomjs -echo "Copying the executable..." && sleep 1 -ls -l bin/phantomjs -cp bin/phantomjs $SOURCE_PATH -echo - -echo "Finished." diff --git a/deploy/package.sh b/deploy/package.sh deleted file mode 100755 index 16d6525bc7..0000000000 --- a/deploy/package.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env bash - -# -# usage: just run this script (after having run build.sh) -# and deploy the created tarball to your target machine. -# -# It creates a phantomjs-$version folder and copies the binary, -# example, license etc. together with all shared library dependencies -# to that folder. Furthermore brandelf is used to make the lib -# and binary compatible with older unix/linux machines that don't -# know the new Linux ELF ABI. -# - -cd $(dirname $0) - -if [[ ! -f ../bin/phantomjs ]]; then - echo "phantomjs was not built yet, please run build.sh first" - exit 1 -fi - -if [[ "$1" = "--bundle-libs" ]]; then - bundle_libs=1 -else - bundle_libs=0 -fi - -version=$(../bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g') -src=.. - -echo "packaging phantomjs $version" - -if [[ $OSTYPE = darwin* ]]; then - dest="phantomjs-$version-macosx" -else - dest="phantomjs-$version-linux-$(uname -m)" -fi - -rm -Rf $dest{.tar.bz2,} &> /dev/null -mkdir -p $dest/bin - -echo - -echo -n "copying files..." -cp $src/bin/phantomjs $dest/bin -cp -r $src/{ChangeLog,examples,LICENSE.BSD,third-party.txt,README.md} $dest/ -echo "done" -echo - -phantomjs=$dest/bin/phantomjs - -if [[ "$bundle_libs" = "1" ]]; then - mkdir -p $dest/lib - - if [[ ! -f brandelf ]]; then - echo - echo "brandelf executable not found in current dir" - echo -n "compiling it now..." - g++ brandelf.c -o brandelf || exit 1 - echo "done" - fi - - libs=$(ldd $phantomjs | egrep -o "/[^ ]+ ") - - echo -n "copying shared libs..." - libld= - for l in $libs; do - ll=$(basename $l) - cp $l $dest/lib/$ll - - if [[ "$bundle_libs" = "1" ]]; then - # ensure OS ABI compatibility - ./brandelf -t SVR4 $dest/lib/$ll - if [[ "$l" == *"ld-linux"* ]]; then - libld=$ll - fi - fi - done - echo "done" - echo - - echo -n "writing run script..." - mv $phantomjs $phantomjs.bin - phantomjs=$phantomjs.bin - run=$dest/bin/phantomjs - echo '#!/bin/sh' >> $run - echo 'path=$(dirname $(dirname $(readlink -f $0)))' >> $run - echo 'export LD_LIBRARY_PATH=$path/lib' >> $run - echo 'exec $path/lib/'$libld' $phantomjs $@' >> $run - chmod +x $run - echo "done" - echo -fi - -echo -n "stripping binary and libs..." -if [[ $OSTYPE = darwin* ]]; then - strip -x $phantomjs -else - strip -s $phantomjs - [[ -d $dest/lib ]] && strip -s $dest/lib/* -fi -echo "done" -echo - -echo -n "compressing binary..." -if type upx >/dev/null 2>&1; then - upx -qqq -9 $phantomjs - echo "done" -else - echo "upx not found" -fi -echo - -echo -n "creating archive..." -if [[ $OSTYPE = darwin* ]]; then - zip -r $dest.zip $dest -else - tar -cjf $dest{.tar.bz2,} -fi -echo "done" -echo diff --git a/phantomjs.pro b/phantomjs.pro deleted file mode 100644 index 24663df32f..0000000000 --- a/phantomjs.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered -SUBDIRS += src/phantomjs.pro diff --git a/src/linenoise/linenoise.pri b/src/linenoise/linenoise.pri deleted file mode 100644 index 9095bae9c3..0000000000 --- a/src/linenoise/linenoise.pri +++ /dev/null @@ -1,9 +0,0 @@ -VPATH += $$PWD/src -INCLUDEPATH += $$PWD/src - -DEFINES += USE_UTF8 - -SOURCES += linenoise.c \ - utf8.c -HEADERS += linenoise.h \ - utf8.h diff --git a/src/mongoose/mongoose.pri b/src/mongoose/mongoose.pri deleted file mode 100644 index 5fb16f9969..0000000000 --- a/src/mongoose/mongoose.pri +++ /dev/null @@ -1,7 +0,0 @@ -VPATH += $$PWD -INCLUDEPATH += $$PWD - -SOURCES += mongoose.c -HEADERS += mongoose.h -linux*:LIBS += -ldl -win32:LIBS += -lWs2_32 diff --git a/src/phantomjs.pro b/src/phantomjs.pro deleted file mode 100644 index 5b1e817f82..0000000000 --- a/src/phantomjs.pro +++ /dev/null @@ -1,103 +0,0 @@ - -if(!equals(QT_MAJOR_VERSION, 5)|!equals(QT_MINOR_VERSION, 5)) { - error("This program can only be compiled with Qt 5.5.x.") -} - -TEMPLATE = app -TARGET = phantomjs -QT += network webkitwidgets -CONFIG += console - -DESTDIR = ../bin - -RESOURCES = phantomjs.qrc \ - ghostdriver/ghostdriver.qrc - -win32 { - RESOURCES += \ - qt/qtwebkit/Source/WebCore/inspector/front-end/WebKit.qrc \ - qt/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc -} - -HEADERS += \ - phantom.h \ - callback.h \ - webpage.h \ - webserver.h \ - consts.h \ - utils.h \ - networkaccessmanager.h \ - cookiejar.h \ - filesystem.h \ - system.h \ - env.h \ - terminal.h \ - encoding.h \ - config.h \ - childprocess.h \ - repl.h \ - crashdump.h - -SOURCES += phantom.cpp \ - callback.cpp \ - webpage.cpp \ - webserver.cpp \ - main.cpp \ - utils.cpp \ - networkaccessmanager.cpp \ - cookiejar.cpp \ - filesystem.cpp \ - system.cpp \ - env.cpp \ - terminal.cpp \ - encoding.cpp \ - config.cpp \ - childprocess.cpp \ - repl.cpp \ - crashdump.cpp - -OTHER_FILES += \ - bootstrap.js \ - configurator.js \ - modules/fs.js \ - modules/webpage.js \ - modules/webserver.js \ - modules/child_process.js \ - modules/cookiejar.js \ - repl.js - -include(mongoose/mongoose.pri) -include(linenoise/linenoise.pri) -include(qcommandline/qcommandline.pri) - -win32: RC_FILE = phantomjs_win.rc -os2: RC_FILE = phantomjs_os2.rc - -mac { - QMAKE_CXXFLAGS += -fvisibility=hidden - QMAKE_LFLAGS += '-sectcreate __TEXT __info_plist Info.plist' - CONFIG -= app_bundle -# Uncomment to build a Mac OS X Universal Binary (i.e. x86 + ppc) -# CONFIG += x86 ppc -} - -win32-msvc* { - DEFINES += NOMINMAX \ - WIN32_LEAN_AND_MEAN \ - _CRT_SECURE_NO_WARNINGS - # ingore warnings: - # 4049 - locally defined symbol 'symbol' imported - QMAKE_LFLAGS += /ignore:4049 /LARGEADDRESSAWARE - LIBS += -lCrypt32 -lzlib - CONFIG(static) { - DEFINES += STATIC_BUILD - } -} - -linux { - CONFIG += c++11 -} - -openbsd* { - LIBS += -L/usr/X11R6/lib -} diff --git a/src/qcommandline/qcommandline.pri b/src/qcommandline/qcommandline.pri deleted file mode 100644 index e994f19b24..0000000000 --- a/src/qcommandline/qcommandline.pri +++ /dev/null @@ -1,7 +0,0 @@ -VPATH += $$PWD -INCLUDEPATH += $$PWD - -DEFINES += STATIC_BUILD QCOMMANDLINE_STATIC - -SOURCES += qcommandline.cpp -HEADERS += qcommandline.h