diff --git a/src/gbm_wrapper.c b/hook/hook.c similarity index 56% rename from src/gbm_wrapper.c rename to hook/hook.c index 6b86a9f..534913b 100644 --- a/src/gbm_wrapper.c +++ b/hook/hook.c @@ -26,12 +26,119 @@ #include #include -#include "gbm.h" +#ifdef HAS_GBM +#include +#endif + +#ifdef HAS_X11_EGL +#include + +#include +#include + +#include +#include +#endif + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) +#endif #ifndef DRM_FORMAT_MOD_INVALID #define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1) #endif +/* A stub symbol to ensure that the hook library would not be removed as unused */ +int mali_injected = 0; + +/* Override libmali symbols */ + +#ifdef HAS_GBM +static struct gbm_surface * (* _gbm_surface_create)(struct gbm_device *, uint32_t, uint32_t, uint32_t, uint32_t) = NULL; +static struct gbm_bo * (* _gbm_bo_create) (struct gbm_device *, uint32_t, uint32_t, uint32_t, uint32_t) = NULL; +#endif + +#ifdef HAS_X11_EGL +static PFNEGLGETPROCADDRESSPROC _eglGetProcAddress = NULL; +static PFNEGLGETDISPLAYPROC _eglGetDisplay = NULL; +static PFNEGLGETPLATFORMDISPLAYPROC _eglGetPlatformDisplay = NULL; +static PFNEGLGETPLATFORMDISPLAYEXTPROC _eglGetPlatformDisplayEXT = NULL; +#endif + +#define MALI_SYMBOL(func) { #func, (void **)(&_ ## func), } +static struct { + const char *func; + void **symbol; +} mali_symbols[] = { +#ifdef HAS_GBM + MALI_SYMBOL(gbm_surface_create), + MALI_SYMBOL(gbm_bo_create), +#endif +#ifdef HAS_X11_EGL + MALI_SYMBOL(eglGetProcAddress), + MALI_SYMBOL(eglGetDisplay), +#endif +}; + +__attribute__((constructor)) static void +load_mali_symbols(void) +{ + void *handle, *symbol; + int i; + + /* The libmali should be already loaded */ + handle = dlopen(LIBMALI_SO, RTLD_LAZY | RTLD_NOLOAD); + if (!handle) { + /* Should not reach here */ + fprintf(stderr, "FATAL: dlopen(" LIBMALI_SO ") failed(%s)\n", dlerror()); + exit(-1); + } + + for (i = 0; i < ARRAY_SIZE(mali_symbols); i++) { + const char *func = mali_symbols[i].func; + + /* Clear error */ + dlerror(); + + symbol = dlsym(handle, func); + if (!symbol) { + /* Should not reach here */ + fprintf(stderr, "FATAL: " LIBMALI_SO " dlsym(%s) failed(%s)\n", + func, dlerror()); + exit(-1); + } + + *mali_symbols[i].symbol = symbol; + } + + dlclose(handle); + +#ifdef HAS_X11_EGL + _eglGetPlatformDisplay = + (PFNEGLGETPLATFORMDISPLAYPROC)_eglGetProcAddress("eglGetPlatformDisplay"); + _eglGetPlatformDisplayEXT = + (PFNEGLGETPLATFORMDISPLAYEXTPROC)_eglGetProcAddress("eglGetPlatformDisplayEXT"); +#endif +} + +#ifdef HAS_GBM + +/* Implement new GBM APIs */ + +__attribute__((unused)) static inline bool +can_ignore_modifiers(const uint64_t *modifiers, + const unsigned int count) +{ + for (int i = 0; i < count; i++) { + /* linear or invalid */ + if (!modifiers[i] || modifiers[i] == DRM_FORMAT_MOD_INVALID) { + return true; + } + } + + return !count; +} + #ifndef HAS_gbm_bo_get_offset uint32_t gbm_bo_get_offset(struct gbm_bo *bo, int plane) @@ -92,20 +199,6 @@ gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane) } #endif -static inline bool -can_ignore_modifiers(const uint64_t *modifiers, - const unsigned int count) -{ - for (int i = 0; i < count; i++) { - /* linear or invalid */ - if (!modifiers[i] || modifiers[i] == DRM_FORMAT_MOD_INVALID) { - return true; - } - } - - return !count; -} - #ifndef HAS_gbm_device_get_format_modifier_plane_count int gbm_device_get_format_modifier_plane_count(struct gbm_device *gbm, @@ -200,77 +293,6 @@ gbm_bo_unmap(struct gbm_bo *bo, void *map_data) } #endif -static inline void * -mali_dlsym(const char *func) -{ - void *handle, *symbol; - - /* The libmali should be already loaded */ - handle = dlopen(LIBMALI_SO, RTLD_LAZY | RTLD_NOLOAD); - if (!handle) { - /* Should not reach here */ - fprintf(stderr, "FATAL: " LIBMALI_SO " not loaded\n"); - exit(-1); - } - - /* Clear error */ - dlerror(); - - symbol = dlsym(handle, func); - if (!symbol) - fprintf(stderr, "%s\n", dlerror()); - - dlclose(handle); - return symbol; -} - -/* Wrappers for unsupported flags */ -struct gbm_surface * -gbm_surface_create(struct gbm_device *gbm, - uint32_t width, uint32_t height, - uint32_t format, uint32_t flags) -{ - struct gbm_surface *surface; - - static struct gbm_surface * (* surface_create) (); - if (!surface_create) { - surface_create = mali_dlsym(__func__); - if(!surface_create) - return NULL; - } - - surface = surface_create(gbm, width, height, format, flags); - if (surface) - return surface; - - return surface_create(gbm, width, height, format, - flags & (GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING)); -} - -/* Wrappers for unsupported flags */ -struct gbm_bo * -gbm_bo_create(struct gbm_device *gbm, - uint32_t width, uint32_t height, - uint32_t format, uint32_t flags) -{ - struct gbm_bo *bo; - - static struct gbm_bo * (* bo_create) (); - if (!bo_create) { - bo_create = mali_dlsym(__func__); - if(!bo_create) - return NULL; - } - - bo = bo_create(gbm, width, height, format, flags); - if (bo) - return bo; - - return bo_create(gbm, width, height, format, - flags & (GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING | - GBM_BO_USE_WRITE | GBM_BO_USE_CURSOR_64X64)); -} - /* From mesa3d 20.1.5 : src/gbm/main/gbm.c */ #ifndef HAS_gbm_bo_get_bpp uint32_t @@ -336,14 +358,14 @@ gbm_bo_get_bpp(struct gbm_bo *bo) static uint32_t gbm_format_canonicalize(uint32_t gbm_format) { - switch (gbm_format) { - case GBM_BO_FORMAT_XRGB8888: - return GBM_FORMAT_XRGB8888; - case GBM_BO_FORMAT_ARGB8888: - return GBM_FORMAT_ARGB8888; - default: - return gbm_format; - } + switch (gbm_format) { + case GBM_BO_FORMAT_XRGB8888: + return GBM_FORMAT_XRGB8888; + case GBM_BO_FORMAT_ARGB8888: + return GBM_FORMAT_ARGB8888; + default: + return gbm_format; + } } char * @@ -360,3 +382,166 @@ gbm_format_get_name(uint32_t gbm_format, struct gbm_format_name_desc *desc) return desc->name; } #endif + +/* Wrappers for unsupported flags */ + +struct gbm_surface * +gbm_surface_create(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t flags) +{ + struct gbm_surface *surface; + + surface = _gbm_surface_create(gbm, width, height, format, flags); + if (surface) + return surface; + + flags &= GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; + return _gbm_surface_create(gbm, width, height, format, flags); +} + +struct gbm_bo * +gbm_bo_create(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t flags) +{ + struct gbm_bo *bo; + + bo = _gbm_bo_create(gbm, width, height, format, flags); + if (bo) + return bo; + + flags &= GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING | + GBM_BO_USE_WRITE | GBM_BO_USE_CURSOR_64X64; + return _gbm_bo_create(gbm, width, height, format, flags); +} + +#endif // HAS_GBM + +#ifdef HAS_X11_EGL + +/* Hacked displays (should not be much) */ +#define MAX_X11_DISPLAY 32 +static Display *_x11_displays[MAX_X11_DISPLAY] = { NULL, }; + +static pthread_mutex_t _x11_mutex = PTHREAD_MUTEX_INITIALIZER; + +static inline int +force_x11_threads(void) +{ + return !getenv("MALI_X11_NO_FORCE_THREADS"); +} + +__attribute__((constructor)) static void +init_x11_threads(void) +{ + if (force_x11_threads()) + XInitThreads(); +} + +__attribute__((destructor)) static void +cleanup_x11_display(void) +{ + int i; + + for (i = 0; i < MAX_X11_DISPLAY; i++) { + Display *display = _x11_displays[i]; + if (display) + XCloseDisplay(display); + } +} + +static Display * +fixup_x11_display(Display *display) +{ + int i; + + if (!force_x11_threads()) + return display; + + if (!display || display->lock_fns) + return display; + + pthread_mutex_lock(&_x11_mutex); + /* Create a new threaded display */ + display = XOpenDisplay(DisplayString(display)); + + for (i = 0; i < MAX_X11_DISPLAY; i++) { + if (!_x11_displays[i]) { + _x11_displays[i] = display; + break; + } + } + pthread_mutex_unlock(&_x11_mutex); + + return display; +} + +/* Override libmali symbols */ + +EGLAPI EGLDisplay EGLAPIENTRY +eglGetDisplay (EGLNativeDisplayType display_id) +{ + Display *display = fixup_x11_display((void *)display_id); + + return _eglGetDisplay((EGLNativeDisplayType)display); +} + +EGLAPI EGLDisplay EGLAPIENTRY +eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) +{ + if (!_eglGetPlatformDisplay) + return EGL_NO_DISPLAY; + + if (platform == EGL_PLATFORM_X11_KHR && native_display) { + native_display = (void *)fixup_x11_display(native_display); + if (!native_display) + return EGL_NO_DISPLAY; + } + + return _eglGetPlatformDisplay(platform, native_display, attrib_list); +} + +EGLAPI EGLDisplay EGLAPIENTRY +eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list) +{ + if (!_eglGetPlatformDisplayEXT) + return EGL_NO_DISPLAY; + + if (platform == EGL_PLATFORM_X11_KHR && native_display) { + native_display = (void *)fixup_x11_display(native_display); + if (!native_display) + return EGL_NO_DISPLAY; + } + + return _eglGetPlatformDisplayEXT(platform, native_display, attrib_list); +} + +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY +eglGetProcAddress(const char *procname) +{ + if (!procname) + return NULL; + + if (!strcmp(procname, __func__)) + return (__eglMustCastToProperFunctionPointerType)eglGetProcAddress; + + if (!strcmp(procname, "eglGetDisplay")) + return (__eglMustCastToProperFunctionPointerType)eglGetDisplay; + + if (!strcmp(procname, "eglGetPlatformDisplay")) { + if (!_eglGetPlatformDisplay) + return NULL; + return (__eglMustCastToProperFunctionPointerType)eglGetPlatformDisplay; + } + + if (!strcmp(procname, "eglGetPlatformDisplayEXT")) { + if (!_eglGetPlatformDisplayEXT) + return NULL; + return (__eglMustCastToProperFunctionPointerType)eglGetPlatformDisplayEXT; + } + + return _eglGetProcAddress(procname); +} + +#endif // HAS_X11 diff --git a/hook/injector.c b/hook/injector.c new file mode 100644 index 0000000..207f8f1 --- /dev/null +++ b/hook/injector.c @@ -0,0 +1,6 @@ +extern int mali_injected; + +__attribute__((constructor)) static void +_injector() { + mali_injected = 1; +} diff --git a/hook/meson.build b/hook/meson.build new file mode 100644 index 0000000..64cb73e --- /dev/null +++ b/hook/meson.build @@ -0,0 +1,79 @@ +# The gbm functions that might be missing +gbm_check_funcs = [ + 'gbm_bo_map', + 'gbm_bo_unmap', + 'gbm_bo_get_offset', + 'gbm_bo_get_plane_count', + 'gbm_device_get_format_modifier_plane_count', + 'gbm_bo_get_handle_for_plane', + 'gbm_bo_get_stride_for_plane', + 'gbm_bo_get_fd_for_plane', + 'gbm_bo_get_modifier', + 'gbm_bo_create_with_modifiers', + 'gbm_surface_create_with_modifiers', + 'gbm_bo_get_bpp', + 'gbm_format_get_name', +] + +libhook_cflags = [ + '-DLIBMALI_SO="libmali.so.' + mali_version.split('.')[0] + '"', +] + +libhook_dep = [mali] +libhook_dep += dependency('threads') +libhook_dep += cc.find_library('dl', required : false) +libhook_dep += dependency('libdrm', version : '>= 2.4.0') + +libhook_inc = [] + +needs_hook = false + +gbm_symbol = map['gbm'][0] +if cc.has_function(gbm_symbol, dependencies : mali) + # Add hooks to support new GBM APIs + libhook_inc += include_directories('../include/GBM') + libhook_cflags += '-DHAS_GBM' + foreach symbol : gbm_check_funcs + if cc.has_function(symbol, dependencies : mali) + libhook_cflags += '-DHAS_' + symbol + endif + endforeach + + needs_hook = true +endif + +egl_symbol = map['egl'][0] +if cc.has_function(egl_symbol, dependencies : mali) and platform == 'x11' + # Add hooks to init X11 threads + libhook_inc += include_directories('../include') + libhook_dep += dependency('x11') + libhook_cflags += '-DHAS_X11_EGL' + + needs_hook = true +endif + +if not needs_hook + libhook_ldflags = [] + subdir_done() +endif + +libhook = shared_library( + 'mali_hook', + 'hook.c', + c_args : libhook_cflags, + include_directories : libhook_inc, + dependencies : libhook_dep, + install : true, + version : mali_version) + +libhook_ldflags = ['-L${libdir}', '-lmali_hook'] + +# A dummy library to ensure that the hook library would not be removed as unused +libinjector = static_library( + 'mali_hook_injector', + 'injector.c', + install : true) + +# Ensure that the hook library would not be removed as unused +libhook_ldflags += \ + ['-Wl,--whole-archive', '-lmali_hook_injector', '-Wl,--no-whole-archive'] diff --git a/meson.build b/meson.build index 319599a..fb4364e 100644 --- a/meson.build +++ b/meson.build @@ -1,13 +1,16 @@ project( 'libmali', 'c', version : '1.9.0', - meson_version : '>=0.49.0', - default_options : ['b_asneeded=false', 'b_lundef=false']) + meson_version : '>=0.54.0', + default_options : ['b_asneeded=false']) mali_version = meson.project_version() +fs = import('fs') pkgconfig = import('pkgconfig') +cc = meson.get_compiler('c') + if get_option('arch') != 'auto' arch = get_option('arch') else @@ -23,10 +26,12 @@ vendor_package = get_option('vendor-package') wrappers_opts = get_option('wrappers') optimize = get_option('optimize-level') -message('Building for ' + '|'.join([arch, gpu, version, subversion, platform, optimize])) +message('Building for ' + '|'.join([arch, gpu, version, subversion, + platform, optimize])) # Grab libraries with specified configs -cmd = run_command('scripts/grabber.sh', arch, gpu, version, subversion, platform, optimize) +cmd = run_command('scripts/grabber.sh', + arch, gpu, version, subversion, platform, optimize, check : false) libs = cmd.stdout().strip().split('\n') # Use the first one as default library @@ -37,6 +42,10 @@ endif message('Source libraries: @0@'.format(libs)) +is_rk3288 = gpu == 'midgard-t76x' +is_utgard = gpu.split('-')[0] == 'utgard' +is_px3se = gpu == 'utgard-400' and subversion == 'r3p0' + # Required packages requires = [] if platform == 'gbm' @@ -44,20 +53,20 @@ if platform == 'gbm' elif platform == 'wayland' requires = ['libdrm', 'wayland-client', 'wayland-server'] - if gpu == 'utgard-400' and subversion == 'r3p0' + if is_px3se requires += ['libffi', 'libcrypto'] endif elif platform == 'x11' requires = ['libdrm', 'x11', 'xcb'] - if gpu.split('-')[0] != 'utgard' - requires += ['x11-xcb', 'xcb-dri2'] - else + if is_utgard requires += ['xfixes', 'xext', 'xau', 'xdmcp', 'xdamage'] + else + requires += ['x11-xcb', 'xcb-dri2'] endif endif -if wrappers_opts.auto() and gpu.split('-')[0] == 'utgard' +if wrappers_opts.auto() and is_utgard wrappers = false warning('Wrappers are disabled for utgard by default') else @@ -82,7 +91,6 @@ else endif # Wrap library name : version -mali_wrappers = {'Mali' : '1'} gbm_wrappers = {'gbm' : '1'} egl_wrappers = {'EGL' : '1'} glesv1_wrappers = {'GLESv1_CM' : '1'} @@ -91,19 +99,19 @@ wayland_wrappers = {'wayland-egl' : '1'} cl_wrappers = opencl_icd ? {'MaliOpenCL' : '1'} : {'OpenCL' : '1'} # Source dir : dest dir -mali_headers = { - 'include/KHR' : 'KHR', -} gbm_headers = { 'include/GBM' : '', } egl_headers = { + 'include/KHR' : 'KHR', 'include/EGL' : 'EGL', } glesv1_headers = { + 'include/KHR' : 'KHR', 'include/GLES' : 'GLES', } glesv2_headers = { + 'include/KHR' : 'KHR', 'include/GLES2' : 'GLES2', 'include/GLES3' : 'GLES3', } @@ -111,12 +119,11 @@ cl_headers = { 'include/CL' : 'CL', } -# Provide newer GBM version with wrappers -gbm_version = wrappers ? '21.2.6' : '10.4.0' +# Provide newer GBM version with hook library +gbm_version = get_option('hooks') ? '21.2.6' : '10.4.0' # Package name : required symbol, wrappers, headers, package version map = { - 'Mali' : ['', mali_wrappers, mali_headers, mali_version], 'gbm' : ['gbm_create_device', gbm_wrappers, gbm_headers, gbm_version], 'egl' : ['eglCreateContext', egl_wrappers, egl_headers, '7.10'], 'glesv1_cm' : ['eglCreateContext', glesv1_wrappers, glesv1_headers, '7.10'], @@ -125,70 +132,47 @@ map = { 'OpenCL' : ['clCreateContext', cl_wrappers, cl_headers, '1.2'], } -# Create dummy source for building libraries -dummy_source = join_paths(meson.current_build_dir(), 'dummy.c') -run_command('touch', dummy_source) +# Load original mali library for later function checks and linking +mali = cc.find_library(fs.stem(default_lib), + dirs : meson.current_source_dir() / fs.parent(default_lib)) -# Create a dummy library for building wrappers +if get_option('hooks') + # Build hook library + subdir('hook') + + # Recommend to link hook library before libmali + mali_ldflags = libhook_ldflags +else + mali_ldflags = [] +endif + +# Create dummy source for building dummy libraries +dummy_source = join_paths(meson.current_build_dir(), 'dummy.c') +run_command('touch', dummy_source, check : false) + +# Create a dummy library which will be replaced by the prebuilt mali library libmali = shared_library( 'mali', dummy_source, install : true, version : mali_version) +mali_ldflags += ['-L${libdir}', '-lmali'] + pkgconfig.generate( - libmali, + libraries : mali_ldflags, requires : requires, + name : 'mali', description : 'Mali GPU User-Space Binary Driver') -# The gbm functions might be missing -gbm_check_funcs = [ - 'gbm_bo_map', - 'gbm_bo_unmap', - 'gbm_bo_get_offset', - 'gbm_bo_get_plane_count', - 'gbm_device_get_format_modifier_plane_count', - 'gbm_bo_get_handle_for_plane', - 'gbm_bo_get_stride_for_plane', - 'gbm_bo_get_fd_for_plane', - 'gbm_bo_get_modifier', - 'gbm_bo_create_with_modifiers', - 'gbm_surface_create_with_modifiers', - 'gbm_bo_get_bpp', - 'gbm_format_get_name', -] - -# Create libgbm wrapper for missing functions -libgbm = [] -gbm_symbol = map['gbm'][0] -if run_command('grep', '-q', gbm_symbol, default_lib).returncode() == 0 - libgbm_version = gbm_wrappers['gbm'] - libgbm_cflags = [ - '-DLIBMALI_SO="libmali.so.' + mali_version.split('.')[0] + '"', - ] - - libdrm_dep = dependency('libdrm', version : '>= 2.4.0') - if not libdrm_dep.found() - error('libdrm not found.') - endif - - foreach symbol : gbm_check_funcs - if run_command('grep', '-q', symbol, default_lib).returncode() == 0 - libgbm_cflags += '-DHAS_' + symbol - endif - endforeach - - libdl_dep = meson.get_compiler('c').find_library('dl', required : false) - libgbm = shared_library( - 'gbm', - 'src/gbm_wrapper.c', - c_args : libgbm_cflags, - include_directories : include_directories('include/GBM'), - dependencies : [libdl_dep, libdrm_dep], - link_with : libmali, - install : true, - install_dir : wrapper_libdir, - version : libgbm_version) +if is_utgard + # The utgard DDK requires libMali.so + custom_target( + 'libMali', + output : 'libMali.so', + command : ['ln', '-sf', 'libmali.so', '@OUTPUT@'], + install_dir : get_option('libdir'), + install : true) endif foreach name, values : map @@ -196,25 +180,20 @@ foreach name, values : map wrapper_libs = values[1] headers = values[2] pkg_version = values[3] - wrapper_ldflags = [] is_opencl_icd = opencl_icd and name == 'OpenCL' - if run_command('grep', '-q', symbol, default_lib).returncode() != 0 + if not cc.has_function(symbol, dependencies : mali) continue endif foreach wrapper, version : wrapper_libs - wrapper_ldflags += '-l' + wrapper - - if wrapper != 'gbm' - shared_library( - wrapper, - dummy_source, - link_with : [libgbm, libmali], - install : true, - install_dir : wrapper_libdir, - version : version) - endif + shared_library( + wrapper, + dummy_source, + link_with : libhook, + install : true, + install_dir : wrapper_libdir, + version : version) endforeach # Install ICD OpenCL vendor config @@ -242,7 +221,7 @@ foreach name, values : map endforeach pkgconfig.generate( - libraries : ['-L${libdir} -lmali', wrapper_ldflags], + libraries : mali_ldflags, requires : requires, version : pkg_version, name : name, @@ -251,13 +230,15 @@ endforeach # Install optional overlay if get_option('with-overlay') - if gpu == 'utgard-400' and subversion == 'r3p0' - install_data('overlay/S10libmali_px3se', install_dir : get_option('sysconfdir') / 'init.d') + if is_px3se + install_data('overlay/S10libmali_px3se', + install_dir : get_option('sysconfdir') / 'init.d') install_data('overlay/px3seBase', install_dir : get_option('bindir')) endif - if gpu == 'midgard-t76x' and subversion == 'all' - install_data('overlay/S10libmali_rk3288', install_dir : get_option('sysconfdir') / 'init.d') + if is_rk3288 and subversion == 'all' + install_data('overlay/S10libmali_rk3288', + install_dir : get_option('sysconfdir') / 'init.d') endif endif @@ -288,14 +269,15 @@ endif install_data(libs, install_dir : get_option('libdir')) # Replace dummy libmali library -meson.add_install_script('scripts/fixup_dummy.sh', get_option('libdir'), default_lib) +meson.add_install_script('scripts/fixup_dummy.sh', + get_option('libdir'), default_lib) if not wrappers -# Disable wrappers + # Disable wrappers meson.add_install_script('scripts/fixup_nowrap.sh', get_option('libdir')) endif if platform != 'x11' and not vendor_package -# Disable X11 in EGL header + # Disable X11 in EGL header meson.add_install_script('scripts/fixup_nox11.sh', get_option('includedir')) endif diff --git a/meson_options.txt b/meson_options.txt index 6468b54..e385fc2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -9,13 +9,15 @@ option('subversion', type: 'string', value: 'none', option('platform', type: 'combo', choices: ['x11', 'gbm', 'wayland', 'only-cl', 'dummy'], value: 'x11', description: 'platform (default: x11)') option('with-overlay', type: 'boolean', value: 'false', - description: 'install overlay (default: false)') + description: 'Install overlay (default: false)') option('opencl-icd', type: 'boolean', value: 'true', description: 'OpenCL Installable Client Driver (ICD) (default: true)') option('khr-header', type: 'boolean', value: 'false', description: 'Install KHR header (default: false)') option('vendor-package', type: 'boolean', value: 'false', description: 'Install as vendor package (default: false)') +option('hooks', type: 'boolean', value: 'true', + description: 'Enable hook library (default: true)') option('wrappers', type: 'feature', value: 'auto', description: 'Install with wrappers (default: auto)') option('optimize-level', type: 'combo', choices: ['O0', 'O1', 'O2', 'O3', 'Os', 'Ofast', 'Og'], value: 'O3', diff --git a/scripts/fixup_dummy.sh b/scripts/fixup_dummy.sh index 4ae5f4c..3d2a9f6 100755 --- a/scripts/fixup_dummy.sh +++ b/scripts/fixup_dummy.sh @@ -12,6 +12,3 @@ SOURCE="$(basename $2)" cd "$DEST_DIR" cp $SOURCE libmali.so cp -a libmali.so $SOURCE - -# For old DDK(e.g. utgard) -cp -a libmali.so libMali.so.1 diff --git a/scripts/fixup_nowrap.sh b/scripts/fixup_nowrap.sh index b182912..3b0b8b2 100755 --- a/scripts/fixup_nowrap.sh +++ b/scripts/fixup_nowrap.sh @@ -10,6 +10,6 @@ DEST_DIR="${MESON_INSTALL_DESTDIR_PREFIX:-/usr}/$1" # Cleanup wrappers cd "$DEST_DIR" -for f in $(cd $BUILD_DIR && find . -maxdepth 1 -type f -name "lib*"); do - echo $f | grep -q libmali.so || cp -a libmali.so $f +for f in $(cd $BUILD_DIR && find . -maxdepth 1 -type f -name "lib*.so.[0-9]"); do + cp -a libmali.so $f done