├── .gitignore ├── .gitmodules ├── CL-Stub ├── libopencl.c └── libopencl.h ├── LICENSE ├── README.md ├── build.py ├── envsetup ├── get_opencl.sh ├── jni ├── Android.mk ├── Application.mk └── test_sort.cpp └── third-party └── Boost-for-Android ├── .gitattributes ├── .gitignore ├── README.md ├── build-android.sh ├── build-common.sh ├── configs ├── user-config-boost-1_45_0.jam ├── user-config-boost-1_48_0.jam ├── user-config-boost-1_49_0.jam ├── user-config-boost-1_53_0.jam ├── user-config-boost-1_54_0.jam └── user-config-boost-1_55_0.jam ├── download-boost.sh └── patches ├── boost-1_45_0 ├── address_v6.ipp.patch ├── android.jam.patch ├── android.py.patch ├── endian.hpp.patch ├── fenced_block.hpp.patch ├── operations.cpp.patch ├── socket_types.hpp.patch ├── user.hpp.patch ├── v2_operations.cpp.patch └── workaround.hpp.patch ├── boost-1_48_0 └── boost-1_48_0.patch ├── boost-1_49_0 └── boost-1_49_0.patch ├── boost-1_53_0 └── boost-1_53_0.patch ├── boost-1_54_0 └── boost-1_54_0.patch └── boost-1_55_0 └── boost-1_55_0.patch /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore CL headers 2 | CL-12 3 | third-party/Boost-for-Android/boost_1_55_0/ 4 | third-party/OpenCV* 5 | third-party/opencv* 6 | 7 | # JNI objs and output 8 | obj 9 | libs 10 | 11 | # Compiled Object files 12 | *.slo 13 | *.lo 14 | *.o 15 | *.obj 16 | 17 | # Precompiled Headers 18 | *.gch 19 | *.pch 20 | 21 | # Compiled Dynamic libraries 22 | *.so 23 | *.dylib 24 | *.dll 25 | 26 | # Fortran module files 27 | *.mod 28 | *.smod 29 | 30 | # Compiled Static libraries 31 | *.lai 32 | *.la 33 | *.a 34 | *.lib 35 | 36 | # Executables 37 | *.exe 38 | *.out 39 | *.app 40 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third-party/miniglog"] 2 | path = third-party/miniglog 3 | url = https://github.com/tzutalin/miniglog 4 | [submodule "compute"] 5 | path = compute 6 | url = https://github.com/boostorg/compute.git 7 | -------------------------------------------------------------------------------- /CL-Stub/libopencl.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBOPENCL_STUB_H 2 | #define LIBOPENCL_STUB_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | typedef void (*f_pfn_notify)(const char *, const void *, size_t, void *); 12 | 13 | typedef cl_int (*f_clGetPlatformIDs) (cl_uint, cl_platform_id *, cl_uint *); 14 | 15 | typedef cl_int (*f_clGetPlatformInfo) (cl_platform_id, cl_platform_info, size_t, void *, size_t *); 16 | 17 | typedef cl_int (*f_clGetDeviceIDs) (cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *); 18 | 19 | typedef cl_int (*f_clGetDeviceInfo) (cl_device_id, cl_device_info, size_t, void *, size_t *); 20 | 21 | typedef cl_int (*f_clCreateSubDevices) (cl_device_id, const cl_device_partition_property *, 22 | cl_uint, cl_device_id *, cl_uint *); 23 | 24 | typedef cl_int (*f_clRetainDevice) (cl_device_id); 25 | 26 | typedef cl_int (*f_clReleaseDevice) (cl_device_id); 27 | 28 | typedef cl_context (*f_clCreateContext) (const cl_context_properties *, cl_uint, const cl_device_id *, 29 | f_pfn_notify, void *, cl_int *); 30 | 31 | typedef cl_context (*f_clCreateContextFromType) (const cl_context_properties *, cl_device_type, 32 | f_pfn_notify, void *, cl_int *); 33 | 34 | typedef cl_int (*f_clRetainContext) (cl_context); 35 | 36 | typedef cl_int (*f_clReleaseContext) (cl_context); 37 | 38 | typedef cl_int (*f_clGetContextInfo) (cl_context, cl_context_info, size_t, void *, size_t *); 39 | 40 | typedef cl_command_queue (*f_clCreateCommandQueue) (cl_context, cl_device_id, cl_command_queue_properties, cl_int *); 41 | 42 | typedef cl_int (*f_clRetainCommandQueue) (cl_command_queue); 43 | 44 | typedef cl_int (*f_clReleaseCommandQueue) (cl_command_queue); 45 | 46 | typedef cl_int (*f_clGetCommandQueueInfo) (cl_command_queue, cl_command_queue_info, size_t, void *, size_t *); 47 | 48 | typedef cl_mem (*f_clCreateBuffer) (cl_context, cl_mem_flags, size_t, void *, cl_int *); 49 | 50 | typedef cl_mem (*f_clCreateSubBuffer) (cl_mem, cl_mem_flags, cl_buffer_create_type, const void *, cl_int *); 51 | 52 | typedef cl_mem (*f_clCreateImage) (cl_context, cl_mem_flags, const cl_image_format *, const cl_image_desc *, void *, cl_int *); 53 | 54 | typedef cl_int (*f_clRetainMemObject) (cl_mem); 55 | 56 | typedef cl_int (*f_clReleaseMemObject) (cl_mem); 57 | 58 | typedef cl_int (*f_clGetMemObjectInfo) (cl_mem, cl_mem_info, size_t, void *, size_t *); 59 | 60 | typedef cl_int (*f_clGetImageInfo) (cl_mem, cl_image_info, size_t, void *, size_t *); 61 | 62 | typedef cl_int (*f_clSetMemObjectDestructorCallback) (cl_mem, void (*pfn_notify)( cl_mem memobj, void* user_data), void *); 63 | 64 | typedef cl_int (*f_clGetSupportedImageFormats) (cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format *, cl_uint *); 65 | 66 | typedef cl_sampler (*f_clCreateSampler) (cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int *); 67 | 68 | typedef cl_int (*f_clRetainSampler) (cl_sampler); 69 | 70 | typedef cl_int (*f_clReleaseSampler) (cl_sampler); 71 | 72 | typedef cl_int (*f_clGetSamplerInfo) (cl_sampler, cl_sampler_info, size_t, void *, size_t *); 73 | 74 | typedef cl_program (*f_clCreateProgramWithSource) (cl_context, cl_uint, const char **, const size_t *, cl_int *); 75 | 76 | typedef cl_program (*f_clCreateProgramWithBinary) (cl_context, cl_uint, const cl_device_id *, 77 | const size_t *, const unsigned char **, cl_int *, cl_int *); 78 | 79 | typedef cl_program (*f_clCreateProgramWithBuiltInKernels) (cl_context, cl_uint, const cl_device_id *, const char *, cl_int *); 80 | 81 | typedef cl_int (*f_clRetainProgram) (cl_program); 82 | 83 | typedef cl_int (*f_clReleaseProgram) (cl_program); 84 | 85 | typedef cl_int (*f_clBuildProgram) (cl_program, cl_uint, const cl_device_id *, const char *, 86 | void (*pfn_notify)(cl_program program, void * user_data), void *); 87 | 88 | typedef cl_int (*f_clCompileProgram) (cl_program, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, 89 | const char **, void (*pfn_notify)(cl_program program, void * user_data), void *); 90 | 91 | typedef cl_program (*f_clLinkProgram) (cl_context, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, 92 | void (*pfn_notify)(cl_program program, void * user_data), void *, cl_int *); 93 | 94 | typedef cl_int (*f_clUnloadPlatformCompiler)(cl_platform_id); 95 | 96 | typedef cl_int (*f_clGetProgramInfo) (cl_program, cl_program_info, size_t, void *, size_t *); 97 | 98 | typedef cl_int (*f_clGetProgramBuildInfo) (cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *); 99 | 100 | typedef cl_kernel (*f_clCreateKernel) (cl_program, const char *, cl_int *); 101 | 102 | typedef cl_int (*f_clCreateKernelsInProgram) (cl_program, cl_uint, cl_kernel *, cl_uint *); 103 | 104 | typedef cl_int (*f_clRetainKernel) (cl_kernel); 105 | 106 | typedef cl_int (*f_clReleaseKernel) (cl_kernel); 107 | 108 | typedef cl_int (*f_clSetKernelArg) (cl_kernel, cl_uint, size_t,const void *); 109 | 110 | typedef cl_int (*f_clGetKernelInfo) (cl_kernel, cl_kernel_info, size_t, void *, size_t *); 111 | 112 | typedef cl_int (*f_clGetKernelArgInfo) (cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void *, size_t *); 113 | 114 | typedef cl_int (*f_clGetKernelWorkGroupInfo) (cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *); 115 | 116 | typedef cl_int (*f_clWaitForEvents) (cl_uint, const cl_event *); 117 | 118 | typedef cl_int (*f_clGetEventInfo) (cl_event, cl_event_info, size_t, void *, size_t *); 119 | 120 | typedef cl_event (*f_clCreateUserEvent) (cl_context, cl_int *); 121 | 122 | typedef cl_int (*f_clRetainEvent) (cl_event); 123 | 124 | typedef cl_int (*f_clReleaseEvent) (cl_event); 125 | 126 | typedef cl_int (*f_clSetUserEventStatus) (cl_event, cl_int); 127 | 128 | typedef cl_int (*f_clSetEventCallback) (cl_event, cl_int, void (*pfn_notify)(cl_event, cl_int, void *), void *); 129 | 130 | typedef cl_int (*f_clGetEventProfilingInfo) (cl_event, cl_profiling_info, size_t, void *, size_t *); 131 | 132 | typedef cl_int (*f_clFlush) (cl_command_queue); 133 | 134 | typedef cl_int (*f_clFinish) (cl_command_queue); 135 | 136 | typedef cl_int (*f_clEnqueueReadBuffer) (cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *); 137 | 138 | typedef cl_int (*f_clEnqueueReadBufferRect) (cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, 139 | size_t, size_t, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *); 140 | 141 | typedef cl_int (*f_clEnqueueWriteBuffer) (cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); 142 | 143 | typedef cl_int (*f_clEnqueueWriteBufferRect) (cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, 144 | size_t, size_t, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); 145 | 146 | typedef cl_int (*f_clEnqueueFillBuffer) (cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); 147 | 148 | typedef cl_int (*f_clEnqueueCopyBuffer) (cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); 149 | 150 | typedef cl_int (*f_clEnqueueCopyBufferRect) (cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, 151 | size_t, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); 152 | 153 | typedef cl_int (*f_clEnqueueReadImage) (cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, 154 | size_t, size_t, void *, cl_uint, const cl_event *, cl_event *); 155 | 156 | typedef cl_int (*f_clEnqueueWriteImage) (cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, 157 | size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); 158 | 159 | typedef cl_int (*f_clEnqueueFillImage) (cl_command_queue, cl_mem, const void *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *); 160 | 161 | typedef cl_int (*f_clEnqueueCopyImage) (cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, 162 | cl_uint, const cl_event *, cl_event *); 163 | 164 | typedef cl_int (*f_clEnqueueCopyImageToBuffer) (cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, size_t, cl_uint, const cl_event *, cl_event *); 165 | 166 | typedef cl_int (*f_clEnqueueCopyBufferToImage) (cl_command_queue, cl_mem, cl_mem, size_t, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *); 167 | 168 | typedef void * (*f_clEnqueueMapBuffer) (cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, 169 | size_t, cl_uint, const cl_event *, cl_event *, cl_int *); 170 | 171 | typedef void * (*f_clEnqueueMapImage) (cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, 172 | size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int *); 173 | 174 | typedef cl_int (*f_clEnqueueUnmapMemObject) (cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *); 175 | 176 | typedef cl_int (*f_clEnqueueMigrateMemObjects)(cl_command_queue, cl_uint, const cl_mem *, cl_mem_migration_flags, 177 | cl_uint, const cl_event *, cl_event *); 178 | 179 | typedef cl_int (*f_clEnqueueNDRangeKernel)(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, 180 | const size_t *, cl_uint, const cl_event *, cl_event *); 181 | 182 | typedef cl_int (*f_clEnqueueTask)(cl_command_queue, cl_kernel, cl_uint, const cl_event *, cl_event *); 183 | 184 | typedef cl_int (*f_clEnqueueNativeKernel)(cl_command_queue, void (*user_func)(void *), void *, size_t, 185 | cl_uint, const cl_mem *, const void **, cl_uint, const cl_event *, cl_event *); 186 | 187 | typedef cl_int (*f_clEnqueueMarkerWithWaitList)(cl_command_queue, cl_uint, const cl_event *, cl_event *); 188 | 189 | typedef cl_int (*f_clEnqueueBarrierWithWaitList)(cl_command_queue, cl_uint, const cl_event *, cl_event *); 190 | 191 | typedef void * (*f_clGetExtensionFunctionAddressForPlatform)(cl_platform_id, const char *); 192 | 193 | typedef cl_mem (*f_clCreateImage2D)(cl_context, cl_mem_flags,const cl_image_format *, size_t, size_t, 194 | size_t, void *, cl_int *); 195 | 196 | typedef cl_mem (*f_clCreateImage3D)(cl_context, cl_mem_flags, const cl_image_format *, size_t, 197 | size_t, size_t, size_t, size_t, void *, cl_int *); 198 | 199 | typedef cl_int (*f_clEnqueueMarker)(cl_command_queue, cl_event *); 200 | 201 | typedef cl_int(*f_clEnqueueWaitForEvents)(cl_command_queue, cl_uint, const cl_event *); 202 | 203 | typedef cl_int (*f_clEnqueueBarrier)(cl_command_queue); 204 | 205 | typedef cl_int (*f_clUnloadCompiler)(void); 206 | 207 | typedef void * (*f_clGetExtensionFunctionAddress)(const char *); 208 | 209 | typedef cl_mem (*f_clCreateFromGLBuffer) (cl_context, cl_mem_flags, cl_GLuint, int *); 210 | 211 | typedef cl_mem (*f_clCreateFromGLTexture) (cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *); 212 | 213 | typedef cl_mem (*f_clCreateFromGLRenderbuffer) (cl_context, cl_mem_flags, cl_GLuint, cl_int *); 214 | 215 | typedef cl_int (*f_clGetGLObjectInfo) (cl_mem memobj, cl_gl_object_type *, cl_GLuint *); 216 | 217 | typedef cl_int (*f_clGetGLTextureInfo) (cl_mem, cl_gl_texture_info, size_t, void *, size_t *); 218 | 219 | typedef cl_int (*f_clEnqueueAcquireGLObjects) (cl_command_queue, cl_uint, const cl_mem *, cl_uint, 220 | const cl_event *, cl_event *); 221 | 222 | typedef cl_int (*f_clEnqueueReleaseGLObjects) (cl_command_queue, cl_uint, const cl_mem *, cl_uint, 223 | const cl_event *, cl_event *); 224 | 225 | typedef cl_mem (*f_clCreateFromGLTexture2D) (cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *); 226 | 227 | typedef cl_mem (*f_clCreateFromGLTexture3D) (cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *); 228 | 229 | typedef cl_int (*f_clGetGLContextInfoKHR) (const cl_context_properties *, cl_gl_context_info, size_t, 230 | void *, size_t *); 231 | 232 | // Additional api to reset currently opened opencl shared-object 233 | // Subsequent calls will use newly set environment variables 234 | void stubOpenclReset(); 235 | 236 | #endif // LIBOPENCL_STUB_H 237 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | TzuTaLin 2 | 3 | Boost Software License - Version 1.0 - August 17th, 2003 4 | 5 | Permission is hereby granted, free of charge, to any person or organization 6 | obtaining a copy of the software and accompanying documentation covered by 7 | this license (the "Software") to use, reproduce, display, distribute, 8 | execute, and transmit the Software, and to prepare derivative works of the 9 | Software, and to permit third-parties to whom the Software is furnished to 10 | do so, all subject to the following: 11 | 12 | The copyright notices in the Software and this entire statement, including 13 | the above license grant, this restriction and the following disclaimer, 14 | must be included in all copies of the Software, in whole or in part, and 15 | all derivative works of the Software, unless such copies or derivative 16 | works are solely in the form of machine-executable object code generated by 17 | a source language processor. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Boost.Compute-Android 2 | 3 | ## Purpose 4 | 5 | Boost.Compute-Anroid is a GPU/parallel-computing library for C++ based on OpenCL for Android platform 6 | 7 | ## Requirements 8 | * Prepare a Android device 9 | 10 | * [Download and setup NDK](https://github.com/tzutalin/android-ndk-downloader) 11 | 12 | ## Setup 13 | `$ ./envsetup` 14 | 15 | ## Build and run the first sample, sort.cpp 16 | 17 | Make sure connecting to an Android device 18 | 19 | `$ adb devices` 20 | 21 | 22 | Build and run 23 | 24 | `$ ./build.py --test` 25 | 26 | Result on terminal: 27 | ``` 28 | get the default compute device 29 | get name:QUALCOMM Adreno(TM) 30 | get global memory:956149760 31 | get local memory:8192 32 | get compute_units:4 33 | get device type:4 34 | create a compute context and command queue 35 | generate random 10000 numbers on the host 36 | create vector on the device 37 | copy data to the device 38 | sort data on the device 39 | copy data back to the host 40 | cost time:1.0061 41 | 42 | Compare with STL sort without Boost.Compute 43 | generate random 10000 numbers for stl to sort 44 | cost time:0.00234 45 | ``` 46 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os 3 | import sys 4 | import argparse 5 | from distutils.dir_util import copy_tree 6 | import subprocess 7 | from subprocess import Popen, PIPE 8 | 9 | DEVICE_ABI = 'armeabi-v7a'; 10 | 11 | def parse_args(): 12 | """ 13 | Parse input arguments 14 | """ 15 | parser = argparse.ArgumentParser(description='Build dlib-android') 16 | parser.add_argument('--jobs', dest='jobs', help='Jobs to compile', 17 | default=1, type=int) 18 | 19 | parser.add_argument('--clean', action='store_true', 20 | help='clean obj and binaries') 21 | 22 | parser.add_argument('--test', action='store_true', 23 | help='Push executable file to data/local/tmp/, and run them') 24 | 25 | args = parser.parse_args() 26 | return args 27 | 28 | def ndk_build(jobs): 29 | try: 30 | # subprocess.call(['ndk-build', 'NDK_LOG=1', 'NDK_DEBUG=1', 'V=1', '-j' + str(jobs)]) 31 | print subprocess.check_output(['ndk-build', '-j4', 'NDK_LOG=1', 'NDK_DEBUG=1', 'V=1'], stderr=subprocess.STDOUT, universal_newlines=True) 32 | except subprocess.CalledProcessError as grepexc: 33 | print grepexc.output 34 | print('\033[91m' + ' error ! ' + '\033[0m') 35 | os.sys.exit(0) 36 | 37 | def ndk_clean(): 38 | subprocess.call(['ndk-build', 'clean']) 39 | 40 | def setDeviceABI(): 41 | global DEVICE_ABI 42 | p = subprocess.Popen(['adb', 'shell', 'getprop', 'ro.product.cpu.abi'], stdin=PIPE, stdout=PIPE, stderr=PIPE) 43 | output, err = p.communicate(b"input data that is passed to subprocess' stdin") 44 | rc = p.returncode 45 | if rc == 0: 46 | if "x86" in output: 47 | DEVICE_ABI = 'x86' 48 | 49 | print 'ABI:' + DEVICE_ABI 50 | 51 | def test(): 52 | global DEVICE_ABI 53 | print '----Push test_sort to phone device' 54 | srcFolder = os.path.join('libs', DEVICE_ABI, 'test_sort') 55 | subprocess.call(['adb', 'push', srcFolder, '/data/local/tmp']) 56 | print '----Execute /data/local/tmp/test_sort' 57 | subprocess.call(['adb', 'shell', './data/local/tmp/test_sort']) 58 | 59 | if __name__ == '__main__': 60 | # Move to top-level 61 | ROOT = os.path.dirname(os.path.abspath(__file__)) 62 | os.chdir(ROOT) 63 | 64 | libs_dir = os.path.join(ROOT, 'libs') 65 | obj_dir = os.path.join(ROOT, 'obj') 66 | 67 | setDeviceABI() 68 | 69 | args = parse_args() 70 | if args.clean: 71 | ndk_clean() 72 | else: 73 | ndk_build(args.jobs) 74 | 75 | if args.test: 76 | test() 77 | -------------------------------------------------------------------------------- /envsetup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os 3 | import sys 4 | import argparse 5 | import shutil 6 | from subprocess import call 7 | import zipfile 8 | import subprocess 9 | 10 | ROOT = None 11 | 12 | def unzipFile(filename): 13 | zfile = zipfile.ZipFile(filename) 14 | for name in zfile.namelist(): 15 | (dirname, filename) = os.path.split(name) 16 | print "Decompressing " + filename + " on " + dirname 17 | zfile.extract(name) 18 | 19 | def copytree(src, dst, symlinks=False, ignore=None): 20 | for item in os.listdir(src): 21 | s = os.path.join(src, item) 22 | d = os.path.join(dst, item) 23 | if os.path.isdir(s): 24 | shutil.copytree(s, d, symlinks, ignore) 25 | else: 26 | shutil.copy2(s, d) 27 | 28 | # setup opencv 29 | def downloadPrebuiltOpencv(prefix='.', out_prefix= '.', version='3.1.0'): 30 | OPENCV_PREBUILT_URL = 'http://netix.dl.sourceforge.net/project/opencvlibrary/opencv-android/{0}/OpenCV-{0}-android-sdk.zip'.format(version) 31 | OPENCV_ARCHIVE = 'OpenCV-{0}-android-sdk.zip'.format(version) 32 | OPENCV_UNZIP_DIR = 'OpenCV-android-sdk' 33 | OPENCV_OUT_PATH='opencv/sdk' 34 | 35 | OPENCV_ARCHIVE = os.path.join(prefix, OPENCV_ARCHIVE) 36 | OPENCV_UNZIP_DIR = os.path.join(prefix, OPENCV_UNZIP_DIR) 37 | OPENCV_OUT_PATH = os.path.join(out_prefix, OPENCV_OUT_PATH) 38 | OPENCV_UNZIP_SDK_DIR = os.path.join(OPENCV_UNZIP_DIR, 'sdk') 39 | 40 | if not os.path.isdir(OPENCV_UNZIP_DIR): 41 | if not os.path.exists(OPENCV_ARCHIVE): 42 | call(['wget', OPENCV_PREBUILT_URL, '-P', prefix]) 43 | currDir = os.getcwd() 44 | os.chdir(prefix) 45 | unzipFile(OPENCV_ARCHIVE) 46 | os.chdir(currDir) 47 | 48 | if not os.path.exists(OPENCV_OUT_PATH): 49 | os.makedirs(OPENCV_OUT_PATH) 50 | 51 | # Remove it if it exist 52 | shutil.rmtree(OPENCV_OUT_PATH) 53 | copytree(OPENCV_UNZIP_SDK_DIR, OPENCV_OUT_PATH) 54 | 55 | def sync_submodules(): 56 | print '---------------- Start syncing submodules ----------------' 57 | # Fetch submodules 58 | os.chdir(ROOT) 59 | call(['git', 'submodule', 'update', '--init', '--recursive']) 60 | 61 | if os.path.exists('CL-12'): 62 | print 'CL-12 has existed already' 63 | else: 64 | print 'Download OpenCL 1.2 Headers..................' 65 | call(['sh', 'get_opencl.sh']) 66 | 67 | print 'Download Boost 1.55.0..................' 68 | boost_path = os.path.join(ROOT, 'third-party', 'Boost-for-Android') 69 | boost_source_folder = os.path.join(boost_path, 'boost_1_55_0') 70 | os.chdir(boost_path) 71 | if os.path.exists(boost_source_folder): 72 | print 'boost has existed already' 73 | else: 74 | call(['sh', 'download-boost.sh']) 75 | 76 | os.chdir(ROOT) 77 | print 'download prebuilt opencv for android' 78 | prebuilt_path = os.path.join(ROOT, 'third-party') 79 | prebuilt_opencv_out = prebuilt_path 80 | downloadPrebuiltOpencv(prefix=prebuilt_path, out_prefix = prebuilt_opencv_out) 81 | 82 | print '---------------- End syncing submodules ----------------' 83 | 84 | def main(argv): 85 | global ROOT 86 | ROOT = os.path.dirname(os.path.abspath(__file__)) 87 | sync_submodules() 88 | 89 | if __name__ == '__main__': 90 | main(sys.argv[1:]) 91 | -------------------------------------------------------------------------------- /get_opencl.sh: -------------------------------------------------------------------------------- 1 | 2 | DIR=. 3 | VERSION=12 4 | 5 | echo "Downloading headers for version ${VERSION}..." 6 | 7 | mkdir -p "${DIR}/CL-${VERSION}/CL" 8 | cd "${DIR}/CL-${VERSION}/CL" 9 | 10 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/opencl.h 11 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_platform.h 12 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl.h 13 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_ext.h 14 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_egl.h 15 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_dx9_media_sharing.h 16 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_d3d10.h 17 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_d3d11.h 18 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_gl.h 19 | wget https://raw.githubusercontent.com/KhronosGroup/OpenCL-Headers/opencl${VERSION}/cl_gl_ext.h 20 | wget https://www.khronos.org/registry/cl/api/2.1/cl.hpp 21 | 22 | 23 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := test_sort 6 | 7 | LOCAL_SRC_FILES := ../CL-Stub/libopencl.c \ 8 | test_sort.cpp 9 | 10 | LOCAL_C_INCLUDES := \ 11 | CL-12/ \ 12 | CL-Stub/ \ 13 | third-party/miniglog/ \ 14 | third-party/Boost-for-Android/boost_1_55_0 \ 15 | compute/include 16 | 17 | #MINIGLOG_LIB_TYPE:=SHARED 18 | MINIGLOG_LIB_TYPE:=STATIC 19 | ifeq ($(MINIGLOG_LIB_TYPE),SHARED) 20 | LOCAL_SHARED_LIBRARIES := miniglog 21 | else 22 | LOCAL_STATIC_LIBRARIES := miniglog 23 | endif 24 | 25 | LOCAL_CFLAGS += -fPIC -O2 26 | LOCAL_LDLIBS := -lm -llog -ldl -lz 27 | LOCAL_CPPFLAGS += -fexceptions -frtti -std=c++11 28 | 29 | LOCAL_ARM_MODE := arm 30 | ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) 31 | LOCAL_ARM_NEON := true 32 | endif 33 | 34 | LOCAL_CFLAGS += -pie -fPIE 35 | LOCAL_LDFLAGS += -pie -fPIE 36 | include $(BUILD_EXECUTABLE) 37 | 38 | #include $(BUILD_SHARED_LIBRARY) 39 | 40 | include third-party/miniglog/MINIGLOG.mk 41 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | NDK_TOOLCHAIN_VERSION := clang 2 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 3 | APP_CPPFLAGS := -std=c++11 -frtti -fexceptions 4 | APP_PLATFORM := android-8 5 | APP_STL := gnustl_static 6 | -------------------------------------------------------------------------------- /jni/test_sort.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * test_sort.cpp using google-style 3 | * 4 | * Created on: May 27, 2016 5 | * Author: Tzutalin 6 | * 7 | * Copyright (c) 2016 Tzutalin. All rights reserved. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace compute = boost::compute; 17 | 18 | int main() { 19 | std::cout << "get the default compute device" << std::endl; 20 | compute::device gpu = compute::system::default_device(); 21 | 22 | std::cout << "get name:" << gpu.name() << std::endl; 23 | std::cout << "get global memory:" << gpu.global_memory_size() << std::endl; 24 | std::cout << "get local memory:" << gpu.local_memory_size() << std::endl; 25 | std::cout << "get compute_units:" << gpu.compute_units() << std::endl; 26 | std::cout << "get device type:" << gpu.type() << std::endl; 27 | 28 | std::cout << "create a compute context and command queue" << std::endl; 29 | const int num_vector = 30 | 10000; // over 50000, there is Out of Resource for my device 31 | { 32 | compute::context ctx(gpu); 33 | compute::command_queue queue(ctx, gpu); 34 | // Going to measure 35 | std::clock_t begin = std::clock(); 36 | std::cout << "generate random " << num_vector << " numbers on the host" 37 | << std::endl; 38 | std::vector host_vector(num_vector); 39 | std::generate(host_vector.begin(), host_vector.end(), rand); 40 | 41 | std::cout << "create vector on the device" << std::endl; 42 | compute::vector device_vector(num_vector, ctx); 43 | 44 | std::cout << "copy data to the device" << std::endl; 45 | compute::copy(host_vector.begin(), host_vector.end(), device_vector.begin(), 46 | queue); 47 | 48 | std::cout << "sort data on the device" << std::endl; 49 | compute::sort(device_vector.begin(), device_vector.end(), queue); 50 | 51 | std::cout << "copy data back to the host" << std::endl; 52 | compute::copy(device_vector.begin(), device_vector.end(), 53 | host_vector.begin(), queue); 54 | 55 | std::clock_t end = std::clock(); 56 | double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; 57 | std::cout << "cost time:" << elapsed_secs << std::endl; 58 | } 59 | 60 | { 61 | std::cout << "\nCompare with STL sort without Boost.Compute" << std::endl; 62 | std::clock_t begin = std::clock(); 63 | std::cout << "generate random " << num_vector << " numbers for stl to sort" 64 | << std::endl; 65 | std::vector stl_vector(num_vector); 66 | std::generate(stl_vector.begin(), stl_vector.end(), rand); 67 | std::sort(stl_vector.begin(), stl_vector.end()); 68 | std::clock_t end = std::clock(); 69 | double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; 70 | std::cout << "cost time:" << elapsed_secs << std::endl; 71 | } 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.sh eol=lf 3 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *~ 3 | logs 4 | build.log 5 | *.swp 6 | *.vim 7 | *.tar.bz2 8 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/README.md: -------------------------------------------------------------------------------- 1 | ## Get and build boost 1.55 2 | ./build-android.sh $ANDROID_NDK_HOME --boost=1.55.0 --with-libraries=date_time,math,random,thread,system 3 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/build-android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2010 Mystic Tree Games 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Author: Moritz "Moss" Wundke (b.thax.dcg@gmail.com) 17 | # 18 | # 19 | # 20 | # Build boost for android completly. It will download boost 1.45.0 21 | # prepare the build system and finally build it for android 22 | 23 | # Add common build methods 24 | . `dirname $0`/build-common.sh 25 | 26 | # ----------------------- 27 | # Command line arguments 28 | # ----------------------- 29 | 30 | BOOST_VER1=1 31 | BOOST_VER2=53 32 | BOOST_VER3=0 33 | register_option "--boost=" boost_version "Boost version to be used, one of {1.55.0, 1.54.0, 1.53.0, 1.49.0, 1.48.0, 1.45.0}, default is 1.53.0." 34 | boost_version() 35 | { 36 | if [ "$1" = "1.55.0" ]; then 37 | BOOST_VER1=1 38 | BOOST_VER2=55 39 | BOOST_VER3=0 40 | elif [ "$1" = "1.54.0" ]; then 41 | BOOST_VER1=1 42 | BOOST_VER2=54 43 | BOOST_VER3=0 44 | elif [ "$1" = "1.53.0" ]; then 45 | BOOST_VER1=1 46 | BOOST_VER2=53 47 | BOOST_VER3=0 48 | elif [ "$1" = "1.49.0" ]; then 49 | BOOST_VER1=1 50 | BOOST_VER2=49 51 | BOOST_VER3=0 52 | elif [ "$1" = "1.48.0" ]; then 53 | BOOST_VER1=1 54 | BOOST_VER2=48 55 | BOOST_VER3=0 56 | elif [ "$1" = "1.45.0" ]; then 57 | BOOST_VER1=1 58 | BOOST_VER2=45 59 | BOOST_VER3=0 60 | else 61 | echo "Unsupported boost version '$1'." 62 | exit 1 63 | fi 64 | } 65 | 66 | register_option "--toolchain=" select_toolchain "Select a toolchain. To see available execute ls -l ANDROID_NDK/toolchains." 67 | select_toolchain () { 68 | TOOLCHAIN=$1 69 | } 70 | 71 | CLEAN=no 72 | register_option "--clean" do_clean "Delete all previously downloaded and built files, then exit." 73 | do_clean () { CLEAN=yes; } 74 | 75 | DOWNLOAD=no 76 | register_option "--download" do_download "Only download required files and clean up previus build. No build will be performed." 77 | 78 | do_download () 79 | { 80 | DOWNLOAD=yes 81 | # Clean previus stuff too! 82 | CLEAN=yes 83 | } 84 | 85 | #LIBRARIES=--with-libraries=date_time,filesystem,program_options,regex,signals,system,thread,iostreams,locale 86 | LIBRARIES= 87 | register_option "--with-libraries=" do_with_libraries "Comma separated list of libraries to build." 88 | do_with_libraries () { 89 | for lib in $(echo $1 | tr ',' '\n') ; do LIBRARIES="--with-$lib ${LIBRARIES}"; done 90 | } 91 | 92 | register_option "--without-libraries=" do_without_libraries "Comma separated list of libraries to exclude from the build." 93 | do_without_libraries () { LIBRARIES="--without-libraries=$1"; } 94 | do_without_libraries () { 95 | for lib in $(echo $1 | tr ',' '\n') ; do LIBRARIES="--without-$lib ${LIBRARIES}"; done 96 | } 97 | 98 | register_option "--prefix=" do_prefix "Prefix to be used when installing libraries and includes." 99 | do_prefix () { 100 | if [ -d $1 ]; then 101 | PREFIX=$1; 102 | fi 103 | } 104 | 105 | PROGRAM_PARAMETERS="" 106 | PROGRAM_DESCRIPTION=\ 107 | " Boost For Android\n"\ 108 | "Copyright (C) 2010 Mystic Tree Games\n"\ 109 | 110 | extract_parameters $@ 111 | 112 | echo "Building boost version: $BOOST_VER1.$BOOST_VER2.$BOOST_VER3" 113 | 114 | # ----------------------- 115 | # Build constants 116 | # ----------------------- 117 | 118 | BOOST_DOWNLOAD_LINK="http://downloads.sourceforge.net/project/boost/boost/$BOOST_VER1.$BOOST_VER2.$BOOST_VER3/boost_${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3}.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F${BOOST_VER1}.${BOOST_VER2}.${BOOST_VER3}%2F&ts=1291326673&use_mirror=garr" 119 | BOOST_TAR="boost_${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3}.tar.bz2" 120 | BOOST_DIR="boost_${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3}" 121 | BUILD_DIR="./build/" 122 | 123 | # ----------------------- 124 | 125 | if [ $CLEAN = yes ] ; then 126 | echo "Cleaning: $BUILD_DIR" 127 | rm -f -r $PROGDIR/$BUILD_DIR 128 | 129 | echo "Cleaning: $BOOST_DIR" 130 | rm -f -r $PROGDIR/$BOOST_DIR 131 | 132 | echo "Cleaning: $BOOST_TAR" 133 | rm -f $PROGDIR/$BOOST_TAR 134 | 135 | echo "Cleaning: logs" 136 | rm -f -r logs 137 | rm -f build.log 138 | 139 | [ "$DOWNLOAD" = "yes" ] || exit 0 140 | fi 141 | 142 | # It is almost never desirable to have the boost-X_Y_Z directory from 143 | # previous builds as this script doesn't check in which state it's 144 | # been left (bootstrapped, patched, built, ...). Unless maybe during 145 | # a debug, in which case it's easy for a developer to comment out 146 | # this code. 147 | 148 | if [ -d "$PROGDIR/$BOOST_DIR" ]; then 149 | echo "Cleaning: $BOOST_DIR" 150 | rm -f -r $PROGDIR/$BOOST_DIR 151 | fi 152 | 153 | if [ -d "$PROGDIR/$BUILD_DIR" ]; then 154 | echo "Cleaning: $BUILD_DIR" 155 | rm -f -r $PROGDIR/$BUILD_DIR 156 | fi 157 | 158 | 159 | AndroidNDKRoot=$PARAMETERS 160 | if [ -z "$AndroidNDKRoot" ] ; then 161 | if [ -n "${ANDROID_BUILD_TOP}" ]; then # building from Android sources 162 | AndroidNDKRoot="${ANDROID_BUILD_TOP}/prebuilts/ndk/current" 163 | export AndroidSourcesDetected=1 164 | elif [ -z "`which ndk-build`" ]; then 165 | dump "ERROR: You need to provide a !" 166 | exit 1 167 | else 168 | AndroidNDKRoot=`which ndk-build` 169 | AndroidNDKRoot=`dirname $AndroidNDKRoot` 170 | fi 171 | echo "Using AndroidNDKRoot = $AndroidNDKRoot" 172 | else 173 | # User passed the NDK root as a parameter. Make sure the directory 174 | # exists and make it an absolute path. 175 | if [ ! -f "$AndroidNDKRoot/ndk-build" ]; then 176 | dump "ERROR: $AndroidNDKRoot is not a valid NDK root" 177 | exit 1 178 | fi 179 | AndroidNDKRoot=$(cd $AndroidNDKRoot; pwd -P) 180 | fi 181 | export AndroidNDKRoot 182 | 183 | # Check platform patch 184 | case "$HOST_OS" in 185 | linux) 186 | PlatformOS=linux 187 | ;; 188 | darwin|freebsd) 189 | PlatformOS=darwin 190 | ;; 191 | windows|cygwin) 192 | PlatformOS=windows 193 | ;; 194 | *) # let's play safe here 195 | PlatformOS=linux 196 | esac 197 | 198 | NDK_RELEASE_FILE=$AndroidNDKRoot"/RELEASE.TXT" 199 | if [ -f "${NDK_RELEASE_FILE}" ]; then 200 | NDK_RN=`cat $NDK_RELEASE_FILE | sed 's/^r\(.*\)$/\1/g'` 201 | elif [ -n "${AndroidSourcesDetected}" ]; then 202 | if [ -f "${ANDROID_BUILD_TOP}/ndk/docs/CHANGES.html" ]; then 203 | NDK_RELEASE_FILE="${ANDROID_BUILD_TOP}/ndk/docs/CHANGES.html" 204 | NDK_RN=`grep "android-ndk-" "${NDK_RELEASE_FILE}" | head -1 | sed 's/^.*r\(.*\)$/\1/'` 205 | elif [ -f "${ANDROID_BUILD_TOP}/ndk/docs/text/CHANGES.text" ]; then 206 | NDK_RELEASE_FILE="${ANDROID_BUILD_TOP}/ndk/docs/text/CHANGES.text" 207 | NDK_RN=`grep "android-ndk-" "${NDK_RELEASE_FILE}" | head -1 | sed 's/^.*r\(.*\)$/\1/'` 208 | else 209 | dump "ERROR: can not find ndk version" 210 | exit 1 211 | fi 212 | else 213 | dump "ERROR: can not find ndk version" 214 | exit 1 215 | fi 216 | 217 | echo "Detected Android NDK version $NDK_RN" 218 | 219 | case "$NDK_RN" in 220 | 4*) 221 | TOOLCHAIN=${TOOLCHAIN:-arm-eabi-4.4.0} 222 | CXXPATH=$AndroidNDKRoot/build/prebuilt/$PlatformOS-x86/${TOOLCHAIN}/bin/arm-eabi-g++ 223 | TOOLSET=gcc-androidR4 224 | ;; 225 | 5*) 226 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.4.3} 227 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/$PlatformOS-x86/bin/arm-linux-androideabi-g++ 228 | TOOLSET=gcc-androidR5 229 | ;; 230 | 7-crystax-5.beta3) 231 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6.3} 232 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/$PlatformOS-x86/bin/arm-linux-androideabi-g++ 233 | TOOLSET=gcc-androidR7crystax5beta3 234 | ;; 235 | 8) 236 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.4.3} 237 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/$PlatformOS-x86/bin/arm-linux-androideabi-g++ 238 | TOOLSET=gcc-androidR8 239 | ;; 240 | 8b|8c|8d) 241 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6} 242 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/$PlatformOS-x86/bin/arm-linux-androideabi-g++ 243 | TOOLSET=gcc-androidR8b 244 | ;; 245 | 8e|9|9b|9c|9d) 246 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6} 247 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/$PlatformOS-x86/bin/arm-linux-androideabi-g++ 248 | TOOLSET=gcc-androidR8e 249 | ;; 250 | "8e (64-bit)") 251 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6} 252 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++ 253 | TOOLSET=gcc-androidR8e 254 | ;; 255 | "9 (64-bit)"|"9b (64-bit)"|"9c (64-bit)"|"9d (64-bit)") 256 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6} 257 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++ 258 | TOOLSET=gcc-androidR8e 259 | ;; 260 | "10 (64-bit)"|"10b (64-bit)"|"10c (64-bit)"|"10d (64-bit)") 261 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.6} 262 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++ 263 | TOOLSET=gcc-androidR8e 264 | ;; 265 | "10e (64-bit)"|"10e-rc4 (64-bit)") 266 | TOOLCHAIN=${TOOLCHAIN:-arm-linux-androideabi-4.8} 267 | CXXPATH=$AndroidNDKRoot/toolchains/${TOOLCHAIN}/prebuilt/${PlatformOS}-x86_64/bin/arm-linux-androideabi-g++ 268 | TOOLSET=gcc-androidR10e 269 | ;; 270 | *) 271 | echo "Undefined or not supported Android NDK version!" 272 | exit 1 273 | esac 274 | 275 | if [ -n "${AndroidSourcesDetected}" ]; then # Overwrite CXXPATH if we are building from Android sources 276 | CXXPATH="${ANDROID_TOOLCHAIN}/arm-linux-androideabi-g++" 277 | fi 278 | 279 | echo Building with TOOLSET=$TOOLSET CXXPATH=$CXXPATH CXXFLAGS=$CXXFLAGS | tee $PROGDIR/build.log 280 | 281 | # Check if the ndk is valid or not 282 | if [ ! -f $CXXPATH ] 283 | then 284 | echo "Cannot find C++ compiler at: $CXXPATH" 285 | exit 1 286 | fi 287 | 288 | # ----------------------- 289 | # Download required files 290 | # ----------------------- 291 | 292 | # Downalod and unzip boost in a temporal folder and 293 | if [ ! -f $BOOST_TAR ] 294 | then 295 | echo "Downloading boost ${BOOST_VER1}.${BOOST_VER2}.${BOOST_VER3} please wait..." 296 | prepare_download 297 | download_file $BOOST_DOWNLOAD_LINK $PROGDIR/$BOOST_TAR 298 | fi 299 | 300 | if [ ! -f $PROGDIR/$BOOST_TAR ] 301 | then 302 | echo "Failed to download boost! Please download boost ${BOOST_VER1}.${BOOST_VER2}.${BOOST_VER3} manually\nand save it in this directory as $BOOST_TAR" 303 | exit 1 304 | fi 305 | 306 | if [ ! -d $PROGDIR/$BOOST_DIR ] 307 | then 308 | echo "Unpacking boost" 309 | if [ "$OPTION_PROGRESS" = "yes" ] ; then 310 | pv $PROGDIR/$BOOST_TAR | tar xjf - -C $PROGDIR 311 | else 312 | tar xjf $PROGDIR/$BOOST_TAR 313 | fi 314 | fi 315 | 316 | if [ $DOWNLOAD = yes ] ; then 317 | echo "All required files has been downloaded and unpacked!" 318 | exit 0 319 | fi 320 | 321 | # --------- 322 | # Bootstrap 323 | # --------- 324 | if [ ! -f ./$BOOST_DIR/bjam ] 325 | then 326 | # Make the initial bootstrap 327 | echo "Performing boost bootstrap" 328 | 329 | cd $BOOST_DIR 330 | case "$HOST_OS" in 331 | windows) 332 | cmd //c "bootstrap.bat" 2>&1 | tee -a $PROGDIR/build.log 333 | ;; 334 | *) # Linux and others 335 | ./bootstrap.sh 2>&1 | tee -a $PROGDIR/build.log 336 | esac 337 | 338 | 339 | if [ $? != 0 ] ; then 340 | dump "ERROR: Could not perform boostrap! See $TMPLOG for more info." 341 | exit 1 342 | fi 343 | cd $PROGDIR 344 | 345 | # ------------------------------------------------------------- 346 | # Patching will be done only if we had a successfull bootstrap! 347 | # ------------------------------------------------------------- 348 | 349 | # Apply patches to boost 350 | BOOST_VER=${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3} 351 | PATCH_BOOST_DIR=$PROGDIR/patches/boost-${BOOST_VER} 352 | 353 | cp configs/user-config-boost-${BOOST_VER}.jam $BOOST_DIR/tools/build/v2/user-config.jam 354 | 355 | for dir in $PATCH_BOOST_DIR; do 356 | if [ ! -d "$dir" ]; then 357 | echo "Could not find directory '$dir' while looking for patches" 358 | exit 1 359 | fi 360 | 361 | PATCHES=`(cd $dir && ls *.patch | sort) 2> /dev/null` 362 | 363 | if [ -z "$PATCHES" ]; then 364 | echo "No patches found in directory '$dir'" 365 | exit 1 366 | fi 367 | 368 | for PATCH in $PATCHES; do 369 | PATCH=`echo $PATCH | sed -e s%^\./%%g` 370 | SRC_DIR=$PROGDIR/$BOOST_DIR 371 | PATCHDIR=`dirname $PATCH` 372 | PATCHNAME=`basename $PATCH` 373 | log "Applying $PATCHNAME into $SRC_DIR/$PATCHDIR" 374 | cd $SRC_DIR && patch -p1 < $dir/$PATCH && cd $PROGDIR 375 | if [ $? != 0 ] ; then 376 | dump "ERROR: Patch failure !! Please check your patches directory!" 377 | dump " Try to perform a clean build using --clean ." 378 | dump " Problem patch: $dir/$PATCHNAME" 379 | exit 1 380 | fi 381 | done 382 | done 383 | fi 384 | 385 | echo "# ---------------" 386 | echo "# Build using NDK" 387 | echo "# ---------------" 388 | 389 | # Build boost for android 390 | echo "Building boost for android" 391 | ( 392 | 393 | if echo $LIBRARIES | grep locale; then 394 | if [ -e libiconv-libicu-android ]; then 395 | echo "ICONV and ICU already compiled" 396 | else 397 | echo "boost_locale selected - compiling ICONV and ICU" 398 | git clone https://github.com/pelya/libiconv-libicu-android.git 399 | cd libiconv-libicu-android 400 | ./build.sh || exit 1 401 | cd .. 402 | fi 403 | fi 404 | 405 | cd $BOOST_DIR 406 | 407 | echo "Adding pathname: `dirname $CXXPATH`" 408 | # `AndroidBinariesPath` could be used by user-config-boost-*.jam 409 | export AndroidBinariesPath=`dirname $CXXPATH` 410 | export PATH=$AndroidBinariesPath:$PATH 411 | export AndroidNDKRoot 412 | export NO_BZIP2=1 413 | 414 | cxxflags="" 415 | for flag in $CXXFLAGS; do cxxflags="$cxxflags cxxflags=$flag"; done 416 | 417 | { ./bjam -q \ 418 | target-os=linux \ 419 | toolset=$TOOLSET \ 420 | $cxxflags \ 421 | link=static \ 422 | threading=multi \ 423 | --layout=versioned \ 424 | -sICONV_PATH=`pwd`/../libiconv-libicu-android/armeabi \ 425 | -sICU_PATH=`pwd`/../libiconv-libicu-android/armeabi \ 426 | --prefix="./../$BUILD_DIR/" \ 427 | $LIBRARIES \ 428 | install 2>&1 \ 429 | || { dump "ERROR: Failed to build boost for android!" ; exit 1 ; } 430 | } | tee -a $PROGDIR/build.log 431 | 432 | # PIPESTATUS variable is defined only in Bash, and we are using /bin/sh, which is not Bash on newer Debian/Ubuntu 433 | ) 434 | 435 | dump "Done!" 436 | 437 | if [ $PREFIX ]; then 438 | echo "Prefix set, copying files to $PREFIX" 439 | cp -r $PROGDIR/$BUILD_DIR/lib $PREFIX 440 | cp -r $PROGDIR/$BUILD_DIR/include $PREFIX 441 | fi 442 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/build-common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2010 Mystic Tree Games 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Author: Moritz "Moss" Wundke (b.thax.dcg@gmail.com) 17 | # 18 | # 19 | # 20 | # Adapted common build methods from NDK-Common.sh and prebuilt-common.sh 21 | # from the Android NDK 22 | # 23 | 24 | # Current script name into PROGNAME 25 | PROGNAME=`basename $0` 26 | PROGDIR=`pwd` 27 | 28 | ## Logging support 29 | ## 30 | VERBOSE=${VERBOSE-yes} 31 | VERBOSE2=${VERBOSE2-no} 32 | 33 | TMPLOG= 34 | 35 | # Setup a log file where all log() and log2() output will be sent 36 | # 37 | # $1: log file path (optional) 38 | # 39 | setup_log_file () 40 | { 41 | if [ -n "$1" ] ; then 42 | TMPLOG="$1" 43 | else 44 | mkdir -p $PROGDIR/logs/ 45 | TMPLOG=$PROGDIR/logs/myst-log-$$.log 46 | fi 47 | rm -f $TMPLOG && touch $TMPLOG 48 | echo "To follow build in another terminal, please use: tail -F $TMPLOG" 49 | } 50 | 51 | dump () 52 | { 53 | if [ -n "$TMPLOG" ] ; then 54 | echo "$@" >> $TMPLOG 55 | fi 56 | echo "$@" 57 | } 58 | 59 | log () 60 | { 61 | if [ "$VERBOSE" = "yes" ] ; then 62 | echo "$@" 63 | else 64 | if [ "$TMPLOG" ] ; then 65 | echo "$@" >> $TMPLOG 66 | fi 67 | fi 68 | } 69 | 70 | log2 () 71 | { 72 | if [ "$VERBOSE2" = "yes" ] ; then 73 | echo "$@" 74 | else 75 | if [ -n "$TMPLOG" ] ; then 76 | echo "$@" >> $TMPLOG 77 | fi 78 | fi 79 | } 80 | 81 | run () 82 | { 83 | if [ "$VERBOSE" = "yes" ] ; then 84 | echo "##### NEW COMMAND" 85 | echo "$@" 86 | $@ 2>&1 87 | else 88 | if [ -n "$TMPLOG" ] ; then 89 | echo "##### NEW COMMAND" >> $TMPLOG 90 | echo "$@" >> $TMPLOG 91 | $@ 2>&1 | tee -a $TMPLOG 92 | else 93 | $@ > /dev/null 2>&1 94 | fi 95 | fi 96 | } 97 | 98 | ## Utilities 99 | ## 100 | 101 | # Generate a random temp directory 102 | random_temp_directory () 103 | { 104 | mktemp -d /tmp/myst-dir-XXXXXX 105 | } 106 | 107 | # return the value of a given named variable 108 | # $1: variable name 109 | # 110 | # example: 111 | # FOO=BAR 112 | # BAR=ZOO 113 | # echo `var_value $FOO` 114 | # will print 'ZOO' 115 | # 116 | var_value () 117 | { 118 | # find a better way to do that ? 119 | eval echo "$`echo $1`" 120 | } 121 | 122 | # convert to uppercase 123 | # assumes tr is installed on the platform ? 124 | # 125 | to_uppercase () 126 | { 127 | echo $1 | tr "[:lower:]" "[:upper:]" 128 | } 129 | 130 | ## Normalize OS and CPU 131 | ## 132 | HOST_ARCH=`uname -m` 133 | case "$HOST_ARCH" in 134 | i?86) HOST_ARCH=x86 135 | ;; 136 | amd64) HOST_ARCH=x86_64 137 | ;; 138 | powerpc) HOST_ARCH=ppc 139 | ;; 140 | esac 141 | 142 | log2 "HOST_ARCH=$HOST_ARCH" 143 | 144 | # at this point, the supported values for CPU are: 145 | # x86 146 | # x86_64 147 | # ppc 148 | # 149 | # other values may be possible but haven't been tested 150 | # 151 | HOST_EXE="" 152 | HOST_OS=`uname -s` 153 | case "$HOST_OS" in 154 | Darwin) 155 | HOST_OS=darwin 156 | ;; 157 | Linux) 158 | # note that building 32-bit binaries on x86_64 is handled later 159 | HOST_OS=linux 160 | ;; 161 | FreeBsd) # note: this is not tested 162 | HOST_OS=freebsd 163 | ;; 164 | CYGWIN*|*_NT-*) 165 | HOST_OS=windows 166 | HOST_EXE=.exe 167 | if [ "x$OSTYPE" = xcygwin ] ; then 168 | HOST_OS=cygwin 169 | fi 170 | ;; 171 | esac 172 | 173 | log2 "HOST_OS=$HOST_OS" 174 | log2 "HOST_EXE=$HOST_EXE" 175 | 176 | # at this point, the value of HOST_OS should be one of the following: 177 | # linux 178 | # darwin 179 | # windows (MSys) 180 | # cygwin 181 | # 182 | # Note that cygwin is treated as a special case because it behaves very differently 183 | # for a few things. Other values may be possible but have not been tested 184 | # 185 | 186 | # define HOST_TAG as a unique tag used to identify both the host OS and CPU 187 | # supported values are: 188 | # 189 | # linux-x86 190 | # linux-x86_64 191 | # darwin-x86 192 | # darwin-ppc 193 | # windows 194 | # 195 | # other values are possible but were not tested. 196 | # 197 | compute_host_tag () 198 | { 199 | case "$HOST_OS" in 200 | windows|cygwin) 201 | HOST_TAG="windows" 202 | ;; 203 | *) HOST_TAG="${HOST_OS}-${HOST_ARCH}" 204 | esac 205 | log2 "HOST_TAG=$HOST_TAG" 206 | } 207 | 208 | compute_host_tag 209 | 210 | # Compute the number of host CPU cores an HOST_NUM_CPUS 211 | # 212 | case "$HOST_OS" in 213 | linux) 214 | HOST_NUM_CPUS=`cat /proc/cpuinfo | grep processor | wc -l` 215 | ;; 216 | darwin|freebsd) 217 | HOST_NUM_CPUS=`sysctl -n hw.ncpu` 218 | ;; 219 | windows|cygwin) 220 | HOST_NUM_CPUS=$NUMBER_OF_PROCESSORS 221 | ;; 222 | *) # let's play safe here 223 | HOST_NUM_CPUS=1 224 | esac 225 | 226 | log2 "HOST_NUM_CPUS=$HOST_NUM_CPUS" 227 | 228 | # If BUILD_NUM_CPUS is not already defined in your environment, 229 | # define it as the double of HOST_NUM_CPUS. This is used to 230 | # run Make commends in parralles, as in 'make -j$BUILD_NUM_CPUS' 231 | # 232 | if [ -z "$BUILD_NUM_CPUS" ] ; then 233 | BUILD_NUM_CPUS=`expr $HOST_NUM_CPUS \* 2` 234 | fi 235 | 236 | log2 "BUILD_NUM_CPUS=$BUILD_NUM_CPUS" 237 | 238 | # Various probes are going to need to run a small C program 239 | TMPC=/tmp/myst-$$-test.c 240 | TMPO=/tmp/myst-$$-test.o 241 | TMPE=/tmp/myst-$$-test$EXE 242 | TMPL=/tmp/myst-$$-test.log 243 | 244 | # cleanup temporary files 245 | clean_temp () 246 | { 247 | rm -f $TMPC $TMPO $TMPL $TMPE 248 | } 249 | 250 | # cleanup temp files then exit with an error 251 | clean_exit () 252 | { 253 | clean_temp 254 | exit 1 255 | } 256 | 257 | pattern_match () 258 | { 259 | echo "$2" | grep -q -E -e "$1" 260 | } 261 | 262 | # Let's check that we have a working md5sum here 263 | check_md5sum () 264 | { 265 | A_MD5=`echo "A" | md5sum | cut -d' ' -f1` 266 | if [ "$A_MD5" != "bf072e9119077b4e76437a93986787ef" ] ; then 267 | echo "Please install md5sum on this machine" 268 | exit 2 269 | fi 270 | } 271 | 272 | # Find if a given shell program is available. 273 | # We need to take care of the fact that the 'which ' command 274 | # may return either an empty string (Linux) or something like 275 | # "no in ..." (Darwin). Also, we need to redirect stderr 276 | # to /dev/null for Cygwin 277 | # 278 | # $1: variable name 279 | # $2: program name 280 | # 281 | # Result: set $1 to the full path of the corresponding command 282 | # or to the empty/undefined string if not available 283 | # 284 | find_program () 285 | { 286 | local PROG 287 | PROG=`which $2 2>/dev/null` 288 | if [ -n "$PROG" ] ; then 289 | if pattern_match '^no ' "$PROG"; then 290 | PROG= 291 | fi 292 | fi 293 | eval $1="$PROG" 294 | } 295 | 296 | prepare_download () 297 | { 298 | find_program CMD_WGET wget 299 | find_program CMD_CURL curl 300 | find_program CMD_SCRP scp 301 | } 302 | 303 | # Download a file with either 'curl', 'wget' or 'scp' 304 | # 305 | # $1: source URL (e.g. http://foo.com, ssh://blah, /some/path) 306 | # $2: target file 307 | download_file () 308 | { 309 | # Is this HTTP, HTTPS or FTP ? 310 | if pattern_match "^(http|https|ftp):.*" "$1"; then 311 | if [ -n "$CMD_WGET" ] ; then 312 | run $CMD_WGET -O $2 $1 313 | elif [ -n "$CMD_CURL" ] ; then 314 | run $CMD_CURL -o -L $2 $1 315 | else 316 | echo "Please install wget or curl on this machine" 317 | exit 1 318 | fi 319 | return 320 | fi 321 | 322 | # Is this SSH ? 323 | # Accept both ssh:// or : 324 | # 325 | if pattern_match "^(ssh|[^:]+):.*" "$1"; then 326 | if [ -n "$CMD_SCP" ] ; then 327 | scp_src=`echo $1 | sed -e s%ssh://%%g` 328 | run $CMD_SCP $scp_src $2 329 | else 330 | echo "Please install scp on this machine" 331 | exit 1 332 | fi 333 | return 334 | fi 335 | 336 | # Is this a file copy ? 337 | # Accept both file:// or / 338 | # 339 | if pattern_match "^(file://|/).*" "$1"; then 340 | cp_src=`echo $1 | sed -e s%^file://%%g` 341 | run cp -f $cp_src $2 342 | return 343 | fi 344 | } 345 | 346 | # Return the maximum length of a series of strings 347 | # 348 | # Usage: len=`max_length ...` 349 | # 350 | max_length () 351 | { 352 | echo "$@" | tr ' ' '\n' | awk 'BEGIN {max=0} {len=length($1); if (len > max) max=len} END {print max}' 353 | } 354 | 355 | # Translate dashes to underscores 356 | # Usage: str=`dashes_to_underscores ` 357 | dashes_to_underscores () 358 | { 359 | echo $@ | tr '-' '_' 360 | } 361 | 362 | # Translate underscores to dashes 363 | # Usage: str=`underscores_to_dashes ` 364 | underscores_to_dashes () 365 | { 366 | echo $@ | tr '_' '-' 367 | } 368 | 369 | #----------------------------------------------------------------------- 370 | # OPTION PROCESSING 371 | #----------------------------------------------------------------------- 372 | 373 | # We recognize the following option formats: 374 | # 375 | # -f 376 | # --flag 377 | # 378 | # -s 379 | # --setting= 380 | # 381 | 382 | # NOTE: We translate '-' into '_' when storing the options in global 383 | # variables 384 | # 385 | 386 | OPTIONS="" 387 | OPTION_FLAGS="" 388 | OPTION_SETTINGS="" 389 | 390 | # Set a given option attribute 391 | # $1: option name 392 | # $2: option attribute 393 | # $3: attribute value 394 | # 395 | option_set_attr () 396 | { 397 | eval OPTIONS_$1_$2=\"$3\" 398 | } 399 | 400 | # Get a given option attribute 401 | # $1: option name 402 | # $2: option attribute 403 | # 404 | option_get_attr () 405 | { 406 | echo `var_value OPTIONS_$1_$2` 407 | } 408 | 409 | # Determine optional variable value 410 | # $1: final variable name 411 | # $2: option variable name 412 | # $3: small description for the option 413 | fix_option () 414 | { 415 | if [ -n "$2" ] ; then 416 | eval $1="$2" 417 | log "Using specific $3: $2" 418 | else 419 | log "Using default $3: `var_value $1`" 420 | fi 421 | } 422 | 423 | # Register a new option 424 | # $1: option 425 | # $2: name of function that will be called when the option is parsed 426 | # $3: small abstract for the option 427 | # $4: optional. default value 428 | # 429 | register_option () 430 | { 431 | local optname optvalue opttype optlabel 432 | optlabel= 433 | optname= 434 | optvalue= 435 | opttype= 436 | while [ -n "1" ] ; do 437 | # Check for something like --setting= 438 | echo "$1" | grep -q -E -e '^--[^=]+=<.+>$' 439 | if [ $? = 0 ] ; then 440 | optlabel=`expr -- "$1" : '\(--[^=]*\)=.*'` 441 | optvalue=`expr -- "$1" : '--[^=]*=\(<.*>\)'` 442 | opttype="long_setting" 443 | break 444 | fi 445 | 446 | # Check for something like --flag 447 | echo "$1" | grep -q -E -e '^--[^=]+$' 448 | if [ $? = 0 ] ; then 449 | optlabel="$1" 450 | opttype="long_flag" 451 | break 452 | fi 453 | 454 | # Check for something like -f 455 | echo "$1" | grep -q -E -e '^-[A-Za-z0-9]<.+>$' 456 | if [ $? = 0 ] ; then 457 | optlabel=`expr -- "$1" : '\(-.\).*'` 458 | optvalue=`expr -- "$1" : '-.\(<.+>\)'` 459 | opttype="short_setting" 460 | break 461 | fi 462 | 463 | # Check for something like -f 464 | echo "$1" | grep -q -E -e '^-.$' 465 | if [ $? = 0 ] ; then 466 | optlabel="$1" 467 | opttype="short_flag" 468 | break 469 | fi 470 | 471 | echo "ERROR: Invalid option format: $1" 472 | echo " Check register_option call" 473 | exit 1 474 | done 475 | 476 | log "new option: type='$opttype' name='$optlabel' value='$optvalue'" 477 | 478 | optname=`dashes_to_underscores $optlabel` 479 | OPTIONS="$OPTIONS $optname" 480 | OPTIONS_TEXT="$OPTIONS_TEXT $1" 481 | option_set_attr $optname label "$optlabel" 482 | option_set_attr $optname otype "$opttype" 483 | option_set_attr $optname value "$optvalue" 484 | option_set_attr $optname text "$1" 485 | option_set_attr $optname funcname "$2" 486 | option_set_attr $optname abstract "$3" 487 | option_set_attr $optname default "$4" 488 | } 489 | 490 | # Print the help, including a list of registered options for this program 491 | # Note: Assumes PROGRAM_PARAMETERS and PROGRAM_DESCRIPTION exist and 492 | # correspond to the parameters list and the program description 493 | # 494 | print_help () 495 | { 496 | local opt text abstract default 497 | 498 | echo "Usage: $PROGNAME [options] $PROGRAM_PARAMETERS" 499 | echo "" 500 | if [ -n "$PROGRAM_DESCRIPTION" ] ; then 501 | echo "$PROGRAM_DESCRIPTION" 502 | echo "" 503 | fi 504 | echo "Valid options (defaults are in brackets):" 505 | echo "" 506 | 507 | maxw=`max_length "$OPTIONS_TEXT"` 508 | AWK_SCRIPT=`echo "{ printf \"%-${maxw}s\", \\$1 }"` 509 | for opt in $OPTIONS; do 510 | text=`option_get_attr $opt text | awk "$AWK_SCRIPT"` 511 | abstract=`option_get_attr $opt abstract` 512 | default=`option_get_attr $opt default` 513 | if [ -n "$default" ] ; then 514 | echo " $text $abstract [$default]" 515 | else 516 | echo " $text $abstract" 517 | fi 518 | done 519 | echo "" 520 | } 521 | 522 | option_panic_no_args () 523 | { 524 | echo "ERROR: Option '$1' does not take arguments. See --help for usage." 525 | exit 1 526 | } 527 | 528 | option_panic_missing_arg () 529 | { 530 | echo "ERROR: Option '$1' requires an argument. See --help for usage." 531 | exit 1 532 | } 533 | 534 | extract_parameters () 535 | { 536 | local opt optname otype value name fin funcname 537 | PARAMETERS="" 538 | while [ -n "$1" ] ; do 539 | # If the parameter does not begin with a dash 540 | # it is not an option. 541 | param=`expr -- "$1" : '^\([^\-].*\)$'` 542 | if [ -n "$param" ] ; then 543 | if [ -z "$PARAMETERS" ] ; then 544 | PARAMETERS="$1" 545 | else 546 | PARAMETERS="$PARAMETERS $1" 547 | fi 548 | shift 549 | continue 550 | fi 551 | 552 | while [ -n "1" ] ; do 553 | # Try to match a long setting, i.e. --option=value 554 | opt=`expr -- "$1" : '^\(--[^=]*\)=.*$'` 555 | if [ -n "$opt" ] ; then 556 | otype="long_setting" 557 | value=`expr -- "$1" : '^--[^=]*=\(.*\)$'` 558 | break 559 | fi 560 | 561 | # Try to match a long flag, i.e. --option 562 | opt=`expr -- "$1" : '^\(--.*\)$'` 563 | if [ -n "$opt" ] ; then 564 | otype="long_flag" 565 | value= 566 | break 567 | fi 568 | 569 | # Try to match a short setting, i.e. -o 570 | opt=`expr -- "$1" : '^\(-[A-Za-z0-9]\)..*$'` 571 | if [ -n "$opt" ] ; then 572 | otype="short_setting" 573 | value=`expr -- "$1" : '^-.\(.*\)$'` 574 | break 575 | fi 576 | 577 | # Try to match a short flag, i.e. -o 578 | opt=`expr -- "$1" : '^\(-.\)$'` 579 | if [ -n "$opt" ] ; then 580 | otype="short_flag" 581 | value= 582 | break 583 | fi 584 | 585 | echo "ERROR: Unknown option '$1'. Use --help for list of valid values." 586 | exit 1 587 | done 588 | 589 | #echo "Found opt='$opt' otype='$otype' value='$value'" 590 | 591 | name=`dashes_to_underscores $opt` 592 | found=0 593 | for xopt in $OPTIONS; do 594 | if [ "$name" != "$xopt" ] ; then 595 | continue 596 | fi 597 | # Check that the type is correct here 598 | # 599 | # This also allows us to handle -o as -o 600 | # 601 | xotype=`option_get_attr $name otype` 602 | if [ "$otype" != "$xotype" ] ; then 603 | case "$xotype" in 604 | "short_flag") 605 | option_panic_no_args $opt 606 | ;; 607 | "short_setting") 608 | if [ -z "$2" ] ; then 609 | option_panic_missing_arg $opt 610 | fi 611 | value="$2" 612 | shift 613 | ;; 614 | "long_flag") 615 | option_panic_no_args $opt 616 | ;; 617 | "long_setting") 618 | option_panic_missing_arg $opt 619 | ;; 620 | esac 621 | fi 622 | found=1 623 | break 624 | break 625 | done 626 | if [ "$found" = "0" ] ; then 627 | echo "ERROR: Unknown option '$opt'. See --help for usage." 628 | exit 1 629 | fi 630 | # Launch option-specific function, value, if any as argument 631 | eval `option_get_attr $name funcname` \"$value\" 632 | shift 633 | done 634 | 635 | # Change log out put if requested 636 | if [ "x$OPTION_OUTPUT" != "x" ] ; then 637 | setup_log_file $OPTION_OUTPUT 638 | else 639 | setup_log_file 640 | fi 641 | } 642 | 643 | do_option_help () 644 | { 645 | print_help 646 | exit 0 647 | } 648 | 649 | VERBOSE=no 650 | VERBOSE2=no 651 | do_option_verbose () 652 | { 653 | if [ $VERBOSE = "yes" ] ; then 654 | VERBOSE2=yes 655 | else 656 | VERBOSE=yes 657 | fi 658 | } 659 | 660 | OPTION_OUTPUT= 661 | do_logpath () { OPTION_OUTPUT=$1; } 662 | 663 | do_progress_bar() 664 | { 665 | OPTION_PROGRESS="yes" 666 | } 667 | 668 | register_option "--help" do_option_help "Print this help." 669 | register_option "--verbose" do_option_verbose "Enable verbose mode." 670 | register_option "--output=" do_logpath "Specify specific log output path (only terminal output by default)" 671 | register_option "--progress" do_progress_bar "Enable extraction progress bar" 672 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/configs/user-config-boost-1_45_0.jam: -------------------------------------------------------------------------------- 1 | # Copyright 2003, 2005 Douglas Gregor 2 | # Copyright 2004 John Maddock 3 | # Copyright 2002, 2003, 2004, 2007 Vladimir Prus 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # This file is used to configure your Boost.Build installation. You can modify 8 | # this file in place, or you can place it in a permanent location so that it 9 | # does not get overwritten should you get a new version of Boost.Build. See: 10 | # 11 | # http://boost.org/boost-build2/doc/html/bbv2/reference.html#bbv2.reference.init 12 | # 13 | # for documentation about possible permanent locations. 14 | 15 | # This file specifies which toolsets (C++ compilers), libraries, and other 16 | # tools are available. Often, you should be able to just uncomment existing 17 | # example lines and adjust them to taste. The complete list of supported tools, 18 | # and configuration instructions can be found at: 19 | # 20 | # http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html 21 | # 22 | 23 | # This file uses Jam language syntax to describe available tools. Mostly, 24 | # there are 'using' lines, that contain the name of the used tools, and 25 | # parameters to pass to those tools -- where paremeters are separated by 26 | # semicolons. Important syntax notes: 27 | # 28 | # - Both ':' and ';' must be separated from other tokens by whitespace 29 | # - The '\' symbol is a quote character, so when specifying Windows paths you 30 | # should use '/' or '\\' instead. 31 | # 32 | # More details about the syntax can be found at: 33 | # 34 | # http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language 35 | # 36 | 37 | 38 | # ------------------ 39 | # GCC configuration. 40 | # ------------------ 41 | 42 | # Configure gcc (default version). 43 | # using gcc ; 44 | 45 | # Configure specific gcc version, giving alternative name to use. 46 | # using gcc : 3.2 : g++-3.2 ; 47 | 48 | 49 | # ------------------- 50 | # MSVC configuration. 51 | # ------------------- 52 | 53 | # Configure msvc (default version, searched for in standard locations and PATH). 54 | # using msvc ; 55 | 56 | # Configure specific msvc version (searched for in standard locations and PATH). 57 | # using msvc : 8.0 ; 58 | 59 | 60 | # ---------------------- 61 | # Borland configuration. 62 | # ---------------------- 63 | # using borland ; 64 | 65 | 66 | # ---------------------- 67 | # STLPort configuration. 68 | # ---------------------- 69 | 70 | # Configure specifying location of STLPort headers. Libraries must be either 71 | # not needed or available to the compiler by default. 72 | # using stlport : : /usr/include/stlport ; 73 | 74 | # Configure specifying location of both headers and libraries explicitly. 75 | # using stlport : : /usr/include/stlport /usr/lib ; 76 | 77 | 78 | # ----------------- 79 | # QT configuration. 80 | # ----------------- 81 | 82 | # Configure assuming QTDIR gives the installation prefix. 83 | # using qt ; 84 | 85 | # Configure with an explicit installation prefix. 86 | # using qt : /usr/opt/qt ; 87 | 88 | # ---------------------- 89 | # Android configurations. 90 | # ---------------------- 91 | 92 | # -------------------------------------------------------------------- 93 | 94 | import os ; 95 | local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; 96 | 97 | # -------------------------------------------------------------------- 98 | using gcc : androidR4 99 | : 100 | arm-eabi-c++ 101 | : 102 | arm-eabi-ar 103 | -I$(AndroidNDKRoot)/build/platforms/android-8/arch-arm/usr/include 104 | -fpic 105 | -mthumb-interwork 106 | -ffunction-sections 107 | -funwind-tables 108 | -fstack-protector 109 | -fno-short-enums 110 | -D__ARM_ARCH_5__ 111 | -D__ARM_ARCH_5T__ 112 | -D__ARM_ARCH_5E__ 113 | -D__ARM_ARCH_5TE__ 114 | -Wno-psabi 115 | -march=armv5te 116 | -mtune=xscale 117 | -msoft-float 118 | -mthumb 119 | -Os 120 | -fomit-frame-pointer 121 | -fno-strict-aliasing 122 | -finline-limit=64 123 | -DANDROID 124 | -D__ANDROID__ 125 | -Wa,--noexecstack 126 | # @Moss - Above are the 'oficial' android flags 127 | arm 128 | -fvisibility=hidden 129 | -fvisibility-inlines-hidden 130 | -fdata-sections 131 | -D__arm__ 132 | -D_REENTRANT 133 | -D_GLIBCXX__PTHREADS 134 | ; 135 | 136 | # -------------------------------------------------------------------- 137 | using gcc : androidR5 138 | : 139 | arm-linux-androideabi-g++ 140 | : 141 | arm-linux-androideabi-ar 142 | -fexceptions 143 | -frtti 144 | -fpic 145 | -ffunction-sections 146 | -funwind-tables 147 | -D__ARM_ARCH_5__ 148 | -D__ARM_ARCH_5T__ 149 | -D__ARM_ARCH_5E__ 150 | -D__ARM_ARCH_5TE__ 151 | -Wno-psabi 152 | -march=armv5te 153 | -mtune=xscale 154 | -msoft-float 155 | -mthumb 156 | -Os 157 | -fomit-frame-pointer 158 | -fno-strict-aliasing 159 | -finline-limit=64 160 | -I$(AndroidNDKRoot)/platforms/android-8/arch-arm/usr/include 161 | -Wa,--noexecstack 162 | -DANDROID 163 | -D__ANDROID__ 164 | -DNDEBUG 165 | -O2 166 | -g 167 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include 168 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include 169 | -I$(AndroidNDKRoot)/sources/wchar-support/include 170 | # @Moss - Above are the 'oficial' android flags 171 | arm 172 | -fvisibility=hidden 173 | -fvisibility-inlines-hidden 174 | -fdata-sections 175 | -D__arm__ 176 | -D_REENTRANT 177 | -D_GLIBCXX__PTHREADS 178 | ; 179 | 180 | # -------------------------------------------------------------------- 181 | using gcc : androidR7crystax5beta3 182 | : 183 | arm-linux-androideabi-g++ 184 | : 185 | arm-linux-androideabi-ar 186 | -fexceptions 187 | -frtti 188 | -fpic 189 | -ffunction-sections 190 | -funwind-tables 191 | -D__ARM_ARCH_5__ 192 | -D__ARM_ARCH_5T__ 193 | -D__ARM_ARCH_5E__ 194 | -D__ARM_ARCH_5TE__ 195 | -Wno-psabi 196 | -march=armv5te 197 | -mtune=xscale 198 | -msoft-float 199 | -mthumb 200 | -Os 201 | -fomit-frame-pointer 202 | -fno-strict-aliasing 203 | -finline-limit=64 204 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 205 | -Wa,--noexecstack 206 | -DANDROID 207 | -D__ANDROID__ 208 | -DNDEBUG 209 | -O2 210 | -g 211 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include/4.6.3 212 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/4.6.3/include 213 | -I$(AndroidNDKRoot)/sources/crystax/include 214 | # @Moss - Above are the 'oficial' android flags 215 | arm 216 | -fvisibility=hidden 217 | -fvisibility-inlines-hidden 218 | -fdata-sections 219 | -DBOOST_THREAD_LINUX 220 | -DBOOST_HAS_PTHREADS 221 | -D__arm__ 222 | -D_REENTRANT 223 | -D_GLIBCXX__PTHREADS 224 | -DBOOST_HAS_GETTIMEOFDAY 225 | ; 226 | 227 | # -------------------------------------------------------------------- 228 | using gcc : androidR8 229 | : 230 | arm-linux-androideabi-g++ 231 | : 232 | arm-linux-androideabi-ar 233 | -fexceptions 234 | -frtti 235 | -fpic 236 | -ffunction-sections 237 | -funwind-tables 238 | -D__ARM_ARCH_5__ 239 | -D__ARM_ARCH_5T__ 240 | -D__ARM_ARCH_5E__ 241 | -D__ARM_ARCH_5TE__ 242 | -Wno-psabi 243 | -march=armv5te 244 | -mtune=xscale 245 | -msoft-float 246 | -mthumb 247 | -Os 248 | -fomit-frame-pointer 249 | -fno-strict-aliasing 250 | -finline-limit=64 251 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 252 | -Wa,--noexecstack 253 | -DANDROID 254 | -D__ANDROID__ 255 | -DNDEBUG 256 | -O2 257 | -g 258 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include 259 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include 260 | # @Moss - Above are the 'oficial' android flags 261 | arm 262 | -fvisibility=hidden 263 | -fvisibility-inlines-hidden 264 | -fdata-sections 265 | -D__arm__ 266 | -D_REENTRANT 267 | -D_GLIBCXX__PTHREADS 268 | ; 269 | 270 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/configs/user-config-boost-1_48_0.jam: -------------------------------------------------------------------------------- 1 | # Copyright 2003, 2005 Douglas Gregor 2 | # Copyright 2004 John Maddock 3 | # Copyright 2002, 2003, 2004, 2007 Vladimir Prus 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # This file is used to configure your Boost.Build installation. You can modify 8 | # this file in place, or you can place it in a permanent location so that it 9 | # does not get overwritten should you get a new version of Boost.Build. See: 10 | # 11 | # http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html 12 | # 13 | # for documentation about possible permanent locations. 14 | 15 | # This file specifies which toolsets (C++ compilers), libraries, and other 16 | # tools are available. Often, you should be able to just uncomment existing 17 | # example lines and adjust them to taste. The complete list of supported tools, 18 | # and configuration instructions can be found at: 19 | # 20 | # http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html 21 | # 22 | 23 | # This file uses Jam language syntax to describe available tools. Mostly, 24 | # there are 'using' lines, that contain the name of the used tools, and 25 | # parameters to pass to those tools -- where paremeters are separated by 26 | # semicolons. Important syntax notes: 27 | # 28 | # - Both ':' and ';' must be separated from other tokens by whitespace 29 | # - The '\' symbol is a quote character, so when specifying Windows paths you 30 | # should use '/' or '\\' instead. 31 | # 32 | # More details about the syntax can be found at: 33 | # 34 | # http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language 35 | # 36 | 37 | # ------------------ 38 | # GCC configuration. 39 | # ------------------ 40 | 41 | # Configure gcc (default version). 42 | # using gcc ; 43 | 44 | # Configure specific gcc version, giving alternative name to use. 45 | # using gcc : 3.2 : g++-3.2 ; 46 | 47 | 48 | # ------------------- 49 | # MSVC configuration. 50 | # ------------------- 51 | 52 | # Configure msvc (default version, searched for in standard locations and PATH). 53 | # using msvc ; 54 | 55 | # Configure specific msvc version (searched for in standard locations and PATH). 56 | # using msvc : 8.0 ; 57 | 58 | 59 | # ---------------------- 60 | # Borland configuration. 61 | # ---------------------- 62 | # using borland ; 63 | 64 | 65 | # ---------------------- 66 | # STLPort configuration. 67 | # ---------------------- 68 | 69 | # Configure specifying location of STLPort headers. Libraries must be either 70 | # not needed or available to the compiler by default. 71 | # using stlport : : /usr/include/stlport ; 72 | 73 | # Configure specifying location of both headers and libraries explicitly. 74 | # using stlport : : /usr/include/stlport /usr/lib ; 75 | 76 | 77 | # ---------------------- 78 | # Android configuration. 79 | # ---------------------- 80 | 81 | # -------------------------------------------------------------------- 82 | 83 | import os ; 84 | local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; 85 | 86 | # -------------------------------------------------------------------- 87 | using gcc : androidR7crystax5beta3 88 | : 89 | arm-linux-androideabi-g++ 90 | : 91 | arm-linux-androideabi-ar 92 | -fexceptions 93 | -frtti 94 | -fpic 95 | -ffunction-sections 96 | -funwind-tables 97 | -D__ARM_ARCH_5__ 98 | -D__ARM_ARCH_5T__ 99 | -D__ARM_ARCH_5E__ 100 | -D__ARM_ARCH_5TE__ 101 | -Wno-psabi 102 | -march=armv5te 103 | -mtune=xscale 104 | -msoft-float 105 | -mthumb 106 | -Os 107 | -fomit-frame-pointer 108 | -fno-strict-aliasing 109 | -finline-limit=64 110 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 111 | -Wa,--noexecstack 112 | -DANDROID 113 | -D__ANDROID__ 114 | -DNDEBUG 115 | -O2 116 | -g 117 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include/4.6.3 118 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/4.6.3/include 119 | -I$(AndroidNDKRoot)/sources/crystax/include 120 | # @Moss - Above are the 'oficial' android flags 121 | arm 122 | -fvisibility=hidden 123 | -fvisibility-inlines-hidden 124 | -fdata-sections 125 | -D__arm__ 126 | -D_REENTRANT 127 | -D_GLIBCXX__PTHREADS 128 | ; 129 | 130 | # -------------------------------------------------------------------- 131 | using gcc : androidR8 132 | : 133 | arm-linux-androideabi-g++ 134 | : 135 | arm-linux-androideabi-ar 136 | -fexceptions 137 | -frtti 138 | -fpic 139 | -ffunction-sections 140 | -funwind-tables 141 | -D__ARM_ARCH_5__ 142 | -D__ARM_ARCH_5T__ 143 | -D__ARM_ARCH_5E__ 144 | -D__ARM_ARCH_5TE__ 145 | -Wno-psabi 146 | -march=armv5te 147 | -mtune=xscale 148 | -msoft-float 149 | -mthumb 150 | -Os 151 | -fomit-frame-pointer 152 | -fno-strict-aliasing 153 | -finline-limit=64 154 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 155 | -Wa,--noexecstack 156 | -DANDROID 157 | -D__ANDROID__ 158 | -DNDEBUG 159 | -O2 160 | -g 161 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include 162 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include 163 | # @Moss - Above are the 'oficial' android flags 164 | arm 165 | -fvisibility=hidden 166 | -fvisibility-inlines-hidden 167 | -fdata-sections 168 | -D__arm__ 169 | -D_REENTRANT 170 | -D_GLIBCXX__PTHREADS 171 | ; 172 | 173 | # -------------------------------------------------------------------- 174 | using gcc : androidR8b 175 | : 176 | arm-linux-androideabi-g++ 177 | : 178 | arm-linux-androideabi-ar 179 | -fexceptions 180 | -frtti 181 | -fpic 182 | -ffunction-sections 183 | -funwind-tables 184 | -D__ARM_ARCH_5__ 185 | -D__ARM_ARCH_5T__ 186 | -D__ARM_ARCH_5E__ 187 | -D__ARM_ARCH_5TE__ 188 | -Wno-psabi 189 | -march=armv5te 190 | -mtune=xscale 191 | -msoft-float 192 | -mthumb 193 | -Os 194 | -fomit-frame-pointer 195 | -fno-strict-aliasing 196 | -finline-limit=64 197 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 198 | -Wa,--noexecstack 199 | -DANDROID 200 | -D__ANDROID__ 201 | -DNDEBUG 202 | -O2 203 | -g 204 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 205 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 206 | # @Moss - Above are the 'oficial' android flags 207 | arm 208 | -fvisibility=hidden 209 | -fvisibility-inlines-hidden 210 | -fdata-sections 211 | -D__arm__ 212 | -D_REENTRANT 213 | -D_GLIBCXX__PTHREADS 214 | ; 215 | 216 | # ----------------- 217 | # QT configuration. 218 | # ----------------- 219 | 220 | # Configure assuming QTDIR gives the installation prefix. 221 | # using qt ; 222 | 223 | # Configure with an explicit installation prefix. 224 | # using qt : /usr/opt/qt ; 225 | 226 | # --------------------- 227 | # Python configuration. 228 | # --------------------- 229 | 230 | # Configure specific Python version. 231 | # using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ; 232 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/configs/user-config-boost-1_49_0.jam: -------------------------------------------------------------------------------- 1 | # Copyright 2003, 2005 Douglas Gregor 2 | # Copyright 2004 John Maddock 3 | # Copyright 2002, 2003, 2004, 2007 Vladimir Prus 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # This file is used to configure your Boost.Build installation. You can modify 8 | # this file in place, or you can place it in a permanent location so that it 9 | # does not get overwritten should you get a new version of Boost.Build. See: 10 | # 11 | # http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html 12 | # 13 | # for documentation about possible permanent locations. 14 | 15 | # This file specifies which toolsets (C++ compilers), libraries, and other 16 | # tools are available. Often, you should be able to just uncomment existing 17 | # example lines and adjust them to taste. The complete list of supported tools, 18 | # and configuration instructions can be found at: 19 | # 20 | # http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html 21 | # 22 | 23 | # This file uses Jam language syntax to describe available tools. Mostly, 24 | # there are 'using' lines, that contain the name of the used tools, and 25 | # parameters to pass to those tools -- where paremeters are separated by 26 | # semicolons. Important syntax notes: 27 | # 28 | # - Both ':' and ';' must be separated from other tokens by whitespace 29 | # - The '\' symbol is a quote character, so when specifying Windows paths you 30 | # should use '/' or '\\' instead. 31 | # 32 | # More details about the syntax can be found at: 33 | # 34 | # http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language 35 | # 36 | 37 | # ------------------ 38 | # Android configurations. 39 | # ------------------ 40 | import os ; 41 | local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; 42 | 43 | # -------------------------------------------------------------------- 44 | using gcc : androidR7crystax5beta3 45 | : 46 | arm-linux-androideabi-g++ 47 | : 48 | arm-linux-androideabi-ar 49 | -fexceptions 50 | -frtti 51 | -fpic 52 | -ffunction-sections 53 | -funwind-tables 54 | -D__ARM_ARCH_5__ 55 | -D__ARM_ARCH_5T__ 56 | -D__ARM_ARCH_5E__ 57 | -D__ARM_ARCH_5TE__ 58 | -Wno-psabi 59 | -march=armv5te 60 | -mtune=xscale 61 | -msoft-float 62 | -mthumb 63 | -Os 64 | -fomit-frame-pointer 65 | -fno-strict-aliasing 66 | -finline-limit=64 67 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 68 | -Wa,--noexecstack 69 | -DANDROID 70 | -D__ANDROID__ 71 | -DNDEBUG 72 | -O2 73 | -g 74 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include/4.6.3 75 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/4.6.3/include 76 | -I$(AndroidNDKRoot)/sources/crystax/include 77 | # @Moss - Above are the 'oficial' android flags 78 | arm 79 | -fvisibility=hidden 80 | -fvisibility-inlines-hidden 81 | -fdata-sections 82 | -D__arm__ 83 | -D_REENTRANT 84 | -D_GLIBCXX__PTHREADS 85 | ; 86 | 87 | # -------------------------------------------------------------------- 88 | using gcc : androidR8 89 | : 90 | arm-linux-androideabi-g++ 91 | : 92 | arm-linux-androideabi-ar 93 | -fexceptions 94 | -frtti 95 | -fpic 96 | -ffunction-sections 97 | -funwind-tables 98 | -D__ARM_ARCH_5__ 99 | -D__ARM_ARCH_5T__ 100 | -D__ARM_ARCH_5E__ 101 | -D__ARM_ARCH_5TE__ 102 | -Wno-psabi 103 | -march=armv5te 104 | -mtune=xscale 105 | -msoft-float 106 | -mthumb 107 | -Os 108 | -fomit-frame-pointer 109 | -fno-strict-aliasing 110 | -finline-limit=64 111 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 112 | -Wa,--noexecstack 113 | -DANDROID 114 | -D__ANDROID__ 115 | -DNDEBUG 116 | -O2 117 | -g 118 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include 119 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include 120 | # @Moss - Above are the 'oficial' android flags 121 | arm 122 | -fvisibility=hidden 123 | -fvisibility-inlines-hidden 124 | -fdata-sections 125 | -D__arm__ 126 | -D_REENTRANT 127 | -D_GLIBCXX__PTHREADS 128 | ; 129 | 130 | # -------------------------------------------------------------------- 131 | # Is same for 8b, 8c and 8d 132 | using gcc : androidR8b 133 | : 134 | arm-linux-androideabi-g++ 135 | : 136 | arm-linux-androideabi-ar 137 | -fexceptions 138 | -frtti 139 | -fpic 140 | -ffunction-sections 141 | -funwind-tables 142 | -D__ARM_ARCH_5__ 143 | -D__ARM_ARCH_5T__ 144 | -D__ARM_ARCH_5E__ 145 | -D__ARM_ARCH_5TE__ 146 | -Wno-psabi 147 | -march=armv5te 148 | -mtune=xscale 149 | -msoft-float 150 | -mthumb 151 | -Os 152 | -fomit-frame-pointer 153 | -fno-strict-aliasing 154 | -finline-limit=64 155 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 156 | -Wa,--noexecstack 157 | -DANDROID 158 | -D__ANDROID__ 159 | -DNDEBUG 160 | -O2 161 | -g 162 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 163 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 164 | # @Moss - Above are the 'oficial' android flags 165 | arm 166 | -fvisibility=hidden 167 | -fvisibility-inlines-hidden 168 | -fdata-sections 169 | -D__arm__ 170 | -D_REENTRANT 171 | -D_GLIBCXX__PTHREADS 172 | ; 173 | 174 | # -------------------------------------------------------------------- 175 | using gcc : androidR8e 176 | : 177 | arm-linux-androideabi-g++ 178 | : 179 | arm-linux-androideabi-ar 180 | -fexceptions 181 | -frtti 182 | -fpic 183 | -ffunction-sections 184 | -funwind-tables 185 | -D__ARM_ARCH_5__ 186 | -D__ARM_ARCH_5T__ 187 | -D__ARM_ARCH_5E__ 188 | -D__ARM_ARCH_5TE__ 189 | -Wno-psabi 190 | -march=armv5te 191 | -mtune=xscale 192 | -msoft-float 193 | -mthumb 194 | -Os 195 | -fomit-frame-pointer 196 | -fno-strict-aliasing 197 | -finline-limit=64 198 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 199 | -Wa,--noexecstack 200 | -DANDROID 201 | -D__ANDROID__ 202 | -DNDEBUG 203 | -O2 204 | -g 205 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 206 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 207 | # @Moss - Above are the 'oficial' android flags 208 | arm 209 | -fvisibility=hidden 210 | -fvisibility-inlines-hidden 211 | -fdata-sections 212 | -D__arm__ 213 | -D_REENTRANT 214 | -D_GLIBCXX__PTHREADS 215 | ; 216 | 217 | # -------------------------------------------------------------------- 218 | # ------------------ 219 | # GCC configuration. 220 | # ------------------ 221 | 222 | # Configure gcc (default version). 223 | # using gcc ; 224 | 225 | # Configure specific gcc version, giving alternative name to use. 226 | # using gcc : 3.2 : g++-3.2 ; 227 | 228 | 229 | # ------------------- 230 | # MSVC configuration. 231 | # ------------------- 232 | 233 | # Configure msvc (default version, searched for in standard locations and PATH). 234 | # using msvc ; 235 | 236 | # Configure specific msvc version (searched for in standard locations and PATH). 237 | # using msvc : 8.0 ; 238 | 239 | 240 | # ---------------------- 241 | # Borland configuration. 242 | # ---------------------- 243 | # using borland ; 244 | 245 | 246 | # ---------------------- 247 | # STLPort configuration. 248 | # ---------------------- 249 | 250 | # Configure specifying location of STLPort headers. Libraries must be either 251 | # not needed or available to the compiler by default. 252 | # using stlport : : /usr/include/stlport ; 253 | 254 | # Configure specifying location of both headers and libraries explicitly. 255 | # using stlport : : /usr/include/stlport /usr/lib ; 256 | 257 | 258 | # ----------------- 259 | # QT configuration. 260 | # ----------------- 261 | 262 | # Configure assuming QTDIR gives the installation prefix. 263 | # using qt ; 264 | 265 | # Configure with an explicit installation prefix. 266 | # using qt : /usr/opt/qt ; 267 | 268 | # --------------------- 269 | # Python configuration. 270 | # --------------------- 271 | 272 | # Configure specific Python version. 273 | # using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ; 274 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/configs/user-config-boost-1_53_0.jam: -------------------------------------------------------------------------------- 1 | # Copyright 2003, 2005 Douglas Gregor 2 | # Copyright 2004 John Maddock 3 | # Copyright 2002, 2003, 2004, 2007 Vladimir Prus 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # This file is used to configure your Boost.Build installation. You can modify 8 | # this file in place, or you can place it in a permanent location so that it 9 | # does not get overwritten should you get a new version of Boost.Build. See: 10 | # 11 | # http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html 12 | # 13 | # for documentation about possible permanent locations. 14 | 15 | # This file specifies which toolsets (C++ compilers), libraries, and other 16 | # tools are available. Often, you should be able to just uncomment existing 17 | # example lines and adjust them to taste. The complete list of supported tools, 18 | # and configuration instructions can be found at: 19 | # 20 | # http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html 21 | # 22 | 23 | # This file uses Jam language syntax to describe available tools. Mostly, 24 | # there are 'using' lines, that contain the name of the used tools, and 25 | # parameters to pass to those tools -- where paremeters are separated by 26 | # semicolons. Important syntax notes: 27 | # 28 | # - Both ':' and ';' must be separated from other tokens by whitespace 29 | # - The '\' symbol is a quote character, so when specifying Windows paths you 30 | # should use '/' or '\\' instead. 31 | # 32 | # More details about the syntax can be found at: 33 | # 34 | # http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language 35 | # 36 | # ------------------ 37 | # Android configurations. 38 | # ------------------ 39 | 40 | import os ; 41 | local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; 42 | local AndroidBinariesPath = [ os.environ AndroidBinariesPath ] ; 43 | 44 | # -------------------------------------------------------------------- 45 | # Is same for 8b, 8c and 8d 46 | using gcc : androidR8b 47 | : 48 | $(AndroidBinariesPath)/arm-linux-androideabi-g++ 49 | : 50 | $(AndroidBinariesPath)/arm-linux-androideabi-ar 51 | -fexceptions 52 | -frtti 53 | -fpic 54 | -ffunction-sections 55 | -funwind-tables 56 | -D__ARM_ARCH_5__ 57 | -D__ARM_ARCH_5T__ 58 | -D__ARM_ARCH_5E__ 59 | -D__ARM_ARCH_5TE__ 60 | -Wno-psabi 61 | -march=armv5te 62 | -mtune=xscale 63 | -msoft-float 64 | -mthumb 65 | -Os 66 | -fomit-frame-pointer 67 | -fno-strict-aliasing 68 | -finline-limit=64 69 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 70 | -Wa,--noexecstack 71 | -DANDROID 72 | -D__ANDROID__ 73 | -DNDEBUG 74 | -O2 75 | -g 76 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 77 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 78 | # @Moss - Above are the 'oficial' android flags 79 | arm 80 | -fvisibility=hidden 81 | -fvisibility-inlines-hidden 82 | -fdata-sections 83 | -D__arm__ 84 | -D_REENTRANT 85 | -D_GLIBCXX__PTHREADS 86 | ; 87 | 88 | # -------------------------------------------------------------------- 89 | using gcc : androidR8e 90 | : 91 | $(AndroidBinariesPath)/arm-linux-androideabi-g++ 92 | : 93 | $(AndroidBinariesPath)/arm-linux-androideabi-ar 94 | -fexceptions 95 | -frtti 96 | -fpic 97 | -ffunction-sections 98 | -funwind-tables 99 | -D__ARM_ARCH_5__ 100 | -D__ARM_ARCH_5T__ 101 | -D__ARM_ARCH_5E__ 102 | -D__ARM_ARCH_5TE__ 103 | -Wno-psabi 104 | -march=armv5te 105 | -mtune=xscale 106 | -msoft-float 107 | -mthumb 108 | -Os 109 | -fomit-frame-pointer 110 | -fno-strict-aliasing 111 | -finline-limit=64 112 | -I$(AndroidNDKRoot)/sources/android/support/include 113 | -DTHOUSEP=MON_THOUSANDS_SEP 114 | -DRADIXCHAR=MON_DECIMAL_POINT 115 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 116 | -Wa,--noexecstack 117 | -DANDROID 118 | -D__ANDROID__ 119 | -DNDEBUG 120 | -O2 121 | -g 122 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 123 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 124 | # @Moss - Above are the 'oficial' android flags 125 | arm 126 | -fvisibility=hidden 127 | -fvisibility-inlines-hidden 128 | -fdata-sections 129 | -D__arm__ 130 | -D_REENTRANT 131 | -D_GLIBCXX__PTHREADS 132 | ; 133 | 134 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/configs/user-config-boost-1_54_0.jam: -------------------------------------------------------------------------------- 1 | # Copyright 2003, 2005 Douglas Gregor 2 | # Copyright 2004 John Maddock 3 | # Copyright 2002, 2003, 2004, 2007 Vladimir Prus 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # This file is used to configure your Boost.Build installation. You can modify 8 | # this file in place, or you can place it in a permanent location so that it 9 | # does not get overwritten should you get a new version of Boost.Build. See: 10 | # 11 | # http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html 12 | # 13 | # for documentation about possible permanent locations. 14 | 15 | # This file specifies which toolsets (C++ compilers), libraries, and other 16 | # tools are available. Often, you should be able to just uncomment existing 17 | # example lines and adjust them to taste. The complete list of supported tools, 18 | # and configuration instructions can be found at: 19 | # 20 | # http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html 21 | # 22 | 23 | # This file uses Jam language syntax to describe available tools. Mostly, 24 | # there are 'using' lines, that contain the name of the used tools, and 25 | # parameters to pass to those tools -- where paremeters are separated by 26 | # semicolons. Important syntax notes: 27 | # 28 | # - Both ':' and ';' must be separated from other tokens by whitespace 29 | # - The '\' symbol is a quote character, so when specifying Windows paths you 30 | # should use '/' or '\\' instead. 31 | # 32 | # More details about the syntax can be found at: 33 | # 34 | # http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language 35 | # 36 | # ------------------ 37 | # Android configurations. 38 | # ------------------ 39 | 40 | import os ; 41 | local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; 42 | 43 | # -------------------------------------------------------------------- 44 | # Is same for 8b, 8c and 8d 45 | using gcc : androidR8b 46 | : 47 | arm-linux-androideabi-g++ 48 | : 49 | arm-linux-androideabi-ar 50 | -fexceptions 51 | -frtti 52 | -fpic 53 | -ffunction-sections 54 | -funwind-tables 55 | -D__ARM_ARCH_5__ 56 | -D__ARM_ARCH_5T__ 57 | -D__ARM_ARCH_5E__ 58 | -D__ARM_ARCH_5TE__ 59 | -Wno-psabi 60 | -march=armv5te 61 | -mtune=xscale 62 | -msoft-float 63 | -mthumb 64 | -Os 65 | -fomit-frame-pointer 66 | -fno-strict-aliasing 67 | -finline-limit=64 68 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 69 | -Wa,--noexecstack 70 | -DANDROID 71 | -D__ANDROID__ 72 | -DNDEBUG 73 | -O2 74 | -g 75 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 76 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 77 | # @Moss - Above are the 'oficial' android flags 78 | arm 79 | -fvisibility=hidden 80 | -fvisibility-inlines-hidden 81 | -fdata-sections 82 | -D__arm__ 83 | -D_REENTRANT 84 | -D_GLIBCXX__PTHREADS 85 | ; 86 | 87 | # -------------------------------------------------------------------- 88 | using gcc : androidR8e 89 | : 90 | arm-linux-androideabi-g++ 91 | : 92 | arm-linux-androideabi-ar 93 | -fexceptions 94 | -frtti 95 | -fpic 96 | -ffunction-sections 97 | -funwind-tables 98 | -D__ARM_ARCH_5__ 99 | -D__ARM_ARCH_5T__ 100 | -D__ARM_ARCH_5E__ 101 | -D__ARM_ARCH_5TE__ 102 | -Wno-psabi 103 | -march=armv5te 104 | -mtune=xscale 105 | -msoft-float 106 | -mthumb 107 | -Os 108 | -fomit-frame-pointer 109 | -fno-strict-aliasing 110 | -finline-limit=64 111 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 112 | -Wa,--noexecstack 113 | -DANDROID 114 | -D__ANDROID__ 115 | -DNDEBUG 116 | -O2 117 | -g 118 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 119 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 120 | # @Moss - Above are the 'oficial' android flags 121 | arm 122 | -fvisibility=hidden 123 | -fvisibility-inlines-hidden 124 | -fdata-sections 125 | -D__arm__ 126 | -D_REENTRANT 127 | -D_GLIBCXX__PTHREADS 128 | ; 129 | 130 | 131 | # ------------------ 132 | # GCC configuration. 133 | # ------------------ 134 | 135 | # Configure gcc (default version). 136 | # using gcc ; 137 | 138 | # Configure specific gcc version, giving alternative name to use. 139 | # using gcc : 3.2 : g++-3.2 ; 140 | 141 | 142 | # ------------------- 143 | # MSVC configuration. 144 | # ------------------- 145 | 146 | # Configure msvc (default version, searched for in standard locations and PATH). 147 | # using msvc ; 148 | 149 | # Configure specific msvc version (searched for in standard locations and PATH). 150 | # using msvc : 8.0 ; 151 | 152 | 153 | # ---------------------- 154 | # Borland configuration. 155 | # ---------------------- 156 | # using borland ; 157 | 158 | 159 | # ---------------------- 160 | # STLPort configuration. 161 | # ---------------------- 162 | 163 | # Configure specifying location of STLPort headers. Libraries must be either 164 | # not needed or available to the compiler by default. 165 | # using stlport : : /usr/include/stlport ; 166 | 167 | # Configure specifying location of both headers and libraries explicitly. 168 | # using stlport : : /usr/include/stlport /usr/lib ; 169 | 170 | 171 | # ----------------- 172 | # QT configuration. 173 | # ----------------- 174 | 175 | # Configure assuming QTDIR gives the installation prefix. 176 | # using qt ; 177 | 178 | # Configure with an explicit installation prefix. 179 | # using qt : /usr/opt/qt ; 180 | 181 | # --------------------- 182 | # Python configuration. 183 | # --------------------- 184 | 185 | # Configure specific Python version. 186 | # using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ; 187 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/configs/user-config-boost-1_55_0.jam: -------------------------------------------------------------------------------- 1 | # Copyright 2003, 2005 Douglas Gregor 2 | # Copyright 2004 John Maddock 3 | # Copyright 2002, 2003, 2004, 2007 Vladimir Prus 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 | 7 | # This file is used to configure your Boost.Build installation. You can modify 8 | # this file in place, or you can place it in a permanent location so that it 9 | # does not get overwritten should you get a new version of Boost.Build. See: 10 | # 11 | # http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html 12 | # 13 | # for documentation about possible permanent locations. 14 | 15 | # This file specifies which toolsets (C++ compilers), libraries, and other 16 | # tools are available. Often, you should be able to just uncomment existing 17 | # example lines and adjust them to taste. The complete list of supported tools, 18 | # and configuration instructions can be found at: 19 | # 20 | # http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html 21 | # 22 | 23 | # This file uses Jam language syntax to describe available tools. Mostly, 24 | # there are 'using' lines, that contain the name of the used tools, and 25 | # parameters to pass to those tools -- where paremeters are separated by 26 | # semicolons. Important syntax notes: 27 | # 28 | # - Both ':' and ';' must be separated from other tokens by whitespace 29 | # - The '\' symbol is a quote character, so when specifying Windows paths you 30 | # should use '/' or '\\' instead. 31 | # 32 | # More details about the syntax can be found at: 33 | # 34 | # http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language 35 | # 36 | # ------------------ 37 | # Android configurations. 38 | # ------------------ 39 | 40 | import os ; 41 | local AndroidNDKRoot = [ os.environ AndroidNDKRoot ] ; 42 | 43 | # -------------------------------------------------------------------- 44 | # Is same for 8b, 8c and 8d 45 | using gcc : androidR8b 46 | : 47 | arm-linux-androideabi-g++ 48 | : 49 | arm-linux-androideabi-ar 50 | -fexceptions 51 | -frtti 52 | -fpic 53 | -ffunction-sections 54 | -funwind-tables 55 | -D__ARM_ARCH_5__ 56 | -D__ARM_ARCH_5T__ 57 | -D__ARM_ARCH_5E__ 58 | -D__ARM_ARCH_5TE__ 59 | -Wno-psabi 60 | -march=armv5te 61 | -mtune=xscale 62 | -msoft-float 63 | -mthumb 64 | -Os 65 | -fomit-frame-pointer 66 | -fno-strict-aliasing 67 | -finline-limit=64 68 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 69 | -Wa,--noexecstack 70 | -DANDROID 71 | -D__ANDROID__ 72 | -DNDEBUG 73 | -O2 74 | -g 75 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 76 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 77 | # @Moss - Above are the 'oficial' android flags 78 | arm 79 | -fvisibility=hidden 80 | -fvisibility-inlines-hidden 81 | -fdata-sections 82 | -D__arm__ 83 | -D_REENTRANT 84 | -D_GLIBCXX__PTHREADS 85 | ; 86 | 87 | # -------------------------------------------------------------------- 88 | using gcc : androidR8e 89 | : 90 | arm-linux-androideabi-g++ 91 | : 92 | arm-linux-androideabi-ar 93 | -fexceptions 94 | -frtti 95 | -fpic 96 | -ffunction-sections 97 | -funwind-tables 98 | -D__ARM_ARCH_5__ 99 | -D__ARM_ARCH_5T__ 100 | -D__ARM_ARCH_5E__ 101 | -D__ARM_ARCH_5TE__ 102 | -Wno-psabi 103 | -march=armv5te 104 | -mtune=xscale 105 | -msoft-float 106 | -mthumb 107 | -Os 108 | -fomit-frame-pointer 109 | -fno-strict-aliasing 110 | -finline-limit=64 111 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 112 | -Wa,--noexecstack 113 | -DANDROID 114 | -D__ANDROID__ 115 | -DNDEBUG 116 | -O2 117 | -g 118 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/include 119 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include 120 | # @Moss - Above are the 'oficial' android flags 121 | arm 122 | -fvisibility=hidden 123 | -fvisibility-inlines-hidden 124 | -fdata-sections 125 | -D__arm__ 126 | -D_REENTRANT 127 | -D_GLIBCXX__PTHREADS 128 | ; 129 | 130 | # -------------------------------------------------------------------- 131 | using gcc : androidR10e 132 | : 133 | arm-linux-androideabi-g++ 134 | : 135 | arm-linux-androideabi-ar 136 | -fexceptions 137 | -frtti 138 | -fpic 139 | -ffunction-sections 140 | -funwind-tables 141 | -D__ARM_ARCH_5__ 142 | -D__ARM_ARCH_5T__ 143 | -D__ARM_ARCH_5E__ 144 | -D__ARM_ARCH_5TE__ 145 | -Wno-psabi 146 | -march=armv5te 147 | -mtune=xscale 148 | -msoft-float 149 | -mthumb 150 | -Os 151 | -fomit-frame-pointer 152 | -fno-strict-aliasing 153 | -finline-limit=64 154 | -I$(AndroidNDKRoot)/platforms/android-9/arch-arm/usr/include 155 | -Wa,--noexecstack 156 | -DANDROID 157 | -D__ANDROID__ 158 | -DNDEBUG 159 | -O2 160 | -g 161 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.8/include 162 | -I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include 163 | # @Moss - Above are the 'oficial' android flags 164 | arm 165 | -fvisibility=hidden 166 | -fvisibility-inlines-hidden 167 | -fdata-sections 168 | -D__arm__ 169 | -D_REENTRANT 170 | -D_GLIBCXX__PTHREADS 171 | ; 172 | 173 | 174 | # ------------------ 175 | # GCC configuration. 176 | # ------------------ 177 | 178 | # Configure gcc (default version). 179 | # using gcc ; 180 | 181 | # Configure specific gcc version, giving alternative name to use. 182 | # using gcc : 3.2 : g++-3.2 ; 183 | 184 | 185 | # ------------------- 186 | # MSVC configuration. 187 | # ------------------- 188 | 189 | # Configure msvc (default version, searched for in standard locations and PATH). 190 | # using msvc ; 191 | 192 | # Configure specific msvc version (searched for in standard locations and PATH). 193 | # using msvc : 8.0 ; 194 | 195 | 196 | # ---------------------- 197 | # Borland configuration. 198 | # ---------------------- 199 | # using borland ; 200 | 201 | 202 | # ---------------------- 203 | # STLPort configuration. 204 | # ---------------------- 205 | 206 | # Configure specifying location of STLPort headers. Libraries must be either 207 | # not needed or available to the compiler by default. 208 | # using stlport : : /usr/include/stlport ; 209 | 210 | # Configure specifying location of both headers and libraries explicitly. 211 | # using stlport : : /usr/include/stlport /usr/lib ; 212 | 213 | 214 | # ----------------- 215 | # QT configuration. 216 | # ----------------- 217 | 218 | # Configure assuming QTDIR gives the installation prefix. 219 | # using qt ; 220 | 221 | # Configure with an explicit installation prefix. 222 | # using qt : /usr/opt/qt ; 223 | 224 | # --------------------- 225 | # Python configuration. 226 | # --------------------- 227 | 228 | # Configure specific Python version. 229 | # using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ; 230 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/download-boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BOOST_VER1=1 4 | BOOST_VER2=55 5 | BOOST_VER3=0 6 | 7 | PROGNAME=`basename $0` 8 | PROGDIR=`pwd` 9 | 10 | BOOST_DOWNLOAD_LINK="http://downloads.sourceforge.net/project/boost/boost/$BOOST_VER1.$BOOST_VER2.$BOOST_VER3/boost_${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3}.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F${BOOST_VER1}.${BOOST_VER2}.${BOOST_VER3}%2F&ts=1291326673&use_mirror=garr" 11 | BOOST_TAR="boost_${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3}.tar.bz2" 12 | BOOST_DIR="boost_${BOOST_VER1}_${BOOST_VER2}_${BOOST_VER3}" 13 | BUILD_DIR="./build/" 14 | 15 | VERBOSE="yes" 16 | 17 | prepare_download () 18 | { 19 | find_program CMD_WGET wget 20 | find_program CMD_CURL curl 21 | find_program CMD_SCRP scp 22 | } 23 | 24 | pattern_match () 25 | { 26 | echo "$2" | grep -q -E -e "$1" 27 | } 28 | 29 | # Let's check that we have a working md5sum here 30 | check_md5sum () 31 | { 32 | A_MD5=`echo "A" | md5sum | cut -d' ' -f1` 33 | if [ "$A_MD5" != "bf072e9119077b4e76437a93986787ef" ] ; then 34 | echo "Please install md5sum on this machine" 35 | exit 2 36 | fi 37 | } 38 | 39 | find_program () 40 | { 41 | local PROG 42 | PROG=`which $2 2>/dev/null` 43 | if [ -n "$PROG" ] ; then 44 | if pattern_match '^no ' "$PROG"; then 45 | PROG= 46 | fi 47 | fi 48 | eval $1="$PROG" 49 | } 50 | 51 | run () 52 | { 53 | if [ "$VERBOSE" = "yes" ] ; then 54 | echo "##### NEW COMMAND" 55 | echo "$@" 56 | $@ 2>&1 57 | else 58 | if [ -n "$TMPLOG" ] ; then 59 | echo "##### NEW COMMAND" >> $TMPLOG 60 | echo "$@" >> $TMPLOG 61 | $@ 2>&1 | tee -a $TMPLOG 62 | else 63 | $@ > /dev/null 2>&1 64 | fi 65 | fi 66 | } 67 | 68 | download_file () 69 | { 70 | # Is this HTTP, HTTPS or FTP ? 71 | if pattern_match "^(http|https|ftp):.*" "$1"; then 72 | if [ -n "$CMD_WGET" ] ; then 73 | run $CMD_WGET -O $2 $1 74 | elif [ -n "$CMD_CURL" ] ; then 75 | run $CMD_CURL -o -L $2 $1 76 | else 77 | echo "Please install wget or curl on this machine" 78 | exit 1 79 | fi 80 | return 81 | fi 82 | 83 | # Is this SSH ? 84 | # Accept both ssh:// or : 85 | # 86 | if pattern_match "^(ssh|[^:]+):.*" "$1"; then 87 | if [ -n "$CMD_SCP" ] ; then 88 | scp_src=`echo $1 | sed -e s%ssh://%%g` 89 | run $CMD_SCP $scp_src $2 90 | else 91 | echo "Please install scp on this machine" 92 | exit 1 93 | fi 94 | return 95 | fi 96 | 97 | # Is this a file copy ? 98 | # Accept both file:// or / 99 | # 100 | if pattern_match "^(file://|/).*" "$1"; then 101 | cp_src=`echo $1 | sed -e s%^file://%%g` 102 | run cp -f $cp_src $2 103 | return 104 | fi 105 | } 106 | 107 | prepare_download 108 | echo "Download boost version: $BOOST_VER1.$BOOST_VER2.$BOOST_VER3" 109 | download_file $BOOST_DOWNLOAD_LINK $PROGDIR/$BOOST_TAR 110 | echo "extracing: $BOOST_TAR" 111 | tar -xvf $BOOST_TAR 112 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/address_v6.ipp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/boost/asio/ip/impl/address_v6.ipp 2010-06-09 12:40:46.000000000 +0300 2 | +++ boost_1_45_0/boost/asio/ip/impl/address_v6.ipp 2011-06-06 15:29:57.777421112 +0300 3 | @@ -11,6 +11,23 @@ 4 | #ifndef BOOST_ASIO_IP_IMPL_ADDRESS_V6_IPP 5 | #define BOOST_ASIO_IP_IMPL_ADDRESS_V6_IPP 6 | 7 | +// @Moss - Define IPv6 macros 8 | +#if !defined(IN6_IS_ADDR_MULTICAST) 9 | +#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) 10 | +#endif 11 | + 12 | +#if !defined(IN6_IS_ADDR_MC_NODELOCAL) 13 | +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ 14 | + (IN6_IS_ADDR_MULTICAST(a) \ 15 | + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1)) 16 | +#endif 17 | + 18 | +#if !defined(IN6_IS_ADDR_MC_GLOBAL) 19 | +#define IN6_IS_ADDR_MC_GLOBAL(a) \ 20 | + (IN6_IS_ADDR_MULTICAST(a) \ 21 | + && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe)) 22 | +#endif 23 | + 24 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 25 | # pragma once 26 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 27 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/android.jam.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/tools/build/v2/tools/android.jam 1970-01-01 03:00:00.000000000 +0300 2 | +++ boost_1_45_0/tools/build/v2/tools/android.jam 2011-06-06 15:29:57.787421112 +0300 3 | @@ -0,0 +1,1064 @@ 4 | +# Copyright 2001 David Abrahams. 5 | +# Copyright 2002-2006 Rene Rivera. 6 | +# Copyright 2002-2003 Vladimir Prus. 7 | +# Copyright (c) 2005 Reece H. Dunn. 8 | +# Copyright 2006 Ilya Sokolov. 9 | +# Copyright 2007 Roland Schwarz 10 | +# Copyright 2007 Boris Gubenko. 11 | +# Copyright 2010 Moritz Wundke. 12 | +# 13 | +# Distributed under the Boost Software License, Version 1.0. 14 | +# (See accompanying file LICENSE_1_0.txt or copy at 15 | +# http://www.boost.org/LICENSE_1_0.txt) 16 | + 17 | +import "class" : new ; 18 | +import common ; 19 | +import errors ; 20 | +import feature ; 21 | +import generators ; 22 | +import os ; 23 | +import pch ; 24 | +import property ; 25 | +import property-set ; 26 | +import toolset ; 27 | +import type ; 28 | +import rc ; 29 | +import regex ; 30 | +import set ; 31 | +import unix ; 32 | +import fortran ; 33 | + 34 | + 35 | +if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] 36 | +{ 37 | + .debug-configuration = true ; 38 | +} 39 | + 40 | + 41 | +feature.extend toolset : android ; 42 | +# feature.subfeature toolset android : flavor : : optional ; 43 | + 44 | +toolset.inherit-generators android : unix : unix.link unix.link.dll ; 45 | +toolset.inherit-flags android : unix ; 46 | +toolset.inherit-rules android : unix ; 47 | + 48 | +generators.override android.prebuilt : builtin.prebuilt ; 49 | +generators.override android.searched-lib-generator : searched-lib-generator ; 50 | + 51 | +# Make android toolset object files use the "o" suffix on all platforms. 52 | +type.set-generated-target-suffix OBJ : android : o ; 53 | +type.set-generated-target-suffix OBJ : android windows : o ; 54 | +type.set-generated-target-suffix OBJ : android cygwin : o ; 55 | + 56 | +# Initializes the android toolset for the given version. If necessary, command may 57 | +# be used to specify where the compiler is located. The parameter 'options' is a 58 | +# space-delimited list of options, each one specified as 59 | +# option-value. Valid option names are: cxxflags, linkflags and 60 | +# linker-type. Accepted linker-type values are aix, darwin, gnu, hpux, osf or 61 | +# sun and the default value will be selected based on the current OS. 62 | +# Example: 63 | +# using android : 3.4 : : foo bar sun ; 64 | +# 65 | +rule init ( version ? : command * : options * ) 66 | +{ 67 | + # Information about the android command... 68 | + # The command. 69 | + local command = [ common.get-invocation-command android : g++ : $(command) ] ; 70 | + # The root directory of the tool install. 71 | + local root = [ feature.get-values : $(options) ] ; 72 | + # The bin directory where to find the command to execute. 73 | + local bin ; 74 | + # The flavor of compiler. 75 | + local flavor = [ feature.get-values : $(options) ] ; 76 | + # Autodetect the root and bin dir if not given. 77 | + if $(command) 78 | + { 79 | + bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; 80 | + root ?= $(bin:D) ; 81 | + } 82 | + # The 'command' variable can have multiple elements. When calling 83 | + # the SHELL builtin we need a single string. 84 | + local command-string = $(command:J=" ") ; 85 | + # Autodetect the version and flavor if not given. 86 | + if $(command) 87 | + { 88 | + local machine = [ MATCH "^([^ ]+)" 89 | + : [ SHELL "$(command-string) -dumpmachine" ] ] ; 90 | + version ?= [ MATCH "^([0-9.]+)" 91 | + : [ SHELL "$(command-string) -dumpversion" ] ] ; 92 | + switch $(machine:L) 93 | + { 94 | + case *mingw* : flavor ?= mingw ; 95 | + } 96 | + } 97 | + 98 | + local condition ; 99 | + if $(flavor) 100 | + { 101 | + condition = [ common.check-init-parameters android 102 | + : version $(version) 103 | + : flavor $(flavor) 104 | + ] ; 105 | + } 106 | + else 107 | + { 108 | + condition = [ common.check-init-parameters android 109 | + : version $(version) 110 | + ] ; 111 | + condition = $(condition) ; #/ ; 112 | + } 113 | + 114 | + common.handle-options android : $(condition) : $(command) : $(options) ; 115 | + 116 | + local linker = [ feature.get-values : $(options) ] ; 117 | + # The logic below should actually be keyed on 118 | + if ! $(linker) 119 | + { 120 | + if [ os.name ] = OSF 121 | + { 122 | + linker = osf ; 123 | + } 124 | + else if [ os.name ] = HPUX 125 | + { 126 | + linker = hpux ; 127 | + } 128 | + else if [ os.name ] = AIX 129 | + { 130 | + linker = aix ; 131 | + } 132 | + else if [ os.name ] = SOLARIS 133 | + { 134 | + linker = sun ; 135 | + } 136 | + else 137 | + { 138 | + linker = gnu ; 139 | + } 140 | + } 141 | + init-link-flags android $(linker) $(condition) ; 142 | + 143 | + 144 | + # If android is installed in non-standard location, we'd need to add 145 | + # LD_LIBRARY_PATH when running programs created with it (for unit-test/run 146 | + # rules). 147 | + if $(command) 148 | + { 149 | + # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries 150 | + # and all must be added to LD_LIBRARY_PATH. The linker will pick the 151 | + # right onces. Note that we don't provide a clean way to build 32-bit 152 | + # binary with 64-bit compiler, but user can always pass -m32 manually. 153 | + local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ; 154 | + if $(.debug-configuration) 155 | + { 156 | + ECHO notice: using android libraries :: $(condition) :: $(lib_path) ; 157 | + } 158 | + toolset.flags android.link RUN_PATH $(condition) : $(lib_path) ; 159 | + } 160 | + 161 | + # If it's not a system android install we should adjust the various programs as 162 | + # needed to prefer using the install specific versions. This is essential 163 | + # for correct use of MinGW and for cross-compiling. 164 | + 165 | + local nl = " 166 | +" ; 167 | + 168 | + # - The archive builder. 169 | + local archiver = [ common.get-invocation-command android 170 | + : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : [ SHELL "$(command-string) -print-prog-name=ar" ] ] ] 171 | + : [ feature.get-values : $(options) ] 172 | + : $(bin) 173 | + : search-path ] ; 174 | + toolset.flags android.archive .AR $(condition) : $(archiver[1]) ; 175 | + if $(.debug-configuration) 176 | + { 177 | + ECHO notice: using android archiver :: $(condition) :: $(archiver[1]) ; 178 | + } 179 | + 180 | + # - Ranlib 181 | + local ranlib = [ common.get-invocation-command android 182 | + : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : [ SHELL "$(command-string) -print-prog-name=ranlib" ] ] ] 183 | + : [ feature.get-values : $(options) ] 184 | + : $(bin) 185 | + : search-path ] ; 186 | + toolset.flags android.archive .RANLIB $(condition) : $(ranlib[1]) ; 187 | + if $(.debug-configuration) 188 | + { 189 | + ECHO notice: using android ranlib :: $(condition) :: $(ranlib[1]) ; 190 | + } 191 | + 192 | + 193 | + # - The resource compiler. 194 | + local rc = 195 | + [ common.get-invocation-command-nodefault android 196 | + : windres : [ feature.get-values : $(options) ] : $(bin) : search-path ] ; 197 | + local rc-type = 198 | + [ feature.get-values : $(options) ] ; 199 | + rc-type ?= windres ; 200 | + if ! $(rc) 201 | + { 202 | + # If we can't find an RC compiler we fallback to a null RC compiler that 203 | + # creates empty object files. This allows the same Jamfiles to work 204 | + # across the board. The null RC uses the assembler to create the empty 205 | + # objects, so configure that. 206 | + rc = [ common.get-invocation-command android : as : : $(bin) : search-path ] ; 207 | + rc-type = null ; 208 | + } 209 | + rc.configure $(rc) : $(condition) : $(rc-type) ; 210 | +} 211 | + 212 | +if [ os.name ] = NT 213 | +{ 214 | + # This causes single-line command invocation to not go through .bat files, 215 | + # thus avoiding command-line length limitations. 216 | + JAMSHELL = % ; 217 | +} 218 | + 219 | +generators.register-c-compiler android.compile.c++ : CPP : OBJ : android ; 220 | +generators.register-c-compiler android.compile.c : C : OBJ : android ; 221 | +generators.register-c-compiler android.compile.asm : ASM : OBJ : android ; 222 | +generators.register-fortran-compiler android.compile.fortran : FORTRAN FORTRAN90 : OBJ : android ; 223 | + 224 | +# pch support 225 | + 226 | +# The compiler looks for a precompiled header in each directory just before it 227 | +# looks for the include file in that directory. The name searched for is the 228 | +# name specified in the #include directive with ".gch" suffix appended. The 229 | +# logic in android-pch-generator will make sure that BASE_PCH suffix is appended to 230 | +# full name of the header. 231 | + 232 | +type.set-generated-target-suffix PCH : android : gch ; 233 | + 234 | +# android-specific pch generator. 235 | +class android-pch-generator : pch-generator 236 | +{ 237 | + import project ; 238 | + import property-set ; 239 | + import type ; 240 | + 241 | + rule run-pch ( project name ? : property-set : sources + ) 242 | + { 243 | + # Find the header in sources. Ignore any CPP sources. 244 | + local header ; 245 | + for local s in $(sources) 246 | + { 247 | + if [ type.is-derived [ $(s).type ] H ] 248 | + { 249 | + header = $(s) ; 250 | + } 251 | + } 252 | + 253 | + # Error handling: Base header file name should be the same as the base 254 | + # precompiled header name. 255 | + local header-name = [ $(header).name ] ; 256 | + local header-basename = $(header-name:B) ; 257 | + if $(header-basename) != $(name) 258 | + { 259 | + local location = [ $(project).project-module ] ; 260 | + errors.user-error "in" $(location)": pch target name `"$(name)"' should be the same as the base name of header file `"$(header-name)"'" ; 261 | + } 262 | + 263 | + local pch-file = [ generator.run $(project) $(name) : $(property-set) 264 | + : $(header) ] ; 265 | + 266 | + # return result of base class and pch-file property as usage-requirements 267 | + return 268 | + [ property-set.create $(pch-file) -Winvalid-pch ] 269 | + $(pch-file) 270 | + ; 271 | + } 272 | + 273 | + # Calls the base version specifying source's name as the name of the created 274 | + # target. As result, the PCH will be named whatever.hpp.gch, and not 275 | + # whatever.gch. 276 | + rule generated-targets ( sources + : property-set : project name ? ) 277 | + { 278 | + name = [ $(sources[1]).name ] ; 279 | + return [ generator.generated-targets $(sources) 280 | + : $(property-set) : $(project) $(name) ] ; 281 | + } 282 | +} 283 | + 284 | +# Note: the 'H' source type will catch both '.h' header and '.hpp' header. The 285 | +# latter have HPP type, but HPP type is derived from H. The type of compilation 286 | +# is determined entirely by the destination type. 287 | +generators.register [ new android-pch-generator android.compile.c.pch : H : C_PCH : on android ] ; 288 | +generators.register [ new android-pch-generator android.compile.c++.pch : H : CPP_PCH : on android ] ; 289 | + 290 | +# Override default do-nothing generators. 291 | +generators.override android.compile.c.pch : pch.default-c-pch-generator ; 292 | +generators.override android.compile.c++.pch : pch.default-cpp-pch-generator ; 293 | + 294 | +toolset.flags android.compile PCH_FILE on : ; 295 | + 296 | +# Declare flags and action for compilation. 297 | +toolset.flags android.compile OPTIONS off : -O0 ; 298 | +toolset.flags android.compile OPTIONS speed : -O3 ; 299 | +toolset.flags android.compile OPTIONS space : -Os ; 300 | + 301 | +toolset.flags android.compile OPTIONS off : -fno-inline ; 302 | +toolset.flags android.compile OPTIONS on : -Wno-inline ; 303 | +toolset.flags android.compile OPTIONS full : -finline-functions -Wno-inline ; 304 | + 305 | +toolset.flags android.compile OPTIONS off : -w ; 306 | +toolset.flags android.compile OPTIONS on : -Wall ; 307 | +toolset.flags android.compile OPTIONS all : -Wall -pedantic ; 308 | +toolset.flags android.compile OPTIONS on : -Werror ; 309 | + 310 | +toolset.flags android.compile OPTIONS on : -g ; 311 | +toolset.flags android.compile OPTIONS on : -pg ; 312 | +toolset.flags android.compile OPTIONS off : -fno-rtti ; 313 | + 314 | +rule setup-fpic ( targets * : sources * : properties * ) 315 | +{ 316 | + local link = [ feature.get-values link : $(properties) ] ; 317 | + if $(link) = shared 318 | + { 319 | + local target = [ feature.get-values target-os : $(properties) ] ; 320 | + 321 | + # This logic will add -fPIC for all compilations: 322 | + # 323 | + # lib a : a.cpp b ; 324 | + # obj b : b.cpp ; 325 | + # exe c : c.cpp a d ; 326 | + # obj d : d.cpp ; 327 | + # 328 | + # This all is fine, except that 'd' will be compiled with -fPIC even though 329 | + # it is not needed, as 'd' is used only in exe. However, it is hard to 330 | + # detect where a target is going to be used. Alternatively, we can set -fPIC 331 | + # only when main target type is LIB but than 'b' would be compiled without 332 | + # -fPIC which would lead to link errors on x86-64. So, compile everything 333 | + # with -fPIC. 334 | + # 335 | + # Yet another alternative would be to create a propagated 336 | + # feature and set it when building shared libraries, but that would be hard 337 | + # to implement and would increase the target path length even more. 338 | + 339 | + # On Windows, fPIC is default, specifying -fPIC explicitly leads to 340 | + # a warning. 341 | + if $(target) != cygwin && $(target) != windows 342 | + { 343 | + OPTIONS on $(targets) += -fPIC ; 344 | + } 345 | + } 346 | +} 347 | + 348 | +rule setup-address-model ( targets * : sources * : properties * ) 349 | +{ 350 | + local model = [ feature.get-values address-model : $(properties) ] ; 351 | + if $(model) 352 | + { 353 | + local option ; 354 | + local os = [ feature.get-values target-os : $(properties) ] ; 355 | + if $(os) = aix 356 | + { 357 | + if $(model) = 32 358 | + { 359 | + option = -maix32 ; 360 | + } 361 | + else 362 | + { 363 | + option = -maix64 ; 364 | + } 365 | + } 366 | + else 367 | + { 368 | + if $(model) = 32 369 | + { 370 | + option = -m32 ; 371 | + } 372 | + else if $(model) = 64 373 | + { 374 | + option = -m64 ; 375 | + } 376 | + # For darwin, the model can be 32_64. darwin.jam will handle that 377 | + # on its own. 378 | + } 379 | + OPTIONS on $(targets) += $(option) ; 380 | + } 381 | +} 382 | + 383 | + 384 | +# FIXME: this should not use os.name. 385 | +if [ os.name ] != NT && [ os.name ] != OSF && [ os.name ] != HPUX && [ os.name ] != AIX 386 | +{ 387 | + # OSF does have an option called -soname but it does not seem to work as 388 | + # expected, therefore it has been disabled. 389 | + HAVE_SONAME = "" ; 390 | + SONAME_OPTION = -h ; 391 | +} 392 | + 393 | +# HPUX, for some reason, seem to use '+h', not '-h'. 394 | +if [ os.name ] = HPUX 395 | +{ 396 | + HAVE_SONAME = "" ; 397 | + SONAME_OPTION = +h ; 398 | +} 399 | + 400 | +toolset.flags android.compile USER_OPTIONS ; 401 | +toolset.flags android.compile.c++ USER_OPTIONS ; 402 | +toolset.flags android.compile DEFINES ; 403 | +toolset.flags android.compile INCLUDES ; 404 | +toolset.flags android.compile.c++ TEMPLATE_DEPTH ; 405 | +toolset.flags android.compile.fortran USER_OPTIONS ; 406 | + 407 | +rule compile.c++.pch ( targets * : sources * : properties * ) 408 | +{ 409 | + setup-threading $(targets) : $(sources) : $(properties) ; 410 | + setup-fpic $(targets) : $(sources) : $(properties) ; 411 | + setup-address-model $(targets) : $(sources) : $(properties) ; 412 | +} 413 | + 414 | +actions compile.c++.pch 415 | +{ 416 | + "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 417 | +} 418 | + 419 | +rule compile.c.pch ( targets * : sources * : properties * ) 420 | +{ 421 | + setup-threading $(targets) : $(sources) : $(properties) ; 422 | + setup-fpic $(targets) : $(sources) : $(properties) ; 423 | + setup-address-model $(targets) : $(sources) : $(properties) ; 424 | +} 425 | + 426 | +actions compile.c.pch 427 | +{ 428 | + "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 429 | +} 430 | + 431 | +rule compile.c++ ( targets * : sources * : properties * ) 432 | +{ 433 | + setup-threading $(targets) : $(sources) : $(properties) ; 434 | + setup-fpic $(targets) : $(sources) : $(properties) ; 435 | + setup-address-model $(targets) : $(sources) : $(properties) ; 436 | + 437 | + # Some extensions are compiled as C++ by default. For others, we need to 438 | + # pass -x c++. We could always pass -x c++ but distcc does not work with it. 439 | + if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C 440 | + { 441 | + LANG on $(<) = "-x c++" ; 442 | + } 443 | + DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; 444 | + 445 | + # Here we want to raise the template-depth parameter value to something 446 | + # higher than the default value of 17. Note that we could do this using the 447 | + # feature.set-default rule but we do not want to set the default value for 448 | + # all toolsets as well. 449 | + # 450 | + # TODO: This 'modified default' has been inherited from some 'older Boost 451 | + # Build implementation' and has most likely been added to make some Boost 452 | + # library parts compile correctly. We should see what exactly prompted this 453 | + # and whether we can get around the problem more locally. 454 | + local template-depth = [ on $(<) return $(TEMPLATE_DEPTH) ] ; 455 | + if ! $(template-depth) 456 | + { 457 | + TEMPLATE_DEPTH on $(<) = 128 ; 458 | + } 459 | +} 460 | + 461 | +rule compile.c ( targets * : sources * : properties * ) 462 | +{ 463 | + setup-threading $(targets) : $(sources) : $(properties) ; 464 | + setup-fpic $(targets) : $(sources) : $(properties) ; 465 | + setup-address-model $(targets) : $(sources) : $(properties) ; 466 | + 467 | + # If we use the name g++ then default file suffix -> language mapping does 468 | + # not work. So have to pass -x option. Maybe, we can work around this by 469 | + # allowing the user to specify both C and C++ compiler names. 470 | + #if $(>:S) != .c 471 | + #{ 472 | + LANG on $(<) = "-x c" ; 473 | + #} 474 | + DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; 475 | +} 476 | + 477 | +rule compile.fortran ( targets * : sources * : properties * ) 478 | +{ 479 | + setup-threading $(targets) : $(sources) : $(properties) ; 480 | + setup-fpic $(targets) : $(sources) : $(properties) ; 481 | + setup-address-model $(targets) : $(sources) : $(properties) ; 482 | +} 483 | + 484 | +actions compile.c++ bind PCH_FILE 485 | +{ 486 | + "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)" 487 | +} 488 | + 489 | +actions compile.c bind PCH_FILE 490 | +{ 491 | + "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 492 | +} 493 | + 494 | +actions compile.fortran 495 | +{ 496 | + "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 497 | +} 498 | + 499 | +rule compile.asm 500 | +{ 501 | + LANG on $(<) = "-x assembler-with-cpp" ; 502 | +} 503 | + 504 | +actions compile.asm 505 | +{ 506 | + "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 507 | +} 508 | + 509 | +# The class which check that we don't try to use the static 510 | +# property while creating or using shared library, since it's not supported by 511 | +# android/libc. 512 | +class android-linking-generator : unix-linking-generator 513 | +{ 514 | + rule run ( project name ? : property-set : sources + ) 515 | + { 516 | + # TODO: Replace this with the use of a target-os property. 517 | + local no-static-link = ; 518 | + if [ modules.peek : UNIX ] 519 | + { 520 | + switch [ modules.peek : JAMUNAME ] 521 | + { 522 | + case * : no-static-link = true ; 523 | + } 524 | + } 525 | + 526 | + local properties = [ $(property-set).raw ] ; 527 | + local reason ; 528 | + if $(no-static-link) && static in $(properties) 529 | + { 530 | + if shared in $(properties) 531 | + { 532 | + reason = 533 | + "On android, DLL can't be build with 'static'." ; 534 | + } 535 | + else if [ type.is-derived $(self.target-types[1]) EXE ] 536 | + { 537 | + for local s in $(sources) 538 | + { 539 | + local type = [ $(s).type ] ; 540 | + if $(type) && [ type.is-derived $(type) SHARED_LIB ] 541 | + { 542 | + reason = 543 | + "On android, using DLLS together with the" 544 | + "static options is not possible " ; 545 | + } 546 | + } 547 | + } 548 | + } 549 | + if $(reason) 550 | + { 551 | + ECHO warning: 552 | + $(reason) ; 553 | + ECHO warning: 554 | + "It is suggested to use 'static' together" 555 | + "with 'static'." ; 556 | + return ; 557 | + } 558 | + else 559 | + { 560 | + local generated-targets = [ unix-linking-generator.run $(project) 561 | + $(name) : $(property-set) : $(sources) ] ; 562 | + return $(generated-targets) ; 563 | + } 564 | + } 565 | +} 566 | + 567 | +# The set of permissible input types is different on mingw. 568 | +# So, define two sets of generators, with mingw generators 569 | +# selected when target-os=windows. 570 | + 571 | +local g ; 572 | +g = [ new android-linking-generator android.mingw.link 573 | + : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB 574 | + : EXE 575 | + : android windows ] ; 576 | +$(g).set-rule-name android.link ; 577 | +generators.register $(g) ; 578 | + 579 | +g = [ new android-linking-generator android.mingw.link.dll 580 | + : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB 581 | + : IMPORT_LIB SHARED_LIB 582 | + : android windows ] ; 583 | +$(g).set-rule-name android.link.dll ; 584 | +generators.register $(g) ; 585 | + 586 | +generators.register 587 | + [ new android-linking-generator android.link 588 | + : LIB OBJ 589 | + : EXE 590 | + : android ] ; 591 | +generators.register 592 | + [ new android-linking-generator android.link.dll 593 | + : LIB OBJ 594 | + : SHARED_LIB 595 | + : android ] ; 596 | + 597 | +generators.override android.mingw.link : android.link ; 598 | +generators.override android.mingw.link.dll : android.link.dll ; 599 | + 600 | +# Cygwin is similar to msvc and mingw in that it uses import libraries. 601 | +# While in simple cases, it can directly link to a shared library, 602 | +# it is believed to be slower, and not always possible. Define cygwin-specific 603 | +# generators here. 604 | + 605 | +g = [ new android-linking-generator android.cygwin.link 606 | + : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB 607 | + : EXE 608 | + : android cygwin ] ; 609 | +$(g).set-rule-name android.link ; 610 | +generators.register $(g) ; 611 | + 612 | +g = [ new android-linking-generator android.cygwin.link.dll 613 | + : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB 614 | + : IMPORT_LIB SHARED_LIB 615 | + : android cygwin ] ; 616 | +$(g).set-rule-name android.link.dll ; 617 | +generators.register $(g) ; 618 | + 619 | +generators.override android.cygwin.link : android.link ; 620 | +generators.override android.cygwin.link.dll : android.link.dll ; 621 | + 622 | +# Declare flags for linking. 623 | +# First, the common flags. 624 | +toolset.flags android.link OPTIONS on : -g ; 625 | +toolset.flags android.link OPTIONS on : -pg ; 626 | +toolset.flags android.link USER_OPTIONS ; 627 | +toolset.flags android.link LINKPATH ; 628 | +toolset.flags android.link FINDLIBS-ST ; 629 | +toolset.flags android.link FINDLIBS-SA ; 630 | +toolset.flags android.link LIBRARIES ; 631 | + 632 | +toolset.flags android.link.dll .IMPLIB-COMMAND windows : "-Wl,--out-implib," ; 633 | +toolset.flags android.link.dll .IMPLIB-COMMAND cygwin : "-Wl,--out-implib," ; 634 | + 635 | +# For static we made sure there are no dynamic libraries in the 636 | +# link. On HP-UX not all system libraries exist as archived libraries (for 637 | +# example, there is no libunwind.a), so, on this platform, the -static option 638 | +# cannot be specified. 639 | +if [ os.name ] != HPUX 640 | +{ 641 | + toolset.flags android.link OPTIONS static : -static ; 642 | +} 643 | + 644 | +# Now, the vendor specific flags. 645 | +# The parameter linker can be either aix, darwin, gnu, hpux, osf or sun. 646 | +rule init-link-flags ( toolset linker condition ) 647 | +{ 648 | + switch $(linker) 649 | + { 650 | + case aix : 651 | + { 652 | + # 653 | + # On AIX we *have* to use the native linker. 654 | + # 655 | + # Using -brtl, the AIX linker will look for libraries with both the .a 656 | + # and .so extensions, such as libfoo.a and libfoo.so. Without -brtl, the 657 | + # AIX linker looks only for libfoo.a. Note that libfoo.a is an archived 658 | + # file that may contain shared objects and is different from static libs 659 | + # as on Linux. 660 | + # 661 | + # The -bnoipath strips the prepending (relative) path of libraries from 662 | + # the loader section in the target library or executable. Hence, during 663 | + # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded 664 | + # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without 665 | + # this option, the prepending (relative) path + library name is 666 | + # hard-coded in the loader section, causing *only* this path to be 667 | + # searched during load-time. Note that the AIX linker does not have an 668 | + # -soname equivalent, this is as close as it gets. 669 | + # 670 | + # The above options are definately for AIX 5.x, and most likely also for 671 | + # AIX 4.x and AIX 6.x. For details about the AIX linker see: 672 | + # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf 673 | + # 674 | + 675 | + toolset.flags $(toolset).link OPTIONS : -Wl,-brtl -Wl,-bnoipath 676 | + : unchecked ; 677 | + } 678 | + 679 | + case darwin : 680 | + { 681 | + # On Darwin, the -s option to ld does not work unless we pass -static, 682 | + # and passing -static unconditionally is a bad idea. So, don't pass -s. 683 | + # at all, darwin.jam will use separate 'strip' invocation. 684 | + toolset.flags $(toolset).link RPATH $(condition) : : unchecked ; 685 | + toolset.flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; 686 | + } 687 | + 688 | + case gnu : 689 | + { 690 | + # Strip the binary when no debugging is needed. We use --strip-all flag 691 | + # as opposed to -s since icc (intel's compiler) is generally 692 | + # option-compatible with and inherits from the android toolset, but does not 693 | + # support -s. 694 | + toolset.flags $(toolset).link OPTIONS $(condition)/on : -Wl,--strip-all : unchecked ; 695 | + toolset.flags $(toolset).link RPATH $(condition) : : unchecked ; 696 | + toolset.flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; 697 | + toolset.flags $(toolset).link START-GROUP $(condition) : -Wl,--start-group : unchecked ; 698 | + toolset.flags $(toolset).link END-GROUP $(condition) : -Wl,--end-group : unchecked ; 699 | + 700 | + # gnu ld has the ability to change the search behaviour for libraries 701 | + # referenced by -l switch. These modifiers are -Bstatic and -Bdynamic 702 | + # and change search for -l switches that follow them. The following list 703 | + # shows the tried variants. 704 | + # The search stops at the first variant that has a match. 705 | + # *nix: -Bstatic -lxxx 706 | + # libxxx.a 707 | + # 708 | + # *nix: -Bdynamic -lxxx 709 | + # libxxx.so 710 | + # libxxx.a 711 | + # 712 | + # windows (mingw,cygwin) -Bstatic -lxxx 713 | + # libxxx.a 714 | + # xxx.lib 715 | + # 716 | + # windows (mingw,cygwin) -Bdynamic -lxxx 717 | + # libxxx.dll.a 718 | + # xxx.dll.a 719 | + # libxxx.a 720 | + # xxx.lib 721 | + # cygxxx.dll (*) 722 | + # libxxx.dll 723 | + # xxx.dll 724 | + # libxxx.a 725 | + # 726 | + # (*) This is for cygwin 727 | + # Please note that -Bstatic and -Bdynamic are not a guarantee that a 728 | + # static or dynamic lib indeed gets linked in. The switches only change 729 | + # search patterns! 730 | + 731 | + # On *nix mixing shared libs with static runtime is not a good idea. 732 | + toolset.flags $(toolset).link FINDLIBS-ST-PFX $(condition)/shared 733 | + : -Wl,-Bstatic : unchecked ; 734 | + toolset.flags $(toolset).link FINDLIBS-SA-PFX $(condition)/shared 735 | + : -Wl,-Bdynamic : unchecked ; 736 | + 737 | + # On windows allow mixing of static and dynamic libs with static 738 | + # runtime. 739 | + toolset.flags $(toolset).link FINDLIBS-ST-PFX $(condition)/static/windows 740 | + : -Wl,-Bstatic : unchecked ; 741 | + toolset.flags $(toolset).link FINDLIBS-SA-PFX $(condition)/static/windows 742 | + : -Wl,-Bdynamic : unchecked ; 743 | + toolset.flags $(toolset).link OPTIONS $(condition)/static/windows 744 | + : -Wl,-Bstatic : unchecked ; 745 | + } 746 | + 747 | + case hpux : 748 | + { 749 | + toolset.flags $(toolset).link OPTIONS $(condition)/on 750 | + : -Wl,-s : unchecked ; 751 | + toolset.flags $(toolset).link OPTIONS $(condition)/shared 752 | + : -fPIC : unchecked ; 753 | + } 754 | + 755 | + case osf : 756 | + { 757 | + # No --strip-all, just -s. 758 | + toolset.flags $(toolset).link OPTIONS $(condition)/on 759 | + : -Wl,-s : unchecked ; 760 | + toolset.flags $(toolset).link RPATH $(condition) : 761 | + : unchecked ; 762 | + # This does not supports -R. 763 | + toolset.flags $(toolset).link RPATH_OPTION $(condition) : -rpath 764 | + : unchecked ; 765 | + # -rpath-link is not supported at all. 766 | + } 767 | + 768 | + case sun : 769 | + { 770 | + toolset.flags $(toolset).link OPTIONS $(condition)/on 771 | + : -Wl,-s : unchecked ; 772 | + toolset.flags $(toolset).link RPATH $(condition) : 773 | + : unchecked ; 774 | + # Solaris linker does not have a separate -rpath-link, but allows to use 775 | + # -L for the same purpose. 776 | + toolset.flags $(toolset).link LINKPATH $(condition) : 777 | + : unchecked ; 778 | + 779 | + # This permits shared libraries with non-PIC code on Solaris. 780 | + # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the 781 | + # following is not needed. Whether -fPIC should be hardcoded, is a 782 | + # separate question. 783 | + # AH, 2004/10/16: it is still necessary because some tests link against 784 | + # static libraries that were compiled without PIC. 785 | + toolset.flags $(toolset).link OPTIONS $(condition)/shared 786 | + : -mimpure-text : unchecked ; 787 | + } 788 | + 789 | + case * : 790 | + { 791 | + errors.user-error 792 | + "$(toolset) initialization: invalid linker '$(linker)'" : 793 | + "The value '$(linker)' specified for is not recognized." : 794 | + "Possible values are 'aix', 'darwin', 'gnu', 'hpux', 'osf' or 'sun'" ; 795 | + } 796 | + } 797 | +} 798 | + 799 | +# Enclose the RPATH variable on 'targets' in (double) quotes, 800 | +# unless it's already enclosed in single quotes. 801 | +# This special casing is done because it's common to pass 802 | +# '$ORIGIN' to linker -- and it has to have single quotes 803 | +# to prevent expansion by shell -- and if we add double 804 | +# quotes then preventing properties of single quotes disappear. 805 | +rule quote-rpath ( targets * ) 806 | +{ 807 | + local r = [ on $(targets[1]) return $(RPATH) ] ; 808 | + if ! [ MATCH "('.*')" : $(r) ] 809 | + { 810 | + r = "\"$(r)\"" ; 811 | + } 812 | + RPATH on $(targets) = $(r) ; 813 | +} 814 | + 815 | +# Declare actions for linking. 816 | +rule link ( targets * : sources * : properties * ) 817 | +{ 818 | + setup-threading $(targets) : $(sources) : $(properties) ; 819 | + setup-address-model $(targets) : $(sources) : $(properties) ; 820 | + SPACE on $(targets) = " " ; 821 | + # Serialize execution of the 'link' action, since running N links in 822 | + # parallel is just slower. For now, serialize only android links, it might be a 823 | + # good idea to serialize all links. 824 | + JAM_SEMAPHORE on $(targets) = android-link-semaphore ; 825 | + quote-rpath $(targets) ; 826 | +} 827 | + 828 | +actions link bind LIBRARIES 829 | +{ 830 | + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) 831 | + 832 | +} 833 | + 834 | +# Default value. Mostly for the sake of intel-linux that inherits from android, but 835 | +# does not have the same logic to set the .AR variable. We can put the same 836 | +# logic in intel-linux, but that's hardly worth the trouble as on Linux, 'ar' is 837 | +# always available. 838 | +.AR = ar ; 839 | +.RANLIB = ranlib ; 840 | + 841 | +toolset.flags android.archive AROPTIONS ; 842 | + 843 | +rule archive ( targets * : sources * : properties * ) 844 | +{ 845 | + # Always remove archive and start again. Here is the rationale from 846 | + # 847 | + # Andre Hentz: 848 | + # 849 | + # I had a file, say a1.c, that was included into liba.a. I moved a1.c to 850 | + # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd 851 | + # errors. After some debugging I traced it back to the fact that a1.o was 852 | + # *still* in liba.a 853 | + # 854 | + # Rene Rivera: 855 | + # 856 | + # Originally removing the archive was done by splicing an RM onto the 857 | + # archive action. That makes archives fail to build on NT when they have 858 | + # many files because it will no longer execute the action directly and blow 859 | + # the line length limit. Instead we remove the file in a different action, 860 | + # just before building the archive. 861 | + # 862 | + local clean.a = $(targets[1])(clean) ; 863 | + TEMPORARY $(clean.a) ; 864 | + NOCARE $(clean.a) ; 865 | + LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; 866 | + DEPENDS $(clean.a) : $(sources) ; 867 | + DEPENDS $(targets) : $(clean.a) ; 868 | + common.RmTemps $(clean.a) : $(targets) ; 869 | +} 870 | + 871 | +# Declare action for creating static libraries. 872 | +# The letter 'r' means to add files to the archive with replacement. Since we 873 | +# remove archive, we don't care about replacement, but there's no option "add 874 | +# without replacement". 875 | +# The letter 'c' suppresses the warning in case the archive does not exists yet. 876 | +# That warning is produced only on some platforms, for whatever reasons. 877 | +actions piecemeal archive 878 | +{ 879 | + "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" 880 | + "$(.RANLIB)" "$(<)" 881 | +} 882 | + 883 | +rule link.dll ( targets * : sources * : properties * ) 884 | +{ 885 | + setup-threading $(targets) : $(sources) : $(properties) ; 886 | + setup-address-model $(targets) : $(sources) : $(properties) ; 887 | + SPACE on $(targets) = " " ; 888 | + JAM_SEMAPHORE on $(targets) = android-link-semaphore ; 889 | + quote-rpath $(targets) ; 890 | +} 891 | + 892 | +# Differs from 'link' above only by -shared. 893 | +actions link.dll bind LIBRARIES 894 | +{ 895 | + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) 896 | +} 897 | + 898 | +rule setup-threading ( targets * : sources * : properties * ) 899 | +{ 900 | + local threading = [ feature.get-values threading : $(properties) ] ; 901 | + if $(threading) = multi 902 | + { 903 | + local target = [ feature.get-values target-os : $(properties) ] ; 904 | + local option ; 905 | + local libs ; 906 | + 907 | + ECHO "MOSSS>>> target: $(target)" ; 908 | + 909 | + switch $(target) 910 | + { 911 | + case windows : 912 | + { 913 | + option = -mthreads ; 914 | + } 915 | + case cygwin : 916 | + { 917 | + option = -mthreads ; 918 | + } 919 | + case solaris : 920 | + { 921 | + option = -pthreads ; 922 | + libs = rt ; 923 | + } 924 | + case beos : 925 | + { 926 | + # BeOS has no threading options, so do not set anything here. 927 | + } 928 | + case *bsd : 929 | + { 930 | + option = -pthread ; 931 | + # There is no -lrt on BSD. 932 | + } 933 | + case sgi : 934 | + { 935 | + # android on IRIX does not support multi-threading so do not set anything 936 | + # here. 937 | + } 938 | + case darwin : 939 | + { 940 | + # Darwin has no threading options so do not set anything here. 941 | + } 942 | + case android : 943 | + { 944 | + # @Moss - Make Android decision here 945 | + } 946 | + case * : 947 | + { 948 | + #option = -pthread ; 949 | + #libs = rt ; 950 | + } 951 | + } 952 | + 953 | + if $(option) 954 | + { 955 | + OPTIONS on $(targets) += $(option) ; 956 | + } 957 | + if $(libs) 958 | + { 959 | + FINDLIBS-SA on $(targets) += $(libs) ; 960 | + } 961 | + } 962 | +} 963 | + 964 | +local rule cpu-flags ( toolset variable : architecture : instruction-set + : values + : default ? ) 965 | +{ 966 | + if $(default) 967 | + { 968 | + toolset.flags $(toolset) $(variable) 969 | + $(architecture)/ 970 | + : $(values) ; 971 | + } 972 | + toolset.flags $(toolset) $(variable) 973 | + /$(instruction-set) 974 | + $(architecture)/$(instruction-set) 975 | + : $(values) ; 976 | +} 977 | + 978 | +# Set architecture/instruction-set options. 979 | +# 980 | +# x86 and compatible 981 | +# The 'native' option appeared in android 4.2 so we cannot safely use it 982 | +# as default. Use conservative i386 instead. 983 | +cpu-flags android OPTIONS : x86 : native : -march=native ; 984 | +cpu-flags android OPTIONS : x86 : i386 : -march=i386 : default ; 985 | +cpu-flags android OPTIONS : x86 : i486 : -march=i486 ; 986 | +cpu-flags android OPTIONS : x86 : i586 : -march=i586 ; 987 | +cpu-flags android OPTIONS : x86 : i686 : -march=i686 ; 988 | +cpu-flags android OPTIONS : x86 : pentium : -march=pentium ; 989 | +cpu-flags android OPTIONS : x86 : pentium-mmx : -march=pentium-mmx ; 990 | +cpu-flags android OPTIONS : x86 : pentiumpro : -march=pentiumpro ; 991 | +cpu-flags android OPTIONS : x86 : pentium2 : -march=pentium2 ; 992 | +cpu-flags android OPTIONS : x86 : pentium3 : -march=pentium3 ; 993 | +cpu-flags android OPTIONS : x86 : pentium3m : -march=pentium3m ; 994 | +cpu-flags android OPTIONS : x86 : pentium-m : -march=pentium-m ; 995 | +cpu-flags android OPTIONS : x86 : pentium4 : -march=pentium4 ; 996 | +cpu-flags android OPTIONS : x86 : pentium4m : -march=pentium4m ; 997 | +cpu-flags android OPTIONS : x86 : prescott : -march=prescott ; 998 | +cpu-flags android OPTIONS : x86 : nocona : -march=nocona ; 999 | +cpu-flags android OPTIONS : x86 : core2 : -march=core2 ; 1000 | +cpu-flags android OPTIONS : x86 : k6 : -march=k6 ; 1001 | +cpu-flags android OPTIONS : x86 : k6-2 : -march=k6-2 ; 1002 | +cpu-flags android OPTIONS : x86 : k6-3 : -march=k6-3 ; 1003 | +cpu-flags android OPTIONS : x86 : athlon : -march=athlon ; 1004 | +cpu-flags android OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ; 1005 | +cpu-flags android OPTIONS : x86 : athlon-4 : -march=athlon-4 ; 1006 | +cpu-flags android OPTIONS : x86 : athlon-xp : -march=athlon-xp ; 1007 | +cpu-flags android OPTIONS : x86 : athlon-mp : -march=athlon-mp ; 1008 | +## 1009 | +cpu-flags android OPTIONS : x86 : k8 : -march=k8 ; 1010 | +cpu-flags android OPTIONS : x86 : opteron : -march=opteron ; 1011 | +cpu-flags android OPTIONS : x86 : athlon64 : -march=athlon64 ; 1012 | +cpu-flags android OPTIONS : x86 : athlon-fx : -march=athlon-fx ; 1013 | +cpu-flags android OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ; 1014 | +cpu-flags android OPTIONS : x86 : winchip2 : -march=winchip2 ; 1015 | +cpu-flags android OPTIONS : x86 : c3 : -march=c3 ; 1016 | +cpu-flags android OPTIONS : x86 : c3-2 : -march=c3-2 ; 1017 | +# Sparc 1018 | +cpu-flags android OPTIONS : sparc : c3 : -mcpu=c3 : default ; 1019 | +cpu-flags android OPTIONS : sparc : v7 : -mcpu=v7 ; 1020 | +cpu-flags android OPTIONS : sparc : cypress : -mcpu=cypress ; 1021 | +cpu-flags android OPTIONS : sparc : v8 : -mcpu=v8 ; 1022 | +cpu-flags android OPTIONS : sparc : supersparc : -mcpu=supersparc ; 1023 | +cpu-flags android OPTIONS : sparc : sparclite : -mcpu=sparclite ; 1024 | +cpu-flags android OPTIONS : sparc : hypersparc : -mcpu=hypersparc ; 1025 | +cpu-flags android OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ; 1026 | +cpu-flags android OPTIONS : sparc : f930 : -mcpu=f930 ; 1027 | +cpu-flags android OPTIONS : sparc : f934 : -mcpu=f934 ; 1028 | +cpu-flags android OPTIONS : sparc : sparclet : -mcpu=sparclet ; 1029 | +cpu-flags android OPTIONS : sparc : tsc701 : -mcpu=tsc701 ; 1030 | +cpu-flags android OPTIONS : sparc : v9 : -mcpu=v9 ; 1031 | +cpu-flags android OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ; 1032 | +cpu-flags android OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ; 1033 | +# RS/6000 & PowerPC 1034 | +cpu-flags android OPTIONS : power : 403 : -mcpu=403 ; 1035 | +cpu-flags android OPTIONS : power : 505 : -mcpu=505 ; 1036 | +cpu-flags android OPTIONS : power : 601 : -mcpu=601 ; 1037 | +cpu-flags android OPTIONS : power : 602 : -mcpu=602 ; 1038 | +cpu-flags android OPTIONS : power : 603 : -mcpu=603 ; 1039 | +cpu-flags android OPTIONS : power : 603e : -mcpu=603e ; 1040 | +cpu-flags android OPTIONS : power : 604 : -mcpu=604 ; 1041 | +cpu-flags android OPTIONS : power : 604e : -mcpu=604e ; 1042 | +cpu-flags android OPTIONS : power : 620 : -mcpu=620 ; 1043 | +cpu-flags android OPTIONS : power : 630 : -mcpu=630 ; 1044 | +cpu-flags android OPTIONS : power : 740 : -mcpu=740 ; 1045 | +cpu-flags android OPTIONS : power : 7400 : -mcpu=7400 ; 1046 | +cpu-flags android OPTIONS : power : 7450 : -mcpu=7450 ; 1047 | +cpu-flags android OPTIONS : power : 750 : -mcpu=750 ; 1048 | +cpu-flags android OPTIONS : power : 801 : -mcpu=801 ; 1049 | +cpu-flags android OPTIONS : power : 821 : -mcpu=821 ; 1050 | +cpu-flags android OPTIONS : power : 823 : -mcpu=823 ; 1051 | +cpu-flags android OPTIONS : power : 860 : -mcpu=860 ; 1052 | +cpu-flags android OPTIONS : power : 970 : -mcpu=970 ; 1053 | +cpu-flags android OPTIONS : power : 8540 : -mcpu=8540 ; 1054 | +cpu-flags android OPTIONS : power : power : -mcpu=power ; 1055 | +cpu-flags android OPTIONS : power : power2 : -mcpu=power2 ; 1056 | +cpu-flags android OPTIONS : power : power3 : -mcpu=power3 ; 1057 | +cpu-flags android OPTIONS : power : power4 : -mcpu=power4 ; 1058 | +cpu-flags android OPTIONS : power : power5 : -mcpu=power5 ; 1059 | +cpu-flags android OPTIONS : power : powerpc : -mcpu=powerpc ; 1060 | +cpu-flags android OPTIONS : power : powerpc64 : -mcpu=powerpc64 ; 1061 | +cpu-flags android OPTIONS : power : rios : -mcpu=rios ; 1062 | +cpu-flags android OPTIONS : power : rios1 : -mcpu=rios1 ; 1063 | +cpu-flags android OPTIONS : power : rios2 : -mcpu=rios2 ; 1064 | +cpu-flags android OPTIONS : power : rsc : -mcpu=rsc ; 1065 | +cpu-flags android OPTIONS : power : rs64a : -mcpu=rs64 ; 1066 | +# AIX variant of RS/6000 & PowerPC 1067 | +toolset.flags android AROPTIONS 64/aix : "-X 64" ; 1068 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/android.py.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/tools/build/v2/tools/android.py 1970-01-01 03:00:00.000000000 +0300 2 | +++ boost_1_45_0/tools/build/v2/tools/android.py 2011-06-06 15:29:57.787421112 +0300 3 | @@ -0,0 +1,798 @@ 4 | +# Status: being ported by Steven Watanabe 5 | +# Base revision: 47077 6 | +# TODO: common.jam needs to be ported 7 | +# TODO: generators.jam needs to have register_c_compiler. 8 | +# 9 | +# Copyright 2001 David Abrahams. 10 | +# Copyright 2002-2006 Rene Rivera. 11 | +# Copyright 2002-2003 Vladimir Prus. 12 | +# Copyright (c) 2005 Reece H. Dunn. 13 | +# Copyright 2006 Ilya Sokolov. 14 | +# Copyright 2007 Roland Schwarz 15 | +# Copyright 2007 Boris Gubenko. 16 | +# Copyright 2008 Steven Watanabe 17 | +# Copyright 2010 Moritz Wundke. 18 | +# 19 | +# Distributed under the Boost Software License, Version 1.0. 20 | +# (See accompanying file LICENSE_1_0.txt or copy at 21 | +# http://www.boost.org/LICENSE_1_0.txt) 22 | + 23 | +import os 24 | +import subprocess 25 | +import re 26 | + 27 | +import bjam 28 | + 29 | +from b2.tools import unix, common, rc, pch, builtin 30 | +from b2.build import feature, type, toolset, generators 31 | +from b2.util.utility import os_name, on_windows 32 | +from b2.manager import get_manager 33 | +from b2.build.generators import Generator 34 | +from b2.build.toolset import flags 35 | +from b2.util.utility import to_seq 36 | + 37 | +__debug = None 38 | + 39 | +def debug(): 40 | + global __debug 41 | + if __debug is None: 42 | + __debug = "--debug-configuration" in bjam.variable("ARGV") 43 | + return __debug 44 | + 45 | +feature.extend('toolset', ['android']) 46 | + 47 | + 48 | +toolset.inherit_generators('android', [], 'unix', ['unix.link', 'unix.link.dll']) 49 | +toolset.inherit_flags('android', 'unix') 50 | +toolset.inherit_rules('android', 'unix') 51 | + 52 | +generators.override('android.prebuilt', 'builtin.prebuilt') 53 | +generators.override('android.searched-lib-generator', 'searched-lib-generator') 54 | + 55 | +# Target naming is determined by types/lib.jam and the settings below this 56 | +# comment. 57 | +# 58 | +# On *nix: 59 | +# libxxx.a static library 60 | +# libxxx.so shared library 61 | +# 62 | +# On windows (mingw): 63 | +# libxxx.lib static library 64 | +# xxx.dll DLL 65 | +# xxx.lib import library 66 | +# 67 | +# On windows (cygwin) i.e. cygwin 68 | +# libxxx.a static library 69 | +# xxx.dll DLL 70 | +# libxxx.dll.a import library 71 | +# 72 | +# Note: user can always override by using the @rule 73 | +# This settings have been choosen, so that mingw 74 | +# is in line with msvc naming conventions. For 75 | +# cygwin the cygwin naming convention has been choosen. 76 | + 77 | +# Make the "o" suffix used for android toolset on all 78 | +# platforms 79 | +type.set_generated_target_suffix('OBJ', ['android'], 'o') 80 | +type.set_generated_target_suffix('STATIC_LIB', ['android', 'cygwin'], 'a') 81 | + 82 | +type.set_generated_target_suffix('IMPORT_LIB', ['android', 'cygwin'], 'dll.a') 83 | +type.set_generated_target_prefix('IMPORT_LIB', ['android', 'cygwin'], 'lib') 84 | + 85 | +__machine_match = re.compile('^([^ ]+)') 86 | +__version_match = re.compile('^([0-9.]+)') 87 | + 88 | +def init(version = None, command = None, options = None): 89 | + """ 90 | + Initializes the android toolset for the given version. If necessary, command may 91 | + be used to specify where the compiler is located. The parameter 'options' is a 92 | + space-delimited list of options, each one specified as 93 | + option-value. Valid option names are: cxxflags, linkflags and 94 | + linker-type. Accepted linker-type values are gnu, darwin, osf, hpux or sun 95 | + and the default value will be selected based on the current OS. 96 | + Example: 97 | + using android : 3.4 : : foo bar sun ; 98 | + """ 99 | + 100 | + options = to_seq(options) 101 | + command = to_seq(command) 102 | + 103 | + # Information about the android command... 104 | + # The command. 105 | + command = to_seq(common.get_invocation_command('android', 'g++', command)) 106 | + # The root directory of the tool install. 107 | + root = feature.get_values('', options) ; 108 | + # The bin directory where to find the command to execute. 109 | + bin = None 110 | + # The flavor of compiler. 111 | + flavor = feature.get_values('', options) 112 | + # Autodetect the root and bin dir if not given. 113 | + if command: 114 | + if not bin: 115 | + bin = common.get_absolute_tool_path(command[-1]) 116 | + if not root: 117 | + root = os.path.dirname(bin) 118 | + # Autodetect the version and flavor if not given. 119 | + if command: 120 | + machine_info = subprocess.Popen(command + ['-dumpmachine'], stdout=subprocess.PIPE).communicate()[0] 121 | + machine = __machine_match.search(machine_info).group(1) 122 | + 123 | + version_info = subprocess.Popen(command + ['-dumpversion'], stdout=subprocess.PIPE).communicate()[0] 124 | + version = __version_match.search(version_info).group(1) 125 | + if not flavor and machine.find('mingw') != -1: 126 | + flavor = 'mingw' 127 | + 128 | + condition = None 129 | + if flavor: 130 | + condition = common.check_init_parameters('android', None, 131 | + ('version', version), 132 | + ('flavor', flavor)) 133 | + else: 134 | + condition = common.check_init_parameters('android', None, 135 | + ('version', version)) 136 | + 137 | + if command: 138 | + command = command[0] 139 | + 140 | + common.handle_options('android', condition, command, options) 141 | + 142 | + linker = feature.get_values('', options) 143 | + if not linker: 144 | + if os_name() == 'OSF': 145 | + linker = 'osf' 146 | + elif os_name() == 'HPUX': 147 | + linker = 'hpux' ; 148 | + else: 149 | + linker = 'gnu' 150 | + 151 | + init_link_flags('android', linker, condition) 152 | + 153 | + # If android is installed in non-standard location, we'd need to add 154 | + # LD_LIBRARY_PATH when running programs created with it (for unit-test/run 155 | + # rules). 156 | + if command: 157 | + # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries 158 | + # and all must be added to LD_LIBRARY_PATH. The linker will pick the 159 | + # right onces. Note that we don't provide a clean way to build 32-bit 160 | + # binary with 64-bit compiler, but user can always pass -m32 manually. 161 | + lib_path = [os.path.join(root, 'bin'), 162 | + os.path.join(root, 'lib'), 163 | + os.path.join(root, 'lib32'), 164 | + os.path.join(root, 'lib64')] 165 | + if debug(): 166 | + print 'notice: using android libraries ::', condition, '::', lib_path 167 | + toolset.flags('android.link', 'RUN_PATH', condition, lib_path) 168 | + 169 | + # If it's not a system android install we should adjust the various programs as 170 | + # needed to prefer using the install specific versions. This is essential 171 | + # for correct use of MinGW and for cross-compiling. 172 | + 173 | + # - The archive builder. 174 | + archiver = common.get_invocation_command('android', 175 | + 'ar', feature.get_values('', options), [bin], path_last=True) 176 | + toolset.flags('android.archive', '.AR', condition, [archiver]) 177 | + if debug(): 178 | + print 'notice: using android archiver ::', condition, '::', archiver 179 | + 180 | + # - The resource compiler. 181 | + rc_command = common.get_invocation_command_nodefault('android', 182 | + 'windres', feature.get_values('', options), [bin], path_last=True) 183 | + rc_type = feature.get_values('', options) 184 | + 185 | + if not rc_type: 186 | + rc_type = 'windres' 187 | + 188 | + if not rc_command: 189 | + # If we can't find an RC compiler we fallback to a null RC compiler that 190 | + # creates empty object files. This allows the same Jamfiles to work 191 | + # across the board. The null RC uses the assembler to create the empty 192 | + # objects, so configure that. 193 | + rc_command = common.get_invocation_command('android', 'as', [], [bin], path_last=True) 194 | + rc_type = 'null' 195 | + rc.configure(rc_command, condition, '' + rc_type) 196 | + 197 | +###if [ os.name ] = NT 198 | +###{ 199 | +### # This causes single-line command invocation to not go through .bat files, 200 | +### # thus avoiding command-line length limitations. 201 | +### JAMSHELL = % ; 202 | +###} 203 | + 204 | +#FIXME: when register_c_compiler is moved to 205 | +# generators, these should be updated 206 | +builtin.register_c_compiler('android.compile.c++', ['CPP'], ['OBJ'], ['android']) 207 | +builtin.register_c_compiler('android.compile.c', ['C'], ['OBJ'], ['android']) 208 | +builtin.register_c_compiler('android.compile.asm', ['ASM'], ['OBJ'], ['android']) 209 | + 210 | +# pch support 211 | + 212 | +# The compiler looks for a precompiled header in each directory just before it 213 | +# looks for the include file in that directory. The name searched for is the 214 | +# name specified in the #include directive with ".gch" suffix appended. The 215 | +# logic in android-pch-generator will make sure that BASE_PCH suffix is appended to 216 | +# full name of the header. 217 | + 218 | +type.set_generated_target_suffix('PCH', ['android'], 'gch') 219 | + 220 | +# android-specific pch generator. 221 | +class androidPchGenerator(pch.PchGenerator): 222 | + 223 | + # Inherit the __init__ method 224 | + 225 | + def run_pch(self, project, name, prop_set, sources): 226 | + # Find the header in sources. Ignore any CPP sources. 227 | + header = None 228 | + for s in sources: 229 | + if type.is_derived(s.type, 'H'): 230 | + header = s 231 | + 232 | + # Error handling: Base header file name should be the same as the base 233 | + # precompiled header name. 234 | + header_name = header.name 235 | + header_basename = os.path.basename(header_name).rsplit('.', 1)[0] 236 | + if header_basename != name: 237 | + location = project.project_module 238 | + ###FIXME: 239 | + raise Exception() 240 | + ### errors.user-error "in" $(location)": pch target name `"$(name)"' should be the same as the base name of header file `"$(header-name)"'" ; 241 | + 242 | + pch_file = Generator.run(self, project, name, prop_set, [header]) 243 | + 244 | + # return result of base class and pch-file property as usage-requirements 245 | + # FIXME: what about multiple results from generator.run? 246 | + return (property_set.create('' + pch_file[0], '-Winvalid-pch'), 247 | + pch_file) 248 | + 249 | + # Calls the base version specifying source's name as the name of the created 250 | + # target. As result, the PCH will be named whatever.hpp.gch, and not 251 | + # whatever.gch. 252 | + def generated_targets(self, sources, prop_set, project, name = None): 253 | + name = sources[0].name 254 | + return Generator.generated_targets(self, sources, 255 | + prop_set, project, name) 256 | + 257 | +# Note: the 'H' source type will catch both '.h' header and '.hpp' header. The 258 | +# latter have HPP type, but HPP type is derived from H. The type of compilation 259 | +# is determined entirely by the destination type. 260 | +generators.register(androidPchGenerator('android.compile.c.pch', False, ['H'], ['C_PCH'], ['on', 'android' ])) 261 | +generators.register(androidPchGenerator('android.compile.c++.pch', False, ['H'], ['CPP_PCH'], ['on', 'android' ])) 262 | + 263 | +# Override default do-nothing generators. 264 | +generators.override('android.compile.c.pch', 'pch.default-c-pch-generator') 265 | +generators.override('android.compile.c++.pch', 'pch.default-cpp-pch-generator') 266 | + 267 | +flags('android.compile', 'PCH_FILE', ['on'], ['']) 268 | + 269 | +# Declare flags and action for compilation 270 | +flags('android.compile', 'OPTIONS', ['off'], ['-O0']) 271 | +flags('android.compile', 'OPTIONS', ['speed'], ['-O3']) 272 | +flags('android.compile', 'OPTIONS', ['space'], ['-Os']) 273 | + 274 | +flags('android.compile', 'OPTIONS', ['off'], ['-fno-inline']) 275 | +flags('android.compile', 'OPTIONS', ['on'], ['-Wno-inline']) 276 | +flags('android.compile', 'OPTIONS', ['full'], ['-finline-functions', '-Wno-inline']) 277 | + 278 | +flags('android.compile', 'OPTIONS', ['off'], ['-w']) 279 | +flags('android.compile', 'OPTIONS', ['on'], ['-Wall']) 280 | +flags('android.compile', 'OPTIONS', ['all'], ['-Wall', '-pedantic']) 281 | +flags('android.compile', 'OPTIONS', ['on'], ['-Werror']) 282 | + 283 | +flags('android.compile', 'OPTIONS', ['on'], ['-g']) 284 | +flags('android.compile', 'OPTIONS', ['on'], ['-pg']) 285 | +flags('android.compile', 'OPTIONS', ['off'], ['-fno-rtti']) 286 | + 287 | +# On cygwin and mingw, android generates position independent code by default, and 288 | +# warns if -fPIC is specified. This might not be the right way of checking if 289 | +# we're using cygwin. For example, it's possible to run cygwin android from NT 290 | +# shell, or using crosscompiling. But we'll solve that problem when it's time. 291 | +# In that case we'll just add another parameter to 'init' and move this login 292 | +# inside 'init'. 293 | +if not os_name () in ['CYGWIN', 'NT']: 294 | + print "osname:", os_name() 295 | + # This logic will add -fPIC for all compilations: 296 | + # 297 | + # lib a : a.cpp b ; 298 | + # obj b : b.cpp ; 299 | + # exe c : c.cpp a d ; 300 | + # obj d : d.cpp ; 301 | + # 302 | + # This all is fine, except that 'd' will be compiled with -fPIC even though 303 | + # it's not needed, as 'd' is used only in exe. However, it's hard to detect 304 | + # where a target is going to be used. Alternative, we can set -fPIC only 305 | + # when main target type is LIB but than 'b' will be compiled without -fPIC. 306 | + # In x86-64 that will lead to link errors. So, compile everything with 307 | + # -fPIC. 308 | + # 309 | + # Yet another alternative would be to create propagated 310 | + # feature, and set it when building shared libraries, but that's hard to 311 | + # implement and will increase target path length even more. 312 | + flags('android.compile', 'OPTIONS', ['shared'], ['-fPIC']) 313 | + 314 | +if os_name() != 'NT' and os_name() != 'OSF' and os_name() != 'HPUX': 315 | + # OSF does have an option called -soname but it doesn't seem to work as 316 | + # expected, therefore it has been disabled. 317 | + HAVE_SONAME = '' 318 | + SONAME_OPTION = '-h' 319 | + 320 | + 321 | +flags('android.compile', 'USER_OPTIONS', [], ['']) 322 | +flags('android.compile.c++', 'USER_OPTIONS',[], ['']) 323 | +flags('android.compile', 'DEFINES', [], ['']) 324 | +flags('android.compile', 'INCLUDES', [], ['']) 325 | + 326 | +engine = get_manager().engine() 327 | + 328 | +engine.register_action('android.compile.c++.pch', 329 | + '"$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"') 330 | + 331 | +engine.register_action('android.compile.c.pch', 332 | + '"$(CONFIG_COMMAND)" -x c-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"') 333 | + 334 | + 335 | +def android_compile_cpp(targets, sources, properties): 336 | + # Some extensions are compiled as C++ by default. For others, we need to 337 | + # pass -x c++. We could always pass -x c++ but distcc does not work with it. 338 | + extension = os.path.splitext (sources [0]) [1] 339 | + lang = '' 340 | + if not extension in ['.cc', '.cp', '.cxx', '.cpp', '.c++', '.C']: 341 | + lang = '-x c++' 342 | + get_manager().engine().set_target_variable (targets, 'LANG', lang) 343 | + engine.add_dependency(targets, bjam.call('get-target-variable', targets, 'PCH_FILE')) 344 | + 345 | +def android_compile_c(targets, sources, properties): 346 | + engine = get_manager().engine() 347 | + # If we use the name g++ then default file suffix -> language mapping does 348 | + # not work. So have to pass -x option. Maybe, we can work around this by 349 | + # allowing the user to specify both C and C++ compiler names. 350 | + #if $(>:S) != .c 351 | + #{ 352 | + engine.set_target_variable (targets, 'LANG', '-x c') 353 | + #} 354 | + engine.add_dependency(targets, bjam.call('get-target-variable', targets, 'PCH_FILE')) 355 | + 356 | +engine.register_action( 357 | + 'android.compile.c++', 358 | + '"$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-128 $(OPTIONS) ' + 359 | + '$(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" ' + 360 | + '-c -o "$(<:W)" "$(>:W)"', 361 | + function=android_compile_cpp, 362 | + bound_list=['PCH_FILE']) 363 | + 364 | +engine.register_action( 365 | + 'android.compile.c', 366 | + '"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) ' + 367 | + '-I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"', 368 | + function=android_compile_c, 369 | + bound_list=['PCH_FILE']) 370 | + 371 | +def android_compile_asm(targets, sources, properties): 372 | + get_manager().engine().set_target_variable(targets, 'LANG', '-x assembler-with-cpp') 373 | + 374 | +engine.register_action( 375 | + 'android.compile.asm', 376 | + '"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"', 377 | + function=android_compile_asm) 378 | + 379 | + 380 | +class androidLinkingGenerator(unix.UnixLinkingGenerator): 381 | + """ 382 | + The class which check that we don't try to use the static 383 | + property while creating or using shared library, since it's not supported by 384 | + android/libc. 385 | + """ 386 | + def run(self, project, name, prop_set, sources): 387 | + # TODO: Replace this with the use of a target-os property. 388 | + 389 | + no_static_link = False 390 | + if bjam.variable('UNIX'): 391 | + no_static_link = True; 392 | + ##FIXME: what does this mean? 393 | +## { 394 | +## switch [ modules.peek : JAMUNAME ] 395 | +## { 396 | +## case * : no-static-link = true ; 397 | +## } 398 | +## } 399 | + 400 | + properties = prop_set.raw() 401 | + reason = None 402 | + if no_static_link and 'static' in properties: 403 | + if 'shared' in properties: 404 | + reason = "On android, DLL can't be build with 'static'." 405 | + elif type.is_derived(self.target_types[0], 'EXE'): 406 | + for s in sources: 407 | + source_type = s.type() 408 | + if source_type and type.is_derived(source_type, 'SHARED_LIB'): 409 | + reason = "On android, using DLLS together with the " +\ 410 | + "static options is not possible " 411 | + if reason: 412 | + print 'warning:', reason 413 | + print 'warning:',\ 414 | + "It is suggested to use 'static' together",\ 415 | + "with 'static'." ; 416 | + return 417 | + else: 418 | + generated_targets = unix.UnixLinkingGenerator.run(self, project, 419 | + name, prop_set, sources) 420 | + return generated_targets 421 | + 422 | +if on_windows(): 423 | + flags('android.link.dll', '.IMPLIB-COMMAND', [], ['-Wl,--out-implib,']) 424 | + generators.register( 425 | + androidLinkingGenerator('android.link', True, 426 | + ['OBJ', 'SEARCHED_LIB', 'STATIC_LIB', 'IMPORT_LIB'], 427 | + [ 'EXE' ], 428 | + [ 'android' ])) 429 | + generators.register( 430 | + androidLinkingGenerator('android.link.dll', True, 431 | + ['OBJ', 'SEARCHED_LIB', 'STATIC_LIB', 'IMPORT_LIB'], 432 | + ['IMPORT_LIB', 'SHARED_LIB'], 433 | + ['android'])) 434 | +else: 435 | + generators.register( 436 | + androidLinkingGenerator('android.link', True, 437 | + ['LIB', 'OBJ'], 438 | + ['EXE'], 439 | + ['android'])) 440 | + generators.register( 441 | + androidLinkingGenerator('android.link.dll', True, 442 | + ['LIB', 'OBJ'], 443 | + ['SHARED_LIB'], 444 | + ['android'])) 445 | + 446 | +# Declare flags for linking. 447 | +# First, the common flags. 448 | +flags('android.link', 'OPTIONS', ['on'], ['-g']) 449 | +flags('android.link', 'OPTIONS', ['on'], ['-pg']) 450 | +flags('android.link', 'USER_OPTIONS', [], ['']) 451 | +flags('android.link', 'LINKPATH', [], ['']) 452 | +flags('android.link', 'FINDLIBS-ST', [], ['']) 453 | +flags('android.link', 'FINDLIBS-SA', [], ['']) 454 | +flags('android.link', 'LIBRARIES', [], ['']) 455 | + 456 | +# For static we made sure there are no dynamic libraries in the 457 | +# link. On HP-UX not all system libraries exist as archived libraries (for 458 | +# example, there is no libunwind.a), so, on this platform, the -static option 459 | +# cannot be specified. 460 | +if os_name() != 'HPUX': 461 | + flags('android.link', 'OPTIONS', ['static'], ['-static']) 462 | + 463 | +# Now, the vendor specific flags. 464 | +# The parameter linker can be either gnu, darwin, osf, hpux or sun. 465 | +def init_link_flags(toolset, linker, condition): 466 | + """ 467 | + Now, the vendor specific flags. 468 | + The parameter linker can be either gnu, darwin, osf, hpux or sun. 469 | + """ 470 | + toolset_link = toolset + '.link' 471 | + if linker == 'gnu': 472 | + # Strip the binary when no debugging is needed. We use --strip-all flag 473 | + # as opposed to -s since icc (intel's compiler) is generally 474 | + # option-compatible with and inherits from the android toolset, but does not 475 | + # support -s. 476 | + 477 | + # FIXME: what does unchecked translate to? 478 | + flags(toolset_link, 'OPTIONS', map(lambda x: x + '/off', condition), ['-Wl,--strip-all']) # : unchecked ; 479 | + flags(toolset_link, 'RPATH', condition, ['']) # : unchecked ; 480 | + flags(toolset_link, 'RPATH_LINK', condition, ['']) # : unchecked ; 481 | + flags(toolset_link, 'START-GROUP', condition, ['-Wl,--start-group'])# : unchecked ; 482 | + flags(toolset_link, 'END-GROUP', condition, ['-Wl,--end-group']) # : unchecked ; 483 | + 484 | + # gnu ld has the ability to change the search behaviour for libraries 485 | + # referenced by -l switch. These modifiers are -Bstatic and -Bdynamic 486 | + # and change search for -l switches that follow them. The following list 487 | + # shows the tried variants. 488 | + # The search stops at the first variant that has a match. 489 | + # *nix: -Bstatic -lxxx 490 | + # libxxx.a 491 | + # 492 | + # *nix: -Bdynamic -lxxx 493 | + # libxxx.so 494 | + # libxxx.a 495 | + # 496 | + # windows (mingw,cygwin) -Bstatic -lxxx 497 | + # libxxx.a 498 | + # xxx.lib 499 | + # 500 | + # windows (mingw,cygwin) -Bdynamic -lxxx 501 | + # libxxx.dll.a 502 | + # xxx.dll.a 503 | + # libxxx.a 504 | + # xxx.lib 505 | + # cygxxx.dll (*) 506 | + # libxxx.dll 507 | + # xxx.dll 508 | + # libxxx.a 509 | + # 510 | + # (*) This is for cygwin 511 | + # Please note that -Bstatic and -Bdynamic are not a guarantee that a 512 | + # static or dynamic lib indeed gets linked in. The switches only change 513 | + # search patterns! 514 | + 515 | + # On *nix mixing shared libs with static runtime is not a good idea. 516 | + flags(toolset_link, 'FINDLIBS-ST-PFX', 517 | + map(lambda x: x + '/shared', condition), 518 | + ['-Wl,-Bstatic']) # : unchecked ; 519 | + flags(toolset_link, 'FINDLIBS-SA-PFX', 520 | + map(lambda x: x + '/shared', condition), 521 | + ['-Wl,-Bdynamic']) # : unchecked ; 522 | + 523 | + # On windows allow mixing of static and dynamic libs with static 524 | + # runtime. 525 | + flags(toolset_link, 'FINDLIBS-ST-PFX', 526 | + map(lambda x: x + '/static/windows', condition), 527 | + ['-Wl,-Bstatic']) # : unchecked ; 528 | + flags(toolset_link, 'FINDLIBS-SA-PFX', 529 | + map(lambda x: x + '/static/windows', condition), 530 | + ['-Wl,-Bdynamic']) # : unchecked ; 531 | + flags(toolset_link, 'OPTIONS', 532 | + map(lambda x: x + '/static/windows', condition), 533 | + ['-Wl,-Bstatic']) # : unchecked ; 534 | + 535 | + elif linker == 'darwin': 536 | + # On Darwin, the -s option to ld does not work unless we pass -static, 537 | + # and passing -static unconditionally is a bad idea. So, don't pass -s. 538 | + # at all, darwin.jam will use separate 'strip' invocation. 539 | + flags(toolset_link, 'RPATH', condition, ['']) # : unchecked ; 540 | + flags(toolset_link, 'RPATH_LINK', condition, ['']) # : unchecked ; 541 | + 542 | + elif linker == 'osf': 543 | + # No --strip-all, just -s. 544 | + flags(toolset_link, 'OPTIONS', map(lambda x: x + '/off', condition), ['-Wl,-s']) 545 | + # : unchecked ; 546 | + flags(toolset_link, 'RPATH', condition, ['']) # : unchecked ; 547 | + # This does not supports -R. 548 | + flags(toolset_link, 'RPATH_OPTION', condition, ['-rpath']) # : unchecked ; 549 | + # -rpath-link is not supported at all. 550 | + 551 | + elif linker == 'sun': 552 | + flags(toolset_link, 'OPTIONS', map(lambda x: x + '/off', condition), ['-Wl,-s']) 553 | + # : unchecked ; 554 | + flags(toolset_link, 'RPATH', condition, ['']) # : unchecked ; 555 | + # Solaris linker does not have a separate -rpath-link, but allows to use 556 | + # -L for the same purpose. 557 | + flags(toolset_link, 'LINKPATH', condition, ['']) # : unchecked ; 558 | + 559 | + # This permits shared libraries with non-PIC code on Solaris. 560 | + # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the 561 | + # following is not needed. Whether -fPIC should be hardcoded, is a 562 | + # separate question. 563 | + # AH, 2004/10/16: it is still necessary because some tests link against 564 | + # static libraries that were compiled without PIC. 565 | + flags(toolset_link, 'OPTIONS', map(lambda x: x + '/shared', condition), ['-mimpure-text']) 566 | + # : unchecked ; 567 | + 568 | + elif linker == 'hpux': 569 | + flags(toolset_link, 'OPTIONS', map(lambda x: x + '/off', condition), 570 | + ['-Wl,-s']) # : unchecked ; 571 | + flags(toolset_link, 'OPTIONS', map(lambda x: x + '/shared', condition), 572 | + ['-fPIC']) # : unchecked ; 573 | + 574 | + else: 575 | + # FIXME: 576 | + errors.user_error( 577 | + "$(toolset) initialization: invalid linker '$(linker)' " + 578 | + "The value '$(linker)' specified for is not recognized. " + 579 | + "Possible values are 'gnu', 'darwin', 'osf', 'hpux' or 'sun'") 580 | + 581 | +# Declare actions for linking. 582 | +def android_link(targets, sources, properties): 583 | + engine = get_manager().engine() 584 | + engine.set_target_variable(targets, 'SPACE', ' ') 585 | + # Serialize execution of the 'link' action, since running N links in 586 | + # parallel is just slower. For now, serialize only android links, it might be a 587 | + # good idea to serialize all links. 588 | + engine.set_target_variable(targets, 'JAM_SEMAPHORE', 'android-link-semaphore') 589 | + 590 | +engine.register_action( 591 | + 'android.link', 592 | + '"$(CONFIG_COMMAND)" -L"$(LINKPATH)" ' + 593 | + '-Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" ' + 594 | + '-Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" ' + 595 | + '$(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) ' + 596 | + '-l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) ' + 597 | + '$(OPTIONS) $(USER_OPTIONS)', 598 | + function=android_link, 599 | + bound_list=['LIBRARIES']) 600 | + 601 | +# Default value. Mostly for the sake of intel-linux that inherits from android, but 602 | +# does not have the same logic to set the .AR variable. We can put the same 603 | +# logic in intel-linux, but that's hardly worth the trouble as on Linux, 'ar' is 604 | +# always available. 605 | +__AR = 'ar' 606 | + 607 | +flags('android.archive', 'AROPTIONS', [], ['']) 608 | + 609 | +def android_archive(targets, sources, properties): 610 | + # Always remove archive and start again. Here's rationale from 611 | + # 612 | + # Andre Hentz: 613 | + # 614 | + # I had a file, say a1.c, that was included into liba.a. I moved a1.c to 615 | + # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd 616 | + # errors. After some debugging I traced it back to the fact that a1.o was 617 | + # *still* in liba.a 618 | + # 619 | + # Rene Rivera: 620 | + # 621 | + # Originally removing the archive was done by splicing an RM onto the 622 | + # archive action. That makes archives fail to build on NT when they have 623 | + # many files because it will no longer execute the action directly and blow 624 | + # the line length limit. Instead we remove the file in a different action, 625 | + # just before building the archive. 626 | + clean = targets[0] + '(clean)' 627 | + bjam.call('TEMPORARY', clean) 628 | + bjam.call('NOCARE', clean) 629 | + engine = get_manager().engine() 630 | + engine.set_target_variable('LOCATE', clean, bjam.call('get-target-variable', targets, 'LOCATE')) 631 | + engine.add_dependency(clean, sources) 632 | + engine.add_dependency(targets, clean) 633 | + engine.set_update_action('common.RmTemps', clean, targets, None) 634 | + 635 | +# Declare action for creating static libraries. 636 | +# The letter 'r' means to add files to the archive with replacement. Since we 637 | +# remove archive, we don't care about replacement, but there's no option "add 638 | +# without replacement". 639 | +# The letter 'c' suppresses the warning in case the archive does not exists yet. 640 | +# That warning is produced only on some platforms, for whatever reasons. 641 | +engine.register_action('android.archive', 642 | + '"$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"', 643 | + function=android_archive, 644 | + flags=['piecemeal']) 645 | + 646 | +def android_link_dll(targets, sources, properties): 647 | + engine = get_manager().engine() 648 | + engine.set_target_variable(targets, 'SPACE', ' ') 649 | + engine.set_target_variable(targets, 'JAM_SEMAPHORE', 'android-link-semaphore') 650 | + 651 | +engine.register_action( 652 | + 'android.link.dll', 653 | + # Differ from 'link' above only by -shared. 654 | + '"$(CONFIG_COMMAND)" -L"$(LINKPATH)" ' + 655 | + '-Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" ' + 656 | + '"$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" ' + 657 | + '$(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) ' + 658 | + '-shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) ' + 659 | + '-l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) ' + 660 | + '$(OPTIONS) $(USER_OPTIONS)', 661 | + function = android_link_dll, 662 | + bound_list=['LIBRARIES']) 663 | + 664 | +# Set up threading support. It's somewhat contrived, so perform it at the end, 665 | +# to avoid cluttering other code. 666 | + 667 | +if on_windows(): 668 | + flags('android', 'OPTIONS', ['multi'], ['-mthreads']) 669 | +elif bjam.variable('UNIX'): 670 | + jamuname = bjam.variable('JAMUNAME') 671 | + host_os_name = jamuname[0] 672 | + print "MOSSS>>> host_os_name:", host_os_name 673 | + if host_os_name.startswith('SunOS'): 674 | + #flags('android', 'OPTIONS', ['multi'], ['-pthreads']) 675 | + #flags('android', 'FINDLIBS-SA', [], ['rt']) 676 | + elif host_os_name == 'BeOS': 677 | + # BeOS has no threading options, don't set anything here. 678 | + pass 679 | + elif host_os_name.endswith('BSD'): 680 | + #flags('android', 'OPTIONS', ['multi'], ['-pthread']) 681 | + # there is no -lrt on BSD 682 | + elif host_os_name == 'DragonFly': 683 | + #flags('android', 'OPTIONS', ['multi'], ['-pthread']) 684 | + # there is no -lrt on BSD - DragonFly is a FreeBSD variant, 685 | + # which anoyingly doesn't say it's a *BSD. 686 | + elif host_os_name == 'IRIX': 687 | + # android on IRIX does not support multi-threading, don't set anything here. 688 | + pass 689 | + elif host_os_name == 'Darwin': 690 | + # Darwin has no threading options, don't set anything here. 691 | + pass 692 | + else: 693 | + #flags('android', 'OPTIONS', ['multi'], ['-pthread']) 694 | + #flags('android', 'FINDLIBS-SA', [], ['rt']) 695 | + 696 | +def cpu_flags(toolset, variable, architecture, instruction_set, values, default=None): 697 | + #FIXME: for some reason this fails. Probably out of date feature code 698 | +## if default: 699 | +## flags(toolset, variable, 700 | +## ['' + architecture + '/'], 701 | +## values) 702 | + flags(toolset, variable, 703 | + #FIXME: same as above 704 | + [##'/' + instruction_set, 705 | + '' + architecture + '/' + instruction_set], 706 | + values) 707 | + 708 | +# Set architecture/instruction-set options. 709 | +# 710 | +# x86 and compatible 711 | +flags('android', 'OPTIONS', ['x86/32'], ['-m32']) 712 | +flags('android', 'OPTIONS', ['x86/64'], ['-m64']) 713 | +cpu_flags('android', 'OPTIONS', 'x86', 'i386', ['-march=i386'], default=True) 714 | +cpu_flags('android', 'OPTIONS', 'x86', 'i486', ['-march=i486']) 715 | +cpu_flags('android', 'OPTIONS', 'x86', 'i586', ['-march=i586']) 716 | +cpu_flags('android', 'OPTIONS', 'x86', 'i686', ['-march=i686']) 717 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium', ['-march=pentium']) 718 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium-mmx', ['-march=pentium-mmx']) 719 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentiumpro', ['-march=pentiumpro']) 720 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium2', ['-march=pentium2']) 721 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium3', ['-march=pentium3']) 722 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium3m', ['-march=pentium3m']) 723 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium-m', ['-march=pentium-m']) 724 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium4', ['-march=pentium4']) 725 | +cpu_flags('android', 'OPTIONS', 'x86', 'pentium4m', ['-march=pentium4m']) 726 | +cpu_flags('android', 'OPTIONS', 'x86', 'prescott', ['-march=prescott']) 727 | +cpu_flags('android', 'OPTIONS', 'x86', 'nocona', ['-march=nocona']) 728 | +cpu_flags('android', 'OPTIONS', 'x86', 'k6', ['-march=k6']) 729 | +cpu_flags('android', 'OPTIONS', 'x86', 'k6-2', ['-march=k6-2']) 730 | +cpu_flags('android', 'OPTIONS', 'x86', 'k6-3', ['-march=k6-3']) 731 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon', ['-march=athlon']) 732 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon-tbird', ['-march=athlon-tbird']) 733 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon-4', ['-march=athlon-4']) 734 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon-xp', ['-march=athlon-xp']) 735 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon-mp', ['-march=athlon-mp']) 736 | +## 737 | +cpu_flags('android', 'OPTIONS', 'x86', 'k8', ['-march=k8']) 738 | +cpu_flags('android', 'OPTIONS', 'x86', 'opteron', ['-march=opteron']) 739 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon64', ['-march=athlon64']) 740 | +cpu_flags('android', 'OPTIONS', 'x86', 'athlon-fx', ['-march=athlon-fx']) 741 | +cpu_flags('android', 'OPTIONS', 'x86', 'winchip-c6', ['-march=winchip-c6']) 742 | +cpu_flags('android', 'OPTIONS', 'x86', 'winchip2', ['-march=winchip2']) 743 | +cpu_flags('android', 'OPTIONS', 'x86', 'c3', ['-march=c3']) 744 | +cpu_flags('android', 'OPTIONS', 'x86', 'c3-2', ['-march=c3-2']) 745 | +# Sparc 746 | +flags('android', 'OPTIONS', ['sparc/32'], ['-m32']) 747 | +flags('android', 'OPTIONS', ['sparc/64'], ['-m64']) 748 | +cpu_flags('android', 'OPTIONS', 'sparc', 'c3', ['-mcpu=c3'], default=True) 749 | +cpu_flags('android', 'OPTIONS', 'sparc', 'v7', ['-mcpu=v7']) 750 | +cpu_flags('android', 'OPTIONS', 'sparc', 'cypress', ['-mcpu=cypress']) 751 | +cpu_flags('android', 'OPTIONS', 'sparc', 'v8', ['-mcpu=v8']) 752 | +cpu_flags('android', 'OPTIONS', 'sparc', 'supersparc', ['-mcpu=supersparc']) 753 | +cpu_flags('android', 'OPTIONS', 'sparc', 'sparclite', ['-mcpu=sparclite']) 754 | +cpu_flags('android', 'OPTIONS', 'sparc', 'hypersparc', ['-mcpu=hypersparc']) 755 | +cpu_flags('android', 'OPTIONS', 'sparc', 'sparclite86x', ['-mcpu=sparclite86x']) 756 | +cpu_flags('android', 'OPTIONS', 'sparc', 'f930', ['-mcpu=f930']) 757 | +cpu_flags('android', 'OPTIONS', 'sparc', 'f934', ['-mcpu=f934']) 758 | +cpu_flags('android', 'OPTIONS', 'sparc', 'sparclet', ['-mcpu=sparclet']) 759 | +cpu_flags('android', 'OPTIONS', 'sparc', 'tsc701', ['-mcpu=tsc701']) 760 | +cpu_flags('android', 'OPTIONS', 'sparc', 'v9', ['-mcpu=v9']) 761 | +cpu_flags('android', 'OPTIONS', 'sparc', 'ultrasparc', ['-mcpu=ultrasparc']) 762 | +cpu_flags('android', 'OPTIONS', 'sparc', 'ultrasparc3', ['-mcpu=ultrasparc3']) 763 | +# RS/6000 & PowerPC 764 | +flags('android', 'OPTIONS', ['power/32'], ['-m32']) 765 | +flags('android', 'OPTIONS', ['power/64'], ['-m64']) 766 | +cpu_flags('android', 'OPTIONS', 'power', '403', ['-mcpu=403']) 767 | +cpu_flags('android', 'OPTIONS', 'power', '505', ['-mcpu=505']) 768 | +cpu_flags('android', 'OPTIONS', 'power', '601', ['-mcpu=601']) 769 | +cpu_flags('android', 'OPTIONS', 'power', '602', ['-mcpu=602']) 770 | +cpu_flags('android', 'OPTIONS', 'power', '603', ['-mcpu=603']) 771 | +cpu_flags('android', 'OPTIONS', 'power', '603e', ['-mcpu=603e']) 772 | +cpu_flags('android', 'OPTIONS', 'power', '604', ['-mcpu=604']) 773 | +cpu_flags('android', 'OPTIONS', 'power', '604e', ['-mcpu=604e']) 774 | +cpu_flags('android', 'OPTIONS', 'power', '620', ['-mcpu=620']) 775 | +cpu_flags('android', 'OPTIONS', 'power', '630', ['-mcpu=630']) 776 | +cpu_flags('android', 'OPTIONS', 'power', '740', ['-mcpu=740']) 777 | +cpu_flags('android', 'OPTIONS', 'power', '7400', ['-mcpu=7400']) 778 | +cpu_flags('android', 'OPTIONS', 'power', '7450', ['-mcpu=7450']) 779 | +cpu_flags('android', 'OPTIONS', 'power', '750', ['-mcpu=750']) 780 | +cpu_flags('android', 'OPTIONS', 'power', '801', ['-mcpu=801']) 781 | +cpu_flags('android', 'OPTIONS', 'power', '821', ['-mcpu=821']) 782 | +cpu_flags('android', 'OPTIONS', 'power', '823', ['-mcpu=823']) 783 | +cpu_flags('android', 'OPTIONS', 'power', '860', ['-mcpu=860']) 784 | +cpu_flags('android', 'OPTIONS', 'power', '970', ['-mcpu=970']) 785 | +cpu_flags('android', 'OPTIONS', 'power', '8540', ['-mcpu=8540']) 786 | +cpu_flags('android', 'OPTIONS', 'power', 'power', ['-mcpu=power']) 787 | +cpu_flags('android', 'OPTIONS', 'power', 'power2', ['-mcpu=power2']) 788 | +cpu_flags('android', 'OPTIONS', 'power', 'power3', ['-mcpu=power3']) 789 | +cpu_flags('android', 'OPTIONS', 'power', 'power4', ['-mcpu=power4']) 790 | +cpu_flags('android', 'OPTIONS', 'power', 'power5', ['-mcpu=power5']) 791 | +cpu_flags('android', 'OPTIONS', 'power', 'powerpc', ['-mcpu=powerpc']) 792 | +cpu_flags('android', 'OPTIONS', 'power', 'powerpc64', ['-mcpu=powerpc64']) 793 | +cpu_flags('android', 'OPTIONS', 'power', 'rios', ['-mcpu=rios']) 794 | +cpu_flags('android', 'OPTIONS', 'power', 'rios1', ['-mcpu=rios1']) 795 | +cpu_flags('android', 'OPTIONS', 'power', 'rios2', ['-mcpu=rios2']) 796 | +cpu_flags('android', 'OPTIONS', 'power', 'rsc', ['-mcpu=rsc']) 797 | +cpu_flags('android', 'OPTIONS', 'power', 'rs64a', ['-mcpu=rs64']) 798 | +# AIX variant of RS/6000 & PowerPC 799 | +flags('android', 'OPTIONS', ['power/32/aix'], ['-maix32']) 800 | +flags('android', 'OPTIONS', ['power/64/aix'], ['-maix64']) 801 | +flags('android', 'AROPTIONS', ['power/64/aix'], ['-X 64']) 802 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/endian.hpp.patch: -------------------------------------------------------------------------------- 1 | diff -u -r boost_1_45_0-old/boost/detail/endian.hpp boost_1_45_0/boost/detail/endian.hpp 2 | --- boost_1_45_0-old/boost/detail/endian.hpp 2010-11-17 11:51:56.000000000 +0200 3 | +++ boost_1_45_0/boost/detail/endian.hpp 2011-07-28 13:51:36.988916179 +0300 4 | @@ -31,7 +31,7 @@ 5 | // GNU libc offers the helpful header which defines 6 | // __BYTE_ORDER 7 | 8 | -#if defined (__GLIBC__) 9 | +#if defined (__GLIBC__) || defined(ANDROID) 10 | # include 11 | # if (__BYTE_ORDER == __LITTLE_ENDIAN) 12 | # define BOOST_LITTLE_ENDIAN 13 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/fenced_block.hpp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/boost/asio/detail/fenced_block.hpp 2010-07-12 02:42:34.000000000 +0300 2 | +++ boost_1_45_0/boost/asio/detail/fenced_block.hpp 2011-06-06 15:29:57.777421112 +0300 3 | @@ -25,14 +25,15 @@ 4 | # include 5 | #elif defined(__sun) 6 | # include 7 | -#elif defined(__GNUC__) && defined(__arm__) 8 | +#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__) 9 | # include 10 | #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) 11 | # include 12 | #elif defined(__GNUC__) \ 13 | && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ 14 | && !defined(__INTEL_COMPILER) && !defined(__ICL) \ 15 | - && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) 16 | + && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) \ 17 | + && !defined(ANDROID) && !defined(__ANDROID__) 18 | # include 19 | #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 20 | # include 21 | @@ -54,14 +55,15 @@ 22 | typedef macos_fenced_block fenced_block; 23 | #elif defined(__sun) 24 | typedef solaris_fenced_block fenced_block; 25 | -#elif defined(__GNUC__) && defined(__arm__) 26 | +#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__) 27 | typedef gcc_arm_fenced_block fenced_block; 28 | #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) 29 | typedef gcc_hppa_fenced_block fenced_block; 30 | #elif defined(__GNUC__) \ 31 | && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ 32 | && !defined(__INTEL_COMPILER) && !defined(__ICL) \ 33 | - && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) 34 | + && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) \ 35 | + && !defined(ANDROID) && !defined(__ANDROID__) 36 | typedef gcc_sync_fenced_block fenced_block; 37 | #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 38 | typedef gcc_x86_fenced_block fenced_block; 39 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/operations.cpp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/libs/filesystem/v3/src/operations.cpp 2010-10-16 16:09:25.000000000 +0300 2 | +++ boost_1_45_0/libs/filesystem/v3/src/operations.cpp 2011-06-06 15:29:57.787421112 +0300 3 | @@ -66,13 +66,15 @@ 4 | # ifdef BOOST_POSIX_API 5 | 6 | # include 7 | -# if !defined(__APPLE__) && !defined(__OpenBSD__) 8 | +# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(ANDROID) 9 | # include 10 | # define BOOST_STATVFS statvfs 11 | # define BOOST_STATVFS_F_FRSIZE vfs.f_frsize 12 | # else 13 | # ifdef __OpenBSD__ 14 | # include 15 | +# elif defined(__ANDROID__) || defined(ANDROID) // @Moss - Android messes up a bit with some headers, this one is the correct one :D 16 | +# include 17 | # endif 18 | # include 19 | # define BOOST_STATVFS statfs 20 | @@ -201,7 +203,19 @@ 21 | || ::mkdir(to.c_str(),from_stat.st_mode)!= 0)) 22 | # define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool) 23 | # define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0) 24 | +#if defined(__ANDROID__) || defined(ANDROID) 25 | + int BOOST_RESIZE_FILE(const char *path, off_t size) 26 | + { 27 | + int result = -1; 28 | + int fd = open(path, O_WRONLY); 29 | + if (fd != -1) 30 | + result = ftruncate(fd, size); 31 | + close(fd); 32 | + return result; 33 | + } 34 | +#else 35 | # define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0) 36 | +#endif 37 | 38 | # define BOOST_ERROR_NOT_SUPPORTED ENOSYS 39 | # define BOOST_ERROR_ALREADY_EXISTS EEXIST 40 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/socket_types.hpp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/boost/asio/detail/socket_types.hpp 2010-10-17 15:24:50.000000000 +0300 2 | +++ boost_1_45_0/boost/asio/detail/socket_types.hpp 2011-06-06 15:29:57.777421112 +0300 3 | @@ -122,7 +122,12 @@ 4 | typedef int socket_type; 5 | const int invalid_socket = -1; 6 | const int socket_error_retval = -1; 7 | +// @Moss - Some platforms do not define it (Android) 8 | +#if defined(INET_ADDRSTRLEN) 9 | const int max_addr_v4_str_len = INET_ADDRSTRLEN; 10 | +#else // defined(INET_ADDRSTRLEN) 11 | +const int max_addr_v4_str_len = 16; 12 | +#endif // defined(INET_ADDRSTRLEN) 13 | #if defined(INET6_ADDRSTRLEN) 14 | const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE; 15 | #else // defined(INET6_ADDRSTRLEN) 16 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/user.hpp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/boost/config/user.hpp 2004-01-10 14:10:00.000000000 +0200 2 | +++ boost_1_45_0/boost/config/user.hpp 2011-06-06 15:29:57.797421112 +0300 3 | @@ -13,6 +13,15 @@ 4 | // configuration policy: 5 | // 6 | 7 | +// Android defines 8 | +#define __arm__ 1 9 | +#define _REENTRANT 1 10 | +#define _GLIBCXX__PTHREADS 1 11 | +// There is problem with std::atomic on android (and some other platforms). 12 | +// See this link for more info: 13 | +// https://code.google.com/p/android/issues/detail?id=42735#makechanges 14 | +#define BOOST_ASIO_DISABLE_STD_ATOMIC 1 15 | + 16 | // define this to locate a compiler config file: 17 | // #define BOOST_COMPILER_CONFIG 18 | 19 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/v2_operations.cpp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/libs/filesystem/v2/src/v2_operations.cpp 2010-08-10 23:00:09.000000000 +0300 2 | +++ boost_1_45_0/libs/filesystem/v2/src/v2_operations.cpp 2011-06-06 15:29:57.777421112 +0300 3 | @@ -58,13 +58,15 @@ 4 | 5 | # else // BOOST_POSIX_API 6 | # include 7 | -# if !defined(__APPLE__) && !defined(__OpenBSD__) 8 | +# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(ANDROID) 9 | # include 10 | # define BOOST_STATVFS statvfs 11 | # define BOOST_STATVFS_F_FRSIZE vfs.f_frsize 12 | # else 13 | #ifdef __OpenBSD__ 14 | # include 15 | +#elif defined(__ANDROID__) || defined(ANDROID) // @Moss - Android messes up a bit with some headers, this one is the correct one :D 16 | +# include 17 | #endif 18 | # include 19 | # define BOOST_STATVFS statfs 20 | @@ -1262,7 +1264,11 @@ 21 | if ( max == 0 ) 22 | { 23 | errno = 0; 24 | +# ifdef __ANDROID__ || ANDROID 25 | + long tmp = 4096; 26 | +# else 27 | long tmp = ::pathconf( "/", _PC_NAME_MAX ); 28 | +# endif 29 | if ( tmp < 0 ) 30 | { 31 | if ( errno == 0 ) // indeterminate 32 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_45_0/workaround.hpp.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_45_0-old/boost/interprocess/detail/workaround.hpp 2010-10-12 21:18:42.000000000 +0300 2 | +++ boost_1_45_0/boost/interprocess/detail/workaround.hpp 2011-06-06 15:29:57.797421112 +0300 3 | @@ -64,7 +64,7 @@ 4 | #endif 5 | 6 | //Check for XSI shared memory objects. They are available in nearly all UNIX platforms 7 | - #if !defined(__QNXNTO__) 8 | + #if !defined(__QNXNTO__) && !defined(ANDROID) 9 | # define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_53_0/boost-1_53_0.patch: -------------------------------------------------------------------------------- 1 | --- boost_1_53_0-boot/libs/locale/build/Jamfile.v2 2013-11-25 01:16:41.401893635 +0200 2 | +++ boost_1_53_0/libs/locale/build/Jamfile.v2 2013-11-25 01:16:55.810101872 +0200 3 | @@ -185,7 +185,7 @@ 4 | obj has_icu_obj : ../build/has_icu_test.cpp : $(ICU_OPTS) ; 5 | obj has_icu64_obj : ../build/has_icu_test.cpp : $(ICU64_OPTS) ; 6 | 7 | -exe has_icu : has_icu_obj : $(ICU_OPTS) ; 8 | +lib has_icu : ../build/option.cpp : static ; 9 | exe has_icu64 : has_icu64_obj : $(ICU64_OPTS) ; 10 | 11 | explicit has_icu has_icu64 ; 12 | diff -ruN boost_1_54_0/libs/filesystem/src/path.cpp boost_1_54_0_patched/libs/filesystem/src/path.cpp 13 | --- boost_1_54_0/libs/filesystem/src/path.cpp 2012-04-16 15:36:28.000000000 +0200 14 | +++ boost_1_54_0_patched/libs/filesystem/src/path.cpp 2013-10-28 02:55:32.773380890 +0100 15 | @@ -902,7 +902,7 @@ 16 | 17 | const path::codecvt_type& path::codecvt() 18 | { 19 | -# if defined(BOOST_POSIX_API) && \ 20 | +# if defined(BOOST_POSIX_API) && !defined(__ANDROID__) && \ 21 | !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) 22 | // A local static initialized by calling path::imbue ensures that std::locale(""), 23 | // which may throw, is called only if path_locale and condecvt_facet will actually 24 | diff -ruN boost_1_53_0-boot/boost/asio/detail/socket_types.hpp boost_1_53_0-patched/boost/asio/detail/socket_types.hpp 25 | --- boost_1_53_0-boot/boost/asio/detail/socket_types.hpp 2012-01-15 14:46:25.000000000 +0100 26 | +++ boost_1_53_0-patched/boost/asio/detail/socket_types.hpp 2012-06-27 19:19:01.279562338 +0200 27 | @@ -123,7 +123,12 @@ 28 | typedef int socket_type; 29 | const int invalid_socket = -1; 30 | const int socket_error_retval = -1; 31 | +// @Moss - Some platforms do not define it (Android) 32 | +#if defined(INET_ADDRSTRLEN) 33 | const int max_addr_v4_str_len = INET_ADDRSTRLEN; 34 | +#else // defined(INET_ADDRSTRLEN) 35 | +const int max_addr_v4_str_len = 16; 36 | +#endif // defined(INET_ADDRSTRLEN) 37 | #if defined(INET6_ADDRSTRLEN) 38 | const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE; 39 | #else // defined(INET6_ADDRSTRLEN) 40 | diff -ruN boost_1_53_0-boot/boost/asio/ip/impl/address_v6.ipp boost_1_53_0-patched/boost/asio/ip/impl/address_v6.ipp 41 | --- boost_1_53_0-boot/boost/asio/ip/impl/address_v6.ipp 2012-01-15 14:46:25.000000000 +0100 42 | +++ boost_1_53_0-patched/boost/asio/ip/impl/address_v6.ipp 2012-06-27 19:19:11.029581297 +0200 43 | @@ -11,6 +11,23 @@ 44 | #ifndef BOOST_ASIO_IP_IMPL_ADDRESS_V6_IPP 45 | #define BOOST_ASIO_IP_IMPL_ADDRESS_V6_IPP 46 | 47 | +// @Moss - Define IPv6 macros 48 | +#if !defined(IN6_IS_ADDR_MULTICAST) 49 | +#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) 50 | +#endif 51 | + 52 | +#if !defined(IN6_IS_ADDR_MC_NODELOCAL) 53 | +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ 54 | + (IN6_IS_ADDR_MULTICAST(a) \ 55 | + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1)) 56 | +#endif 57 | + 58 | +#if !defined(IN6_IS_ADDR_MC_GLOBAL) 59 | +#define IN6_IS_ADDR_MC_GLOBAL(a) \ 60 | + (IN6_IS_ADDR_MULTICAST(a) \ 61 | + && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe)) 62 | +#endif 63 | + 64 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 65 | # pragma once 66 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 67 | diff -ruN boost_1_53_0-boot/boost/config/user.hpp boost_1_53_0-patched/boost/config/user.hpp 68 | --- boost_1_53_0-boot/boost/config/user.hpp 2004-01-10 13:10:00.000000000 +0100 69 | +++ boost_1_53_0-patched/boost/config/user.hpp 2012-06-27 19:18:46.129532736 +0200 70 | @@ -13,6 +13,15 @@ 71 | // configuration policy: 72 | // 73 | 74 | +// Android defines 75 | +#define __arm__ 1 76 | +#define _REENTRANT 1 77 | +#define _GLIBCXX__PTHREADS 1 78 | +// There is problem with std::atomic on android (and some other platforms). 79 | +// See this link for more info: 80 | +// https://code.google.com/p/android/issues/detail?id=42735#makechanges 81 | +#define BOOST_ASIO_DISABLE_STD_ATOMIC 1 82 | + 83 | // define this to locate a compiler config file: 84 | // #define BOOST_COMPILER_CONFIG 85 | 86 | diff -ruN boost_1_53_0-boot/boost/detail/endian.hpp boost_1_53_0-patched/boost/detail/endian.hpp 87 | --- boost_1_53_0-boot/boost/detail/endian.hpp 2011-03-29 23:58:48.000000000 +0200 88 | +++ boost_1_53_0-patched/boost/detail/endian.hpp 2012-06-27 19:18:39.359519453 +0200 89 | @@ -31,7 +31,7 @@ 90 | // GNU libc offers the helpful header which defines 91 | // __BYTE_ORDER 92 | 93 | -#if defined (__GLIBC__) 94 | +#if defined (__GLIBC__) || defined(ANDROID) || defined(__ANDROID__) 95 | # include 96 | # if (__BYTE_ORDER == __LITTLE_ENDIAN) 97 | # define BOOST_LITTLE_ENDIAN 98 | diff -ruN boost_1_53_0-boot/boost/interprocess/detail/workaround.hpp boost_1_53_0-patched/boost/interprocess/detail/workaround.hpp 99 | --- boost_1_53_0-boot/boost/interprocess/detail/workaround.hpp 2011-12-26 18:21:36.000000000 +0100 100 | +++ boost_1_53_0-patched/boost/interprocess/detail/workaround.hpp 2012-06-27 19:18:52.909546004 +0200 101 | @@ -54,7 +54,7 @@ 102 | #endif 103 | 104 | //Check for XSI shared memory objects. They are available in nearly all UNIX platforms 105 | - #if !defined(__QNXNTO__) 106 | + #if !defined(__QNXNTO__) && !defined(ANDROID) && !defined(__ANDROID__) 107 | #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS 108 | #endif 109 | 110 | diff -ruN boost_1_53_0-boot/libs/filesystem/src/operations.cpp boost_1_53_0-patched/libs/filesystem/src/operations.cpp 111 | --- boost_1_53_0-boot/libs/filesystem/src/operations.cpp 2012-01-28 15:40:16.000000000 +0100 112 | +++ boost_1_53_0-patched/libs/filesystem/src/operations.cpp 2012-06-27 19:19:19.269597266 +0200 113 | @@ -73,13 +73,15 @@ 114 | const fs::path dot_dot_path(".."); 115 | # include 116 | # include 117 | -# if !defined(__APPLE__) && !defined(__OpenBSD__) 118 | +# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(ANDROID) 119 | # include 120 | # define BOOST_STATVFS statvfs 121 | # define BOOST_STATVFS_F_FRSIZE vfs.f_frsize 122 | # else 123 | # ifdef __OpenBSD__ 124 | # include 125 | +# elif defined(__ANDROID__) || defined(ANDROID) // @Moss - Android messes up a bit with some headers, this one is the correct one :D 126 | +# include 127 | # endif 128 | # include 129 | # define BOOST_STATVFS statfs 130 | @@ -206,7 +208,19 @@ 131 | || ::mkdir(to.c_str(),from_stat.st_mode)!= 0)) 132 | # define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool) 133 | # define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0) 134 | +#if defined(__ANDROID__) || defined(ANDROID) 135 | + int BOOST_RESIZE_FILE(const char *path, off_t size) 136 | + { 137 | + int result = -1; 138 | + int fd = open(path, O_WRONLY); 139 | + if (fd != -1) 140 | + result = ftruncate(fd, size); 141 | + close(fd); 142 | + return result; 143 | + } 144 | +#else 145 | # define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0) 146 | +#endif 147 | 148 | # define BOOST_ERROR_NOT_SUPPORTED ENOSYS 149 | # define BOOST_ERROR_ALREADY_EXISTS EEXIST 150 | -------------------------------------------------------------------------------- /third-party/Boost-for-Android/patches/boost-1_55_0/boost-1_55_0.patch: -------------------------------------------------------------------------------- 1 | diff -u -r boost_1_55_0/boost/asio/detail/socket_types.hpp boost_1_55_0.patched/boost/asio/detail/socket_types.hpp 2 | --- boost_1_55_0/boost/asio/detail/socket_types.hpp 3 | +++ boost_1_55_0.patched/boost/asio/detail/socket_types.hpp 4 | @@ -278,7 +278,12 @@ 5 | typedef int socket_type; 6 | const int invalid_socket = -1; 7 | const int socket_error_retval = -1; 8 | +// @Moss - Some platforms do not define it (Android) 9 | +#if defined(INET_ADDRSTRLEN) 10 | const int max_addr_v4_str_len = INET_ADDRSTRLEN; 11 | +#else // defined(INET_ADDRSTRLEN) 12 | +const int max_addr_v4_str_len = 16; 13 | +#endif // defined(INET_ADDRSTRLEN) 14 | #if defined(INET6_ADDRSTRLEN) 15 | const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE; 16 | #else // defined(INET6_ADDRSTRLEN) 17 | diff -u -r boost_1_55_0/boost/asio/ip/impl/address_v6.ipp boost_1_55_0.patched/boost/asio/ip/impl/address_v6.ipp 18 | --- boost_1_55_0/boost/asio/ip/impl/address_v6.ipp 19 | +++ boost_1_55_0.patched/boost/asio/ip/impl/address_v6.ipp 20 | @@ -11,6 +11,23 @@ 21 | #ifndef BOOST_ASIO_IP_IMPL_ADDRESS_V6_IPP 22 | #define BOOST_ASIO_IP_IMPL_ADDRESS_V6_IPP 23 | 24 | +// @Moss - Define IPv6 macros 25 | +#if !defined(IN6_IS_ADDR_MULTICAST) 26 | +#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff) 27 | +#endif 28 | + 29 | +#if !defined(IN6_IS_ADDR_MC_NODELOCAL) 30 | +#define IN6_IS_ADDR_MC_NODELOCAL(a) \ 31 | + (IN6_IS_ADDR_MULTICAST(a) \ 32 | + && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1)) 33 | +#endif 34 | + 35 | +#if !defined(IN6_IS_ADDR_MC_GLOBAL) 36 | +#define IN6_IS_ADDR_MC_GLOBAL(a) \ 37 | + (IN6_IS_ADDR_MULTICAST(a) \ 38 | + && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe)) 39 | +#endif 40 | + 41 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 42 | # pragma once 43 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 44 | diff -u -r boost_1_55_0/boost/config/user.hpp boost_1_55_0.patched/boost/config/user.hpp 45 | --- boost_1_55_0/boost/config/user.hpp 46 | +++ boost_1_55_0.patched/boost/config/user.hpp 47 | @@ -13,6 +13,14 @@ 48 | // configuration policy: 49 | // 50 | 51 | +// Android defines 52 | +#define _REENTRANT 1 53 | +#define _GLIBCXX__PTHREADS 1 54 | +// There is problem with std::atomic on android (and some other platforms). 55 | +// See this link for more info: 56 | +// https://code.google.com/p/android/issues/detail?id=42735#makechanges 57 | +#define BOOST_ASIO_DISABLE_STD_ATOMIC 1 58 | + 59 | // define this to locate a compiler config file: 60 | // #define BOOST_COMPILER_CONFIG 61 | 62 | diff -u -r boost_1_55_0/boost/interprocess/detail/workaround.hpp boost_1_55_0.patched/boost/interprocess/detail/workaround.hpp 63 | --- boost_1_55_0/boost/interprocess/detail/workaround.hpp 2013-09-16 19:01:45.000000000 +0200 64 | +++ boost_1_55_0.patched/boost/interprocess/detail/workaround.hpp 2013-11-29 17:51:33.111025389 +0100 65 | @@ -73,7 +73,7 @@ 66 | #endif 67 | 68 | //Check for XSI shared memory objects. They are available in nearly all UNIX platforms 69 | - #if !defined(__QNXNTO__) 70 | + #if !defined(__QNXNTO__) && !defined(ANDROID) && !defined(__ANDROID__) 71 | #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS 72 | #endif 73 | 74 | diff -u -r boost_1_55_0/boost/predef/other/endian.h boost_1_55_0.patched/boost/predef/other/endian.h 75 | --- boost_1_55_0/boost/predef/other/endian.h 76 | +++ boost_1_55_0.patched/boost/predef/other/endian.h 77 | @@ -53,7 +53,7 @@ 78 | */ 79 | #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ 80 | !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD 81 | -# if BOOST_LIB_C_GNU 82 | +# if BOOST_LIB_C_GNU || defined(ANDROID) || defined(__ANDROID__) 83 | # include 84 | # else 85 | # if BOOST_OS_MACOS 86 | diff -u -r boost_1_55_0/libs/filesystem/src/operations.cpp boost_1_55_0.patched/libs/filesystem/src/operations.cpp 87 | --- boost_1_55_0/libs/filesystem/src/operations.cpp 88 | +++ boost_1_55_0.patched/libs/filesystem/src/operations.cpp 89 | @@ -73,14 +73,14 @@ 90 | const fs::path dot_dot_path(".."); 91 | # include 92 | # include 93 | -# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__) 94 | +# if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(ANDROID) 95 | # include 96 | # define BOOST_STATVFS statvfs 97 | # define BOOST_STATVFS_F_FRSIZE vfs.f_frsize 98 | # else 99 | # ifdef __OpenBSD__ 100 | # include 101 | -# elif defined(__ANDROID__) 102 | +# elif defined(__ANDROID__) || defined(ANDROID) 103 | # include 104 | # endif 105 | # include 106 | @@ -208,7 +208,19 @@ 107 | || ::mkdir(to.c_str(),from_stat.st_mode)!= 0)) 108 | # define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool) 109 | # define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0) 110 | +#if defined(__ANDROID__) || defined(ANDROID) 111 | + int BOOST_RESIZE_FILE(const char *path, off_t size) 112 | + { 113 | + int result = -1; 114 | + int fd = open(path, O_WRONLY); 115 | + if (fd != -1) 116 | + result = ftruncate(fd, size); 117 | + close(fd); 118 | + return result; 119 | + } 120 | +#else 121 | # define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0) 122 | +#endif 123 | 124 | # define BOOST_ERROR_NOT_SUPPORTED ENOSYS 125 | # define BOOST_ERROR_ALREADY_EXISTS EEXIST 126 | --------------------------------------------------------------------------------