|
| 1 | +load("@bazel_skylib//rules:copy_file.bzl", "copy_file") |
| 2 | +load("@bazel_skylib//rules:write_file.bzl", "write_file") |
| 3 | +load("@rules_cc//cc:cc_library.bzl", "cc_library") |
| 4 | + |
| 5 | +write_file( |
| 6 | + name = "include/config_h", |
| 7 | + out = "include/config.h", |
| 8 | + content = ["""\ |
| 9 | +/* include/config.h. Generated from config.h.in by configure. */ |
| 10 | +/* include/config.h.in. Generated from configure.ac by autoheader. */ |
| 11 | +
|
| 12 | +/* Directory with aload* device files */ |
| 13 | +#define ALOAD_DEVICE_DIRECTORY "/dev/" |
| 14 | +
|
| 15 | +/* directory containing ALSA configuration database */ |
| 16 | +#define ALSA_CONFIG_DIR "/usr/share/alsa" |
| 17 | +
|
| 18 | +/* Enable assert at error message handler */ |
| 19 | +/* #undef ALSA_DEBUG_ASSERT */ |
| 20 | +
|
| 21 | +/* Directory with ALSA device files */ |
| 22 | +#define ALSA_DEVICE_DIRECTORY "/dev/snd/" |
| 23 | +
|
| 24 | +/* directory containing pkgconfig files */ |
| 25 | +#define ALSA_PKGCONF_DIR "/usr/lib/pkgconfig" |
| 26 | +
|
| 27 | +/* directory containing ALSA add-on modules */ |
| 28 | +#define ALSA_PLUGIN_DIR "/usr/lib/alsa-lib" |
| 29 | +
|
| 30 | +/* Build hwdep component */ |
| 31 | +#define BUILD_HWDEP "1" |
| 32 | +
|
| 33 | +/* Build mixer component */ |
| 34 | +#define BUILD_MIXER "1" |
| 35 | +
|
| 36 | +/* Build PCM component */ |
| 37 | +#define BUILD_PCM "1" |
| 38 | +
|
| 39 | +/* Build PCM adpcm plugin */ |
| 40 | +#define BUILD_PCM_PLUGIN_ADPCM "1" |
| 41 | +
|
| 42 | +/* Build PCM alaw plugin */ |
| 43 | +#define BUILD_PCM_PLUGIN_ALAW "1" |
| 44 | +
|
| 45 | +/* Build PCM lfloat plugin */ |
| 46 | +#define BUILD_PCM_PLUGIN_LFLOAT "1" |
| 47 | +
|
| 48 | +/* Build PCM mmap-emul plugin */ |
| 49 | +#define BUILD_PCM_PLUGIN_MMAP_EMUL "1" |
| 50 | +
|
| 51 | +/* Build PCM mulaw plugin */ |
| 52 | +#define BUILD_PCM_PLUGIN_MULAW "1" |
| 53 | +
|
| 54 | +/* Build PCM rate plugin */ |
| 55 | +#define BUILD_PCM_PLUGIN_RATE "1" |
| 56 | +
|
| 57 | +/* Build PCM route plugin */ |
| 58 | +#define BUILD_PCM_PLUGIN_ROUTE "1" |
| 59 | +
|
| 60 | +/* Build raw MIDI component */ |
| 61 | +#define BUILD_RAWMIDI "1" |
| 62 | +
|
| 63 | +/* Build sequencer component */ |
| 64 | +#define BUILD_SEQ "1" |
| 65 | +
|
| 66 | +/* Build DSP Topology component */ |
| 67 | +#define BUILD_TOPOLOGY "1" |
| 68 | +
|
| 69 | +/* Build UCM component */ |
| 70 | +#define BUILD_UCM "1" |
| 71 | +
|
| 72 | +/* Have clock gettime */ |
| 73 | +#define HAVE_CLOCK_GETTIME 1 |
| 74 | +
|
| 75 | +/* Define to 1 if you have the <dlfcn.h> header file. */ |
| 76 | +#define HAVE_DLFCN_H 1 |
| 77 | +
|
| 78 | +/* Define to 1 if you have the `eaccess' function. */ |
| 79 | +#define HAVE_EACCESS 1 |
| 80 | +
|
| 81 | +/* Define to 1 if you have the <endian.h> header file. */ |
| 82 | +#define HAVE_ENDIAN_H 1 |
| 83 | +
|
| 84 | +/* Define to 1 if you have the <inttypes.h> header file. */ |
| 85 | +#define HAVE_INTTYPES_H 1 |
| 86 | +
|
| 87 | +/* Have LFS */ |
| 88 | +#define HAVE_LFS 1 |
| 89 | +
|
| 90 | +/* Have libdl */ |
| 91 | +#define HAVE_LIBDL 1 |
| 92 | +
|
| 93 | +/* Have libpthread */ |
| 94 | +#define HAVE_LIBPTHREAD 1 |
| 95 | +
|
| 96 | +/* Define to 1 if you have the `resmgr' library (-lresmgr). */ |
| 97 | +/* #undef HAVE_LIBRESMGR */ |
| 98 | +
|
| 99 | +/* Have librt */ |
| 100 | +#define HAVE_LIBRT 1 |
| 101 | +
|
| 102 | +/* Define to 1 if you have the <malloc.h> header file. */ |
| 103 | +#define HAVE_MALLOC_H 1 |
| 104 | +
|
| 105 | +/* Define to 1 if you have the <memory.h> header file. */ |
| 106 | +#define HAVE_MEMORY_H 1 |
| 107 | +
|
| 108 | +/* MMX technology is enabled */ |
| 109 | +/* #undef HAVE_MMX */ |
| 110 | +
|
| 111 | +/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */ |
| 112 | +#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/ |
| 113 | +
|
| 114 | +/* Avoid calculation in float */ |
| 115 | +/* #undef HAVE_SOFT_FLOAT */ |
| 116 | +
|
| 117 | +/* Define to 1 if you have the <stdint.h> header file. */ |
| 118 | +#define HAVE_STDINT_H 1 |
| 119 | +
|
| 120 | +/* Define to 1 if you have the <stdlib.h> header file. */ |
| 121 | +#define HAVE_STDLIB_H 1 |
| 122 | +
|
| 123 | +/* Define to 1 if you have the <strings.h> header file. */ |
| 124 | +#define HAVE_STRINGS_H 1 |
| 125 | +
|
| 126 | +/* Define to 1 if you have the <string.h> header file. */ |
| 127 | +#define HAVE_STRING_H 1 |
| 128 | +
|
| 129 | +/* Define to 1 if you have the <sys/endian.h> header file. */ |
| 130 | +/* #undef HAVE_SYS_ENDIAN_H */ |
| 131 | +
|
| 132 | +/* Define to 1 if you have the <sys/shm.h> header file. */ |
| 133 | +#define HAVE_SYS_SHM_H 1 |
| 134 | +
|
| 135 | +/* Define to 1 if you have the <sys/stat.h> header file. */ |
| 136 | +#define HAVE_SYS_STAT_H 1 |
| 137 | +
|
| 138 | +/* Define to 1 if you have the <sys/types.h> header file. */ |
| 139 | +#define HAVE_SYS_TYPES_H 1 |
| 140 | +
|
| 141 | +/* Define to 1 if you have the <unistd.h> header file. */ |
| 142 | +#define HAVE_UNISTD_H 1 |
| 143 | +
|
| 144 | +/* Define to 1 if you have the `uselocale' function. */ |
| 145 | +#define HAVE_USELOCALE 1 |
| 146 | +
|
| 147 | +/* Enable use of wordexp */ |
| 148 | +/* #undef HAVE_WORDEXP */ |
| 149 | +
|
| 150 | +/* Define to 1 if compiler supports __thread */ |
| 151 | +#define HAVE___THREAD 1 |
| 152 | +
|
| 153 | +/* Lockless dmix as default */ |
| 154 | +/* #undef LOCKLESS_DMIX_DEFAULT */ |
| 155 | +
|
| 156 | +/* Define to the sub-directory where libtool stores uninstalled libraries. */ |
| 157 | +#define LT_OBJDIR ".libs/" |
| 158 | +
|
| 159 | +/* No assert debug */ |
| 160 | +/* #undef NDEBUG */ |
| 161 | +
|
| 162 | +/* Name of package */ |
| 163 | +#define PACKAGE "alsa-lib" |
| 164 | +
|
| 165 | +/* Define to the address where bug reports for this package should be sent. */ |
| 166 | +#define PACKAGE_BUGREPORT "" |
| 167 | +
|
| 168 | +/* Define to the full name of this package. */ |
| 169 | +#define PACKAGE_NAME "alsa-lib" |
| 170 | +
|
| 171 | +/* Define to the full name and version of this package. */ |
| 172 | +#define PACKAGE_STRING "alsa-lib 1.2.9" |
| 173 | +
|
| 174 | +/* Define to the one symbol short name of this package. */ |
| 175 | +#define PACKAGE_TARNAME "alsa-lib" |
| 176 | +
|
| 177 | +/* Define to the home page for this package. */ |
| 178 | +#define PACKAGE_URL "" |
| 179 | +
|
| 180 | +/* Define to the version of this package. */ |
| 181 | +#define PACKAGE_VERSION "1.2.9" |
| 182 | +
|
| 183 | +/* Max number of cards */ |
| 184 | +#define SND_MAX_CARDS 32 |
| 185 | +
|
| 186 | +/* Define to 1 if you have the ANSI C header files. */ |
| 187 | +#define STDC_HEADERS 1 |
| 188 | +
|
| 189 | +/* Support /dev/aload* access for auto-loading */ |
| 190 | +#define SUPPORT_ALOAD "1" |
| 191 | +
|
| 192 | +/* Support resmgr with alsa-lib */ |
| 193 | +/* #undef SUPPORT_RESMGR */ |
| 194 | +
|
| 195 | +/* Disable thread-safe API functions */ |
| 196 | +#define THREAD_SAFE_API "1" |
| 197 | +
|
| 198 | +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
| 199 | +#define TIME_WITH_SYS_TIME 1 |
| 200 | +
|
| 201 | +/* directory to put tmp socket files */ |
| 202 | +#define TMPDIR "/tmp" |
| 203 | +
|
| 204 | +/* Enable extensions on AIX 3, Interix. */ |
| 205 | +#ifndef _ALL_SOURCE |
| 206 | +# define _ALL_SOURCE 1 |
| 207 | +#endif |
| 208 | +/* Enable GNU extensions on systems that have them. */ |
| 209 | +#ifndef _GNU_SOURCE |
| 210 | +# define _GNU_SOURCE 1 |
| 211 | +#endif |
| 212 | +/* Enable threading extensions on Solaris. */ |
| 213 | +#ifndef _POSIX_PTHREAD_SEMANTICS |
| 214 | +# define _POSIX_PTHREAD_SEMANTICS 1 |
| 215 | +#endif |
| 216 | +/* Enable extensions on HP NonStop. */ |
| 217 | +#ifndef _TANDEM_SOURCE |
| 218 | +# define _TANDEM_SOURCE 1 |
| 219 | +#endif |
| 220 | +/* Enable general extensions on Solaris. */ |
| 221 | +#ifndef __EXTENSIONS__ |
| 222 | +# define __EXTENSIONS__ 1 |
| 223 | +#endif |
| 224 | +
|
| 225 | +
|
| 226 | +/* sound library version string */ |
| 227 | +#define VERSION "1.2.9" |
| 228 | +
|
| 229 | +/* compiled with versioned symbols */ |
| 230 | +#define VERSIONED_SYMBOLS /**/ |
| 231 | +
|
| 232 | +/* Define to 1 if on MINIX. */ |
| 233 | +/* #undef _MINIX */ |
| 234 | +
|
| 235 | +/* Define to 2 if the system does not provide POSIX.1 features except with |
| 236 | + this defined. */ |
| 237 | +/* #undef _POSIX_1_SOURCE */ |
| 238 | +
|
| 239 | +/* Define to 1 if you need to in order for `stat' and other things to work. */ |
| 240 | +/* #undef _POSIX_SOURCE */ |
| 241 | +
|
| 242 | +/* Toolchain Symbol Prefix */ |
| 243 | +#define __SYMBOL_PREFIX "" |
| 244 | +
|
| 245 | +/* Define to empty if `const' does not conform to ANSI C. */ |
| 246 | +/* #undef const */ |
| 247 | +
|
| 248 | +/* Define to `__inline__' or `__inline' if that's what the C compiler |
| 249 | + calls it, or to nothing if 'inline' is not supported under any name. */ |
| 250 | +#ifndef __cplusplus |
| 251 | +/* #undef inline */ |
| 252 | +#endif |
| 253 | +"""], |
| 254 | + newline = "unix", |
| 255 | +) |
| 256 | + |
| 257 | +INCLUDE = [ |
| 258 | + "include/config.h", |
| 259 | +] + glob([ |
| 260 | + "include/*.h", |
| 261 | + "include/sound/**/*.h", |
| 262 | +]) |
| 263 | + |
| 264 | +ALSA_INCLUDE = { |
| 265 | + src: "include/alsa/{}".format(src[len("include/"):]) |
| 266 | + for src in INCLUDE |
| 267 | +} |
| 268 | + |
| 269 | +# To avoid cyclic includes, the `alsa` directory is simply generated by the |
| 270 | +# contents of `include` ignoring that symlink. |
| 271 | +[ |
| 272 | + copy_file( |
| 273 | + name = "{}_h".format(out[:-len(".h")]), |
| 274 | + src = src, |
| 275 | + out = out, |
| 276 | + ) |
| 277 | + for src, out in ALSA_INCLUDE.items() |
| 278 | +] |
| 279 | + |
| 280 | +write_file( |
| 281 | + name = "src/control/ctl_symbols_list_c", |
| 282 | + out = "src/control/ctl_symbols_list.c", |
| 283 | + content = ["""\ |
| 284 | +&_snd_module_control_remap, |
| 285 | +&_snd_module_control_shm, |
| 286 | +&_snd_module_control_ext, |
| 287 | +"""], |
| 288 | + newline = "unix", |
| 289 | +) |
| 290 | + |
| 291 | +write_file( |
| 292 | + name = "src/pcm/pcm_symbols_list_c", |
| 293 | + out = "src/pcm/pcm_symbols_list.c", |
| 294 | + content = ["""\ |
| 295 | +&_snd_module_pcm_copy, |
| 296 | +&_snd_module_pcm_linear, |
| 297 | +&_snd_module_pcm_route, |
| 298 | +&_snd_module_pcm_mulaw, |
| 299 | +&_snd_module_pcm_alaw, |
| 300 | +&_snd_module_pcm_adpcm, |
| 301 | +&_snd_module_pcm_rate, |
| 302 | +&_snd_module_pcm_plug, |
| 303 | +&_snd_module_pcm_multi, |
| 304 | +&_snd_module_pcm_shm, |
| 305 | +&_snd_module_pcm_file, |
| 306 | +&_snd_module_pcm_null, |
| 307 | +&_snd_module_pcm_empty, |
| 308 | +&_snd_module_pcm_share, |
| 309 | +&_snd_module_pcm_meter, |
| 310 | +&_snd_module_pcm_hooks, |
| 311 | +&_snd_module_pcm_lfloat, |
| 312 | +&_snd_module_pcm_ladspa, |
| 313 | +&_snd_module_pcm_dmix, |
| 314 | +&_snd_module_pcm_dshare, |
| 315 | +&_snd_module_pcm_dsnoop, |
| 316 | +&_snd_module_pcm_asym, |
| 317 | +&_snd_module_pcm_iec958, |
| 318 | +&_snd_module_pcm_softvol, |
| 319 | +&_snd_module_pcm_extplug, |
| 320 | +&_snd_module_pcm_ioplug, |
| 321 | +&_snd_module_pcm_mmap_emul, |
| 322 | +"""], |
| 323 | + newline = "unix", |
| 324 | +) |
| 325 | + |
| 326 | +TEXTUAL_SRC_HDRS = [ |
| 327 | + "src/pcm/pcm_dmix_i386.c", |
| 328 | + "src/pcm/pcm_dmix_x86_64.c", |
| 329 | + "src/control/ctl_symbols_list.c", |
| 330 | + "src/alisp/alisp_snd.c", |
| 331 | + "src/pcm/pcm_dmix_generic.c", |
| 332 | + "src/pcm/pcm_symbols_list.c", |
| 333 | +] |
| 334 | + |
| 335 | +cc_library( |
| 336 | + name = "asound", |
| 337 | + srcs = glob( |
| 338 | + include = [ |
| 339 | + "src/**/*.c", |
| 340 | + ], |
| 341 | + exclude = TEXTUAL_SRC_HDRS, |
| 342 | + ), |
| 343 | + hdrs = INCLUDE + ALSA_INCLUDE.values(), |
| 344 | + copts = [ |
| 345 | + "-w", |
| 346 | + ], |
| 347 | + includes = [ |
| 348 | + "include", |
| 349 | + "src", |
| 350 | + "src/alisp", |
| 351 | + "src/control", |
| 352 | + "src/pcm", |
| 353 | + ], |
| 354 | + textual_hdrs = TEXTUAL_SRC_HDRS + glob([ |
| 355 | + "src/**/*.h", |
| 356 | + ]), |
| 357 | + visibility = ["//visibility:public"], |
| 358 | + deps = [ |
| 359 | + "@ncurses", |
| 360 | + ], |
| 361 | +) |
| 362 | + |
| 363 | +alias( |
| 364 | + name = "alsa_lib", |
| 365 | + actual = ":asound", |
| 366 | + visibility = ["//visibility:public"], |
| 367 | +) |
0 commit comments