# Configuration for Darwin (Mac OS X) on x86.
# Included by combo/select.mk
-# We build everything in 32-bit, because some host tools are
-# 32-bit-only anyway (emulator, acc), and because it gives us
+ifneq ($(strip $(BUILD_HOST_64bit)),)
+# By default we build everything in 32-bit, because it gives us
# more consistency between the host tools and the target.
+# BUILD_HOST_64bit=1 overrides it for tool like emulator
+# which can benefit from 64-bit host arch.
+HOST_GLOBAL_CFLAGS += -m64
+HOST_GLOBAL_LDFLAGS += -m64
+else
HOST_GLOBAL_CFLAGS += -m32
HOST_GLOBAL_LDFLAGS += -m32
+endif # BUILD_HOST_64bit
# Use the Mac OSX SDK 10.5 if the build host is 10.6
build_mac_version := $(shell sw_vers -productVersion)
endif # $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc exists
endif # TARGET_PRODUCT == sdk
-# We build everything in 32-bit, because some host tools are
-# 32-bit-only anyway (emulator, acc), and because it gives us
+ifneq ($(strip $(BUILD_HOST_64bit)),)
+# By default we build everything in 32-bit, because it gives us
# more consistency between the host tools and the target.
+# BUILD_HOST_64bit=1 overrides it for tool like emulator
+# which can benefit from 64-bit host arch.
+HOST_GLOBAL_CFLAGS += -m64
+HOST_GLOBAL_LDFLAGS += -m64
+else
HOST_GLOBAL_CFLAGS += -m32
HOST_GLOBAL_LDFLAGS += -m32
+endif # BUILD_HOST_64bit
HOST_GLOBAL_CFLAGS += -fPIC
HOST_GLOBAL_CFLAGS += \
ifneq ($(findstring Linux,$(UNAME)),)
ifneq ($(strip $(USE_MINGW)),)
HOST_ACP_UNAVAILABLE := true
-TOOLS_PREFIX := /usr/bin/i586-mingw32msvc-
TOOLS_EXE_SUFFIX :=
HOST_GLOBAL_CFLAGS += -DUSE_MINGW
+ifneq ($(strip $(BUILD_HOST_64bit)),)
+TOOLS_PREFIX := /usr/bin/amd64-mingw32msvc-
+HOST_C_INCLUDES += /usr/lib/gcc/amd64-mingw32msvc/4.4.2/include
+HOST_GLOBAL_LD_DIRS += -L/usr/amd64-mingw32msvc/lib
+else
+TOOLS_PREFIX := /usr/bin/i586-mingw32msvc-
HOST_C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include
HOST_GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib
-endif
-endif
+endif # BUILD_HOST_64bit
+endif # USE_MINGW
+endif # Linux
HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
",\0".join(['"' + i + '"' for i in sorted(links)]) + ");")
self.script.append(self._WordWrap(cmd))
- def RetouchBinaries(self, file_list):
- """Execute the retouch instructions in files listed."""
- cmd = ('retouch_binaries(' +
- ', '.join(['"' + i[0] + '", "' + i[1] + '"' for i in file_list]) +
- ');')
- self.script.append(self._WordWrap(cmd))
-
- def UndoRetouchBinaries(self, file_list):
- """Undo the retouching (retouch to zero offset)."""
- cmd = ('undo_retouch_binaries(' +
- ', '.join(['"' + i[0] + '", "' + i[1] + '"' for i in file_list]) +
- ');')
- self.script.append(self._WordWrap(cmd))
-
def AppendExtra(self, extra):
"""Append text verbatim to the output script."""
self.script.append(extra)
-e (--extra_script) <file>
Insert the contents of file at the end of the update script.
-
- -a (--aslr_mode) <on|off>
- Specify whether to turn on ASLR for the package (on by default).
"""
import sys
substitute=None):
"""Copies files underneath system/ in the input zip to the output
zip. Populates the Item class with their metadata, and returns a
- list of symlinks as well as a list of files that will be retouched.
- output_zip may be None, in which case the copy is skipped (but the
- other side effects still happen). substitute is an optional dict
- of {output filename: contents} to be output instead of certain input
- files.
+ list of symlinks. output_zip may be None, in which case the copy is
+ skipped (but the other side effects still happen). substitute is an
+ optional dict of {output filename: contents} to be output instead of
+ certain input files.
"""
symlinks = []
- retouch_files = []
for info in input_zip.infolist():
if info.filename.startswith("SYSTEM/"):
data = substitute[fn]
else:
data = input_zip.read(info.filename)
- if info.filename.startswith("SYSTEM/lib/") and IsRegular(info):
- retouch_files.append(("/system/" + basefilename,
- common.sha1(data).hexdigest()))
output_zip.writestr(info2, data)
if fn.endswith("/"):
Item.Get(fn[:-1], dir=True)
Item.Get(fn, dir=False)
symlinks.sort()
- return (symlinks, retouch_files)
+ return symlinks
def SignOutput(temp_zip_name, output_zip_name):
script.UnpackPackageDir("recovery", "/system")
script.UnpackPackageDir("system", "/system")
- (symlinks, retouch_files) = CopySystemFiles(input_zip, output_zip)
+ symlinks = CopySystemFiles(input_zip, output_zip)
script.MakeSymlinks(symlinks)
- if OPTIONS.aslr_mode:
- script.RetouchBinaries(retouch_files)
- else:
- script.UndoRetouchBinaries(retouch_files)
boot_img = common.GetBootableImage("boot.img", "boot.img",
OPTIONS.input_tmp, "BOOT")
"""Load all the files from SYSTEM/... in a given target-files
ZipFile, and return a dict of {filename: File object}."""
out = {}
- retouch_files = []
for info in z.infolist():
if info.filename.startswith("SYSTEM/") and not IsSymlink(info):
basefilename = info.filename[7:]
fn = "system/" + basefilename
data = z.read(info.filename)
out[fn] = common.File(fn, data)
- if info.filename.startswith("SYSTEM/lib/") and IsRegular(info):
- retouch_files.append(("/system/" + basefilename,
- out[fn].sha1))
- return (out, retouch_files)
+ return out
def GetBuildProp(property, z):
info_dict=OPTIONS.info_dict)
print "Loading target..."
- (target_data, target_retouch_files) = LoadSystemFiles(target_zip)
+ target_data = LoadSystemFiles(target_zip)
print "Loading source..."
- (source_data, source_retouch_files) = LoadSystemFiles(source_zip)
+ source_data = LoadSystemFiles(source_zip)
verbatim_targets = []
patch_list = []
script.ShowProgress(0.1, 10)
- (target_symlinks, target_retouch_dummies) = CopySystemFiles(target_zip, None)
+ target_symlinks = CopySystemFiles(target_zip, None)
target_symlinks_d = dict([(i[1], i[0]) for i in target_symlinks])
temp_script = script.MakeTemporary()
# Note that this call will mess up the tree of Items, so make sure
# we're done with it.
- (source_symlinks, source_retouch_dummies) = CopySystemFiles(source_zip, None)
+ source_symlinks = CopySystemFiles(source_zip, None)
source_symlinks_d = dict([(i[1], i[0]) for i in source_symlinks])
# Delete all the symlinks in source that aren't in target. This
to_create.append((dest, link))
script.DeleteFiles([i[1] for i in to_create])
script.MakeSymlinks(to_create)
- if OPTIONS.aslr_mode:
- script.RetouchBinaries(target_retouch_files)
- else:
- script.UndoRetouchBinaries(target_retouch_files)
# Now that the symlinks are created, we can set all the
# permissions.