Set sysroot for arm build
This commit is contained in:
parent
88eb5283a0
commit
4214b62551
4 changed files with 128 additions and 4 deletions
4
atom.gyp
4
atom.gyp
|
@ -5,8 +5,6 @@
|
|||
'company_name%': 'GitHub, Inc',
|
||||
'company_abbr%': 'github',
|
||||
'version%': '0.28.3',
|
||||
|
||||
'atom_source_root': '<!(["python", "tools/atom_source_root.py"])',
|
||||
},
|
||||
'includes': [
|
||||
'filenames.gypi',
|
||||
|
@ -18,7 +16,7 @@
|
|||
'ATOM_PROJECT_NAME="<(project_name)"',
|
||||
],
|
||||
'mac_framework_dirs': [
|
||||
'<(atom_source_root)/external_binaries',
|
||||
'<(source_root)/external_binaries',
|
||||
],
|
||||
},
|
||||
'targets': [
|
||||
|
|
|
@ -416,7 +416,6 @@
|
|||
'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
|
||||
'vi', 'zh-CN', 'zh-TW',
|
||||
],
|
||||
'atom_source_root': '<!(["python", "tools/atom_source_root.py"])',
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'app_sources': [
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
'variables': {
|
||||
# The abosulte version of <(DEPTH).
|
||||
'source_root': '<!(cd <(DEPTH) && pwd -P)',
|
||||
|
||||
# Clang stuff.
|
||||
'make_clang_dir%': 'vendor/llvm-build/Release+Asserts',
|
||||
# Set this to true when building with Clang.
|
||||
|
@ -51,6 +54,7 @@
|
|||
],
|
||||
},
|
||||
'conditions': [
|
||||
# Setup building with clang.
|
||||
['clang==1', {
|
||||
'make_global_settings': [
|
||||
['CC', '<(make_clang_dir)/bin/clang'],
|
||||
|
@ -85,6 +89,29 @@
|
|||
},
|
||||
}], # clang==1
|
||||
|
||||
# Setup sysroot environment.
|
||||
['OS=="linux" and target_arch=="arm"', {
|
||||
'variables': {
|
||||
# sysroot needs to be an absolute path otherwise it generates
|
||||
# incorrect results when passed to pkg-config
|
||||
'sysroot': '<(source_root)/vendor/debian_wheezy_arm-sysroot',
|
||||
},
|
||||
'target_defaults': {
|
||||
'target_conditions': [
|
||||
['_toolset=="target"', {
|
||||
'cflags': [
|
||||
'--sysroot=<(sysroot)',
|
||||
],
|
||||
'ldflags': [
|
||||
'--sysroot=<(sysroot)',
|
||||
'<!(<(source_root)/tools/linux/sysroot_ld_path.sh <(sysroot))',
|
||||
],
|
||||
}]
|
||||
],
|
||||
},
|
||||
}], # target_arch==arm
|
||||
|
||||
# Setup cross-compilation on Linux.
|
||||
['OS=="linux"', {
|
||||
'target_defaults': {
|
||||
'target_conditions': [
|
||||
|
|
100
tools/linux/sysroot_ld_path.sh
Executable file
100
tools/linux/sysroot_ld_path.sh
Executable file
|
@ -0,0 +1,100 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Reads etc/ld.so.conf and/or etc/ld.so.conf.d/*.conf and returns the
|
||||
# appropriate linker flags.
|
||||
#
|
||||
# sysroot_ld_path.sh /abspath/to/sysroot
|
||||
#
|
||||
|
||||
log_error_and_exit() {
|
||||
echo $0: $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
process_entry() {
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
log_error_and_exit "bad arguments to process_entry()"
|
||||
fi
|
||||
local root="$1"
|
||||
local localpath="$2"
|
||||
|
||||
echo $localpath | grep -qs '^/'
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error_and_exit $localpath does not start with /
|
||||
fi
|
||||
local entry="$root$localpath"
|
||||
echo -L$entry
|
||||
echo -Wl,-rpath-link=$entry
|
||||
}
|
||||
|
||||
process_ld_so_conf() {
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
log_error_and_exit "bad arguments to process_ld_so_conf()"
|
||||
fi
|
||||
local root="$1"
|
||||
local ld_so_conf="$2"
|
||||
|
||||
# ld.so.conf may include relative include paths. pushd is a bashism.
|
||||
local saved_pwd=$(pwd)
|
||||
cd $(dirname "$ld_so_conf")
|
||||
|
||||
cat "$ld_so_conf" | \
|
||||
while read ENTRY; do
|
||||
echo "$ENTRY" | grep -qs ^include
|
||||
if [ $? -eq 0 ]; then
|
||||
local included_files=$(echo "$ENTRY" | sed 's/^include //')
|
||||
echo "$included_files" | grep -qs ^/
|
||||
if [ $? -eq 0 ]; then
|
||||
if ls $root$included_files >/dev/null 2>&1 ; then
|
||||
for inc_file in $root$included_files; do
|
||||
process_ld_so_conf "$root" "$inc_file"
|
||||
done
|
||||
fi
|
||||
else
|
||||
if ls $(pwd)/$included_files >/dev/null 2>&1 ; then
|
||||
for inc_file in $(pwd)/$included_files; do
|
||||
process_ld_so_conf "$root" "$inc_file"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$ENTRY" | grep -qs ^/
|
||||
if [ $? -eq 0 ]; then
|
||||
process_entry "$root" "$ENTRY"
|
||||
fi
|
||||
done
|
||||
|
||||
# popd is a bashism
|
||||
cd "$saved_pwd"
|
||||
}
|
||||
|
||||
# Main
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo Usage $0 /abspath/to/sysroot
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $1 | grep -qs ' '
|
||||
if [ $? -eq 0 ]; then
|
||||
log_error_and_exit $1 contains whitespace.
|
||||
fi
|
||||
|
||||
LD_SO_CONF="$1/etc/ld.so.conf"
|
||||
LD_SO_CONF_D="$1/etc/ld.so.conf.d"
|
||||
|
||||
if [ -e "$LD_SO_CONF" ]; then
|
||||
process_ld_so_conf "$1" "$LD_SO_CONF" | xargs echo
|
||||
elif [ -e "$LD_SO_CONF_D" ]; then
|
||||
find "$LD_SO_CONF_D" -maxdepth 1 -name '*.conf' -print -quit > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
for entry in $LD_SO_CONF_D/*.conf; do
|
||||
process_ld_so_conf "$1" "$entry"
|
||||
done | xargs echo
|
||||
fi
|
||||
fi
|
Loading…
Reference in a new issue