mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +00:00
Merge pull request #48 from ngn999/staged
libao: static link libmacosx.so plugin, fix #46
This commit is contained in:
commit
ed55ad0f56
2
.github/workflows/macos-6.2.yml
vendored
2
.github/workflows/macos-6.2.yml
vendored
|
@ -71,7 +71,7 @@ jobs:
|
||||||
tar xvjf eb-4.4.3.tar.bz2
|
tar xvjf eb-4.4.3.tar.bz2
|
||||||
cd eb-4.4.3 && ./configure && make -j 8 && sudo make install && cd ..
|
cd eb-4.4.3 && ./configure && make -j 8 && sudo make install && cd ..
|
||||||
#brew install qt # or use official offline installer
|
#brew install qt # or use official offline installer
|
||||||
brew install opencc libao hunspell ffmpeg@5 libtiff xz lzo libogg libvorbis zstd
|
brew install opencc hunspell ffmpeg@5 libtiff xz lzo libogg libvorbis zstd
|
||||||
brew install create-dmg
|
brew install create-dmg
|
||||||
qmake CONFIG+=release CONFIG+=zim_support CONFIG+=chinese_conversion_support
|
qmake CONFIG+=release CONFIG+=zim_support CONFIG+=chinese_conversion_support
|
||||||
make -j 8
|
make -j 8
|
||||||
|
|
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
|
@ -71,7 +71,7 @@ jobs:
|
||||||
tar xvjf eb-4.4.3.tar.bz2
|
tar xvjf eb-4.4.3.tar.bz2
|
||||||
cd eb-4.4.3 && ./configure && make -j 8 && sudo make install && cd ..
|
cd eb-4.4.3 && ./configure && make -j 8 && sudo make install && cd ..
|
||||||
#brew install qt # or use official offline installer
|
#brew install qt # or use official offline installer
|
||||||
brew install opencc libao hunspell ffmpeg@5 libtiff xz lzo libogg libvorbis zstd
|
brew install opencc hunspell ffmpeg@5 libtiff xz lzo libogg libvorbis zstd
|
||||||
brew install create-dmg
|
brew install create-dmg
|
||||||
qmake CONFIG+=release CONFIG+=zim_support CONFIG+=chinese_conversion_support
|
qmake CONFIG+=release CONFIG+=zim_support CONFIG+=chinese_conversion_support
|
||||||
make -j 8
|
make -j 8
|
||||||
|
|
|
@ -197,8 +197,8 @@ mac {
|
||||||
}
|
}
|
||||||
QT_CONFIG -= no-pkg-config
|
QT_CONFIG -= no-pkg-config
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
INCLUDEPATH = /opt/homebrew/include /usr/local/include
|
INCLUDEPATH = $${PWD}/maclibs/include /opt/homebrew/include /usr/local/include
|
||||||
LIBS += -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
|
LIBS += -L$${PWD}/maclibs/lib -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
|
||||||
OBJECTIVE_SOURCES += lionsupport.mm \
|
OBJECTIVE_SOURCES += lionsupport.mm \
|
||||||
machotkeywrapper.mm \
|
machotkeywrapper.mm \
|
||||||
macmouseover.mm \
|
macmouseover.mm \
|
||||||
|
@ -206,6 +206,7 @@ mac {
|
||||||
ICON = icons/macicon.icns
|
ICON = icons/macicon.icns
|
||||||
QMAKE_INFO_PLIST = myInfo.plist
|
QMAKE_INFO_PLIST = myInfo.plist
|
||||||
QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
|
QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
|
||||||
|
cp -nR $${PWD}/maclibs/lib/ GoldenDict.app/Contents/Frameworks/ && \
|
||||||
mkdir -p GoldenDict.app/Contents/MacOS/help && \
|
mkdir -p GoldenDict.app/Contents/MacOS/help && \
|
||||||
cp -R $${PWD}/help/*.qch GoldenDict.app/Contents/MacOS/help/
|
cp -R $${PWD}/help/*.qch GoldenDict.app/Contents/MacOS/help/
|
||||||
|
|
||||||
|
|
7
maclibs/README.md
Normal file
7
maclibs/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# libao build instruction
|
||||||
|
wget https://github.com/ngn999/tslab_libao_library/archive/refs/heads/master.zip
|
||||||
|
unzip master.zip
|
||||||
|
cd tslab_libao_library
|
||||||
|
./configure CC="gcc -arch arm64 -arch x86_64"
|
||||||
|
make -j
|
||||||
|
install_name_tool -id @executable_path/../Frameworks/libao.dylib src/.libs/libao.dylib
|
139
maclibs/include/ao/ao.h
Normal file
139
maclibs/include/ao/ao.h
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ao.h
|
||||||
|
*
|
||||||
|
* Original Copyright (C) Aaron Holtzman - May 1999
|
||||||
|
* Modifications Copyright (C) Stan Seibert - July 2000, July 2001
|
||||||
|
* More Modifications Copyright (C) Jack Moffitt - October 2000
|
||||||
|
*
|
||||||
|
* This file is part of libao, a cross-platform audio outputlibrary. See
|
||||||
|
* README for a history of this source code.
|
||||||
|
*
|
||||||
|
* libao is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* libao is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNU Make; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef __AO_H__
|
||||||
|
#define __AO_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "os_types.h"
|
||||||
|
|
||||||
|
/* --- Constants ---*/
|
||||||
|
|
||||||
|
#define AO_TYPE_LIVE 1
|
||||||
|
#define AO_TYPE_FILE 2
|
||||||
|
|
||||||
|
|
||||||
|
#define AO_ENODRIVER 1
|
||||||
|
#define AO_ENOTFILE 2
|
||||||
|
#define AO_ENOTLIVE 3
|
||||||
|
#define AO_EBADOPTION 4
|
||||||
|
#define AO_EOPENDEVICE 5
|
||||||
|
#define AO_EOPENFILE 6
|
||||||
|
#define AO_EFILEEXISTS 7
|
||||||
|
#define AO_EBADFORMAT 8
|
||||||
|
|
||||||
|
#define AO_EFAIL 100
|
||||||
|
|
||||||
|
|
||||||
|
#define AO_FMT_LITTLE 1
|
||||||
|
#define AO_FMT_BIG 2
|
||||||
|
#define AO_FMT_NATIVE 4
|
||||||
|
|
||||||
|
/* --- Structures --- */
|
||||||
|
|
||||||
|
typedef struct ao_info {
|
||||||
|
int type; /* live output or file output? */
|
||||||
|
char *name; /* full name of driver */
|
||||||
|
char *short_name; /* short name of driver */
|
||||||
|
char *author; /* driver author */
|
||||||
|
char *comment; /* driver comment */
|
||||||
|
int preferred_byte_format;
|
||||||
|
int priority;
|
||||||
|
char **options;
|
||||||
|
int option_count;
|
||||||
|
} ao_info;
|
||||||
|
|
||||||
|
typedef struct ao_functions ao_functions;
|
||||||
|
typedef struct ao_device ao_device;
|
||||||
|
|
||||||
|
typedef struct ao_sample_format {
|
||||||
|
int bits; /* bits per sample */
|
||||||
|
int rate; /* samples per second (in a single channel) */
|
||||||
|
int channels; /* number of audio channels */
|
||||||
|
int byte_format; /* Byte ordering in sample, see constants below */
|
||||||
|
char *matrix; /* input channel location/ordering */
|
||||||
|
} ao_sample_format;
|
||||||
|
|
||||||
|
typedef struct ao_option {
|
||||||
|
char *key;
|
||||||
|
char *value;
|
||||||
|
struct ao_option *next;
|
||||||
|
} ao_option;
|
||||||
|
|
||||||
|
#if defined(AO_BUILDING_LIBAO)
|
||||||
|
#include "ao_private.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --- Functions --- */
|
||||||
|
|
||||||
|
/* library setup/teardown */
|
||||||
|
void ao_initialize(void);
|
||||||
|
void ao_shutdown(void);
|
||||||
|
|
||||||
|
/* device setup/playback/teardown */
|
||||||
|
int ao_append_global_option(const char *key,
|
||||||
|
const char *value);
|
||||||
|
int ao_append_option(ao_option **options,
|
||||||
|
const char *key,
|
||||||
|
const char *value);
|
||||||
|
void ao_free_options(ao_option *options);
|
||||||
|
ao_device* ao_open_live(int driver_id,
|
||||||
|
ao_sample_format *format,
|
||||||
|
ao_option *option);
|
||||||
|
ao_device* ao_open_file(int driver_id,
|
||||||
|
const char *filename,
|
||||||
|
int overwrite,
|
||||||
|
ao_sample_format *format,
|
||||||
|
ao_option *option);
|
||||||
|
|
||||||
|
int ao_play(ao_device *device,
|
||||||
|
char *output_samples,
|
||||||
|
uint_32 num_bytes);
|
||||||
|
int ao_close(ao_device *device);
|
||||||
|
|
||||||
|
/* driver information */
|
||||||
|
int ao_driver_id(const char *short_name);
|
||||||
|
int ao_default_driver_id(void);
|
||||||
|
ao_info *ao_driver_info(int driver_id);
|
||||||
|
ao_info **ao_driver_info_list(int *driver_count);
|
||||||
|
const char *ao_file_extension(int driver_id);
|
||||||
|
|
||||||
|
/* miscellaneous */
|
||||||
|
int ao_is_big_endian(void);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __AO_H__ */
|
211
maclibs/include/ao/ao_private.h
Normal file
211
maclibs/include/ao/ao_private.h
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ao_private.c
|
||||||
|
*
|
||||||
|
* Copyright (C) Stan Seibert - July 2001
|
||||||
|
*
|
||||||
|
* This file is part of libao, a cross-platform audio output library. See
|
||||||
|
* README for a history of this source code.
|
||||||
|
*
|
||||||
|
* libao is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* libao is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNU Make; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __AO_PRIVATE_H__
|
||||||
|
#define __AO_PRIVATE_H__
|
||||||
|
|
||||||
|
/* --- Operating System Compatibility --- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
OpenBSD systems with a.out binaries require dlsym()ed symbols to be
|
||||||
|
prepended with an underscore, so we need the following nasty #ifdef
|
||||||
|
hack.
|
||||||
|
*/
|
||||||
|
#if defined(__OpenBSD__) && !defined(__ELF__)
|
||||||
|
#define dlsym(h,s) dlsym(h, "_" s)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* RTLD_NOW is the preferred symbol resolution behavior, but
|
||||||
|
* some platforms do not support it. The autoconf script will have
|
||||||
|
* already defined DLOPEN_FLAG if the default is unacceptable on the
|
||||||
|
* current platform.
|
||||||
|
*
|
||||||
|
* ALSA requires RTLD_GLOBAL.
|
||||||
|
*/
|
||||||
|
#if !defined(DLOPEN_FLAG)
|
||||||
|
#define DLOPEN_FLAG (RTLD_NOW | RTLD_GLOBAL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --- Constants --- */
|
||||||
|
|
||||||
|
#ifndef AO_SYSTEM_CONFIG
|
||||||
|
#define AO_SYSTEM_CONFIG "/etc/libao.conf"
|
||||||
|
#endif
|
||||||
|
#ifndef AO_USER_CONFIG
|
||||||
|
#define AO_USER_CONFIG "/.libao"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --- Structures --- */
|
||||||
|
|
||||||
|
typedef struct ao_config {
|
||||||
|
char *default_driver;
|
||||||
|
} ao_config;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
AO_OUTPUT_MATRIX_UNDEFINED=0, /* matrix unset */
|
||||||
|
AO_OUTPUT_MATRIX_FIXED=1, /* fixed, immutable channel order, eg, ALSA */
|
||||||
|
AO_OUTPUT_MATRIX_COLLAPSIBLE=2, /* fixed order but only used channels sent, eg MACOS */
|
||||||
|
AO_OUTPUT_MATRIX_PERMUTABLE=3, /* channel map is fully permutable. eg Pulse */
|
||||||
|
} ao_outorder;
|
||||||
|
|
||||||
|
struct ao_device {
|
||||||
|
int type; /* live output or file output? */
|
||||||
|
int driver_id;
|
||||||
|
ao_functions *funcs;
|
||||||
|
FILE *file; /* File for output if this is a file driver */
|
||||||
|
|
||||||
|
/* input not necessarily == output. Right now, byte order, channel
|
||||||
|
count, and channel mappings may be altered. */
|
||||||
|
|
||||||
|
int client_byte_format;
|
||||||
|
int machine_byte_format;
|
||||||
|
int driver_byte_format;
|
||||||
|
char *swap_buffer;
|
||||||
|
int swap_buffer_size; /* Bytes allocated to swap_buffer */
|
||||||
|
|
||||||
|
int input_channels;
|
||||||
|
int output_channels;
|
||||||
|
int bytewidth;
|
||||||
|
int rate;
|
||||||
|
|
||||||
|
ao_outorder output_matrix_order;
|
||||||
|
char *output_matrix; /* physical output channel
|
||||||
|
ordering/numbering matrix set by
|
||||||
|
driver if there's a channel
|
||||||
|
name->number mapping useful to the
|
||||||
|
backend driver in some way. Eg,
|
||||||
|
Pulse has fully permutable input
|
||||||
|
channel masks, but specific channels
|
||||||
|
locations (eg, 'Center') still have
|
||||||
|
assigned numbers even if not a
|
||||||
|
specific slot int he input
|
||||||
|
interleave. */
|
||||||
|
int output_mask;
|
||||||
|
int *input_map; /* input permutation mapping from each
|
||||||
|
input channel to a location in the
|
||||||
|
output_matrix. Made by ao_open,
|
||||||
|
intended for convenience use by
|
||||||
|
driver in device open. */
|
||||||
|
|
||||||
|
char *inter_matrix; /* channel matrix as presented to the
|
||||||
|
backend API */
|
||||||
|
int *inter_permute; /* maps from each channel in the
|
||||||
|
inter_matrix back to an input channel
|
||||||
|
(if any) */
|
||||||
|
|
||||||
|
void *internal; /* Pointer to driver-specific data */
|
||||||
|
|
||||||
|
int verbose;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ao_functions {
|
||||||
|
int (*test)(void);
|
||||||
|
ao_info* (*driver_info)(void);
|
||||||
|
int (*device_init)(ao_device *device);
|
||||||
|
int (*set_option)(ao_device *device, const char *key,
|
||||||
|
const char *value);
|
||||||
|
int (*open)(ao_device *device, ao_sample_format *format);
|
||||||
|
int (*play)(ao_device *device, const char *output_samples,
|
||||||
|
uint_32 num_bytes);
|
||||||
|
int (*close)(ao_device *device);
|
||||||
|
void (*device_clear)(ao_device *device);
|
||||||
|
const char* (*file_extension)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* --- Functions --- */
|
||||||
|
|
||||||
|
void ao_read_config_files (ao_config *config);
|
||||||
|
|
||||||
|
#define adebug(format, args...) {\
|
||||||
|
if(!device || device->verbose==2){ \
|
||||||
|
if(strcmp(format,"\n")){ \
|
||||||
|
if(device && device->funcs->driver_info()->short_name){ \
|
||||||
|
fprintf(stderr,"ao_%s debug: " format,device->funcs->driver_info()->short_name,## args); \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"debug: " format,## args); \
|
||||||
|
} \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"\n"); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define averbose(format, args...) {\
|
||||||
|
if(!device || device->verbose>0){ \
|
||||||
|
if(strcmp(format,"\n")){ \
|
||||||
|
if(device && device->funcs->driver_info()->short_name){ \
|
||||||
|
fprintf(stderr,"ao_%s info: " format,device->funcs->driver_info()->short_name,## args); \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"info: " format,## args); \
|
||||||
|
} \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"\n"); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ainfo(format, args...) {\
|
||||||
|
if(!device || device->verbose>=0){ \
|
||||||
|
if(strcmp(format,"\n")){ \
|
||||||
|
if(device && device->funcs->driver_info()->short_name){ \
|
||||||
|
fprintf(stderr,"ao_%s info: " format,device->funcs->driver_info()->short_name,## args); \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"info: " format,## args); \
|
||||||
|
} \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"\n"); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define awarn(format, args...) {\
|
||||||
|
if(!device || device->verbose>=0){ \
|
||||||
|
if(strcmp(format,"\n")){ \
|
||||||
|
if(device && device->funcs->driver_info()->short_name){ \
|
||||||
|
fprintf(stderr,"ao_%s WARNING: " format,device->funcs->driver_info()->short_name,## args); \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"WARNING: " format,## args); \
|
||||||
|
} \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"\n"); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define aerror(format, args...) { \
|
||||||
|
if(!device || device->verbose>=0){ \
|
||||||
|
if(strcmp(format,"\n")){ \
|
||||||
|
if(device && device->funcs->driver_info()->short_name){ \
|
||||||
|
fprintf(stderr,"ao_%s ERROR: " format,device->funcs->driver_info()->short_name,## args); \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"ERROR: " format,## args); \
|
||||||
|
} \
|
||||||
|
}else{ \
|
||||||
|
fprintf(stderr,"\n"); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __AO_PRIVATE_H__ */
|
39
maclibs/include/ao/os_types.h
Normal file
39
maclibs/include/ao/os_types.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* os_types.h
|
||||||
|
*
|
||||||
|
* Original Copyright (C) Aaron Holtzman - May 1999
|
||||||
|
* Modifications Copyright (C) Stan Seibert - July 2000
|
||||||
|
*
|
||||||
|
* This file is part of libao, a cross-platform audio output library. See
|
||||||
|
* README for a history of this source code.
|
||||||
|
*
|
||||||
|
* libao is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* libao is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNU Make; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Set type sizes for this platform (Requires Autoconf) */
|
||||||
|
|
||||||
|
#ifndef __OS_TYPES_H__
|
||||||
|
#define __OS_TYPES_H__
|
||||||
|
|
||||||
|
typedef unsigned char uint_8;
|
||||||
|
typedef unsigned short uint_16;
|
||||||
|
typedef unsigned int uint_32;
|
||||||
|
typedef signed char sint_8;
|
||||||
|
typedef signed short sint_16;
|
||||||
|
typedef signed int sint_32;
|
||||||
|
|
||||||
|
#endif /* __OS_TYPES_H__ */
|
BIN
maclibs/lib/libao.dylib
Executable file
BIN
maclibs/lib/libao.dylib
Executable file
Binary file not shown.
Loading…
Reference in a new issue