Checking for the existing of Xcode command line tools in order to complete a successful build on mac.

This commit is contained in:
Chris Kleeschulte 2015-07-31 15:53:04 -04:00
parent f4061037b6
commit 78f20a1a8c
3 changed files with 37 additions and 9 deletions

View File

@ -273,7 +273,7 @@ Most of all the dependencies for building Bitcoin Core are needed, for more info
- OpenSSL headers and libraries (-lcrypto and -lssl), this is used to compile Bitcoin. - OpenSSL headers and libraries (-lcrypto and -lssl), this is used to compile Bitcoin.
- If target platform is Mac OS X, then OS X >= 10.9, Clang and associated linker. - If target platform is Mac OS X, then OS X >= 10.9, Clang and associated linker. Clang is exclusively installed via Xcode from the Apple App Store. In addition to Xcode, you will need the assoicated Xcode command line tools. First, install Xcode using the App Store app in Mac OS X. After this is installed, open a terminal and type in 'xcode-select --install'. Follow the prompts to get the command line tools installed.
#### Shared Library Patch #### Shared Library Patch

View File

@ -8,6 +8,7 @@ host=$(${root_dir}/platform/os.sh host)
btc_dir="${root_dir}/libbitcoind" btc_dir="${root_dir}/libbitcoind"
ext=$($root_dir/platform/os.sh ext) ext=$($root_dir/platform/os.sh ext)
artifacts_dir=$($root_dir/platform/os.sh artifacts_dir) artifacts_dir=$($root_dir/platform/os.sh artifacts_dir)
export CPPFLAGS="-I${h_and_a_dir}/include/boost -I${h_and_a_dir}/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include -L${h_and_a_dir}/lib"
echo "Using BTC directory: ${btc_dir}" echo "Using BTC directory: ${btc_dir}"
cd "${root_dir}" cd "${root_dir}"
@ -16,6 +17,7 @@ copy_header_files () {
if [[ -d "${artifacts_dir}" && -d "${h_and_a_dir}" && -d "${btc_dir}" ]]; then if [[ -d "${artifacts_dir}" && -d "${h_and_a_dir}" && -d "${btc_dir}" ]]; then
mkdir -p "${artifacts_dir}/include" > /dev/null 2>&1 mkdir -p "${artifacts_dir}/include" > /dev/null 2>&1
pushd "${root_dir}" pushd "${root_dir}"
echo "Copying headers for caching purposes, this can take a while (but will only be done once), please wait..."
find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.ipp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.ipp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include
mkdir -p "${artifacts_dir}/lib" > /dev/null 2>&1 mkdir -p "${artifacts_dir}/lib" > /dev/null 2>&1
cp -r "${h_and_a_dir}"/lib/libboost_filesystem-mt.a "${h_and_a_dir}"/lib/libboost_thread-mt.a "${artifacts_dir}"/lib/ cp -r "${h_and_a_dir}"/lib/libboost_filesystem-mt.a "${h_and_a_dir}"/lib/libboost_thread-mt.a "${artifacts_dir}"/lib/
@ -59,7 +61,7 @@ compare_patch () {
cd "${btc_dir}" cd "${btc_dir}"
get_patch_file get_patch_file
echo "running the diff command from HEAD to ${tag}" echo "running the diff command from HEAD to ${tag}"
git diff ${tag}..HEAD > /tmp/tmp.patch #uncommitted changes won't affect things here git diff ${tag}..HEAD > /tmp/tmp.patch
matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"` matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"`
} }
@ -75,10 +77,14 @@ if [ "${BITCORENODE_ENV}" == "test" ]; then
fi fi
patch_file_sha=$(shasum -a 256 "${root_dir}/etc/bitcoin.patch" | awk '{print $1}') patch_file_sha=$(shasum -a 256 "${root_dir}/etc/bitcoin.patch" | awk '{print $1}')
if [ "${ext}" == "dylib" ]; then patch_sha=`find "${os_dir}" -iname patch_sha.txt`
last_patch_file_sha=$(cat "${os_dir}"/lib/patch_sha.txt) last_patch_file_sha=
else if [ -e "${patch_sha}" ]; then
last_patch_file_sha=$(cat "${os_dir}"/patch_sha.txt) if [ "${ext}" == "dylib" ]; then
last_patch_file_sha=$(cat "${os_dir}"/lib/patch_sha.txt)
else
last_patch_file_sha=$(cat "${os_dir}"/patch_sha.txt)
fi
fi fi
shared_file_built=false shared_file_built=false
if [[ "${last_patch_file_sha}" == "${patch_file_sha}" && -d "${artifacts_dir}/include" ]]; then if [[ "${last_patch_file_sha}" == "${patch_file_sha}" && -d "${artifacts_dir}/include" ]]; then
@ -86,6 +92,11 @@ if [[ "${last_patch_file_sha}" == "${patch_file_sha}" && -d "${artifacts_dir}/in
fi fi
if [ "${shared_file_built}" = false ]; then if [ "${shared_file_built}" = false ]; then
mac_response=$($root_dir/platform/os.sh mac_dependencies)
if [ "${mac_response}" != "" ]; then
echo "${mac_response}"
exit -1
fi
only_make=false only_make=false
if [ -d "${btc_dir}" ]; then if [ -d "${btc_dir}" ]; then
echo "running compare patch..." echo "running compare patch..."
@ -138,7 +149,6 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
echo './autogen.sh' echo './autogen.sh'
./autogen.sh ./autogen.sh
export CPPFLAGS="-I${h_and_a_dir}/include/boost -I${h_and_a_dir}/include -L${h_and_a_dir}/lib"
boost_libdir="--with-boost-libdir=${h_and_a_dir}/lib" boost_libdir="--with-boost-libdir=${h_and_a_dir}/lib"
full_options="${options} ${boost_libdir} --prefix=${os_dir}" full_options="${options} ${boost_libdir} --prefix=${os_dir}"

View File

@ -11,6 +11,19 @@ host=`uname -m`-`uname -a | awk '{print tolower($1)}'`
depends_dir="${BITCOIN_DIR}"/depends depends_dir="${BITCOIN_DIR}"/depends
h_and_a_dir="${depends_dir}"/"${host}" h_and_a_dir="${depends_dir}"/"${host}"
mac_response=
check_mac_build_system () {
if [ "${ext}" == "dylib" ]; then
if [ ! -d "/usr/include" ]; then
if hash xcode-select 2>/dev/null; then
mac_response="Please run 'xcode-select --install' from the command line because it seems that you've got Xcode, but not the Xcode command line tools that are required for compiling this project from source..."
else
mac_response="please use the App Store to install Xcode and Xcode command line tools. After Xcode is installed, please run: 'xcode-select --install' from the command line"
fi
fi
fi
}
if test -f /etc/centos-release \ if test -f /etc/centos-release \
|| grep -q 'CentOS' /etc/redhat-release \ || grep -q 'CentOS' /etc/redhat-release \
|| rpm -q --queryformat '%{VERSION}' centos-release > /dev/null; then || rpm -q --queryformat '%{VERSION}' centos-release > /dev/null; then
@ -113,6 +126,11 @@ if test -z "$1" -o x"$1" = x'artifacts_dir'; then
echo -n "${artifacts_dir}" echo -n "${artifacts_dir}"
fi fi
if test -z "$1" -o x"$1" = x'mac_dependencies'; then
check_mac_build_system
echo -n "${mac_response}"
fi
if test -z "$1" -o x"$1" = x'lib'; then if test -z "$1" -o x"$1" = x'lib'; then
if test -e "${os_dir}/libbitcoind.${ext}" -o -e "${os_dir}/lib/libbitcoind.${ext}"; then if test -e "${os_dir}/libbitcoind.${ext}" -o -e "${os_dir}/lib/libbitcoind.${ext}"; then
if test -e "${os_dir}/lib/libbitcoind.${ext}"; then if test -e "${os_dir}/lib/libbitcoind.${ext}"; then