From 0bed2a226301bc7392f37e5d14e8f67c7037f0eb Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 23 Jul 2023 17:54:35 -0500 Subject: [PATCH] build: remove outdated generated directory This only existed as essentially a workaround for meson's behavior and to maintain compatibility with the waf build. Since waf put everything in a generated subdirectory, we had to put make a subdirectory called "generated" in the source for meson so stuff could go to the right place. Well now we don't need to do that anymore. Move the meson.build files around so they go in the appropriate place in the subdirectory of the source tree and change the paths of the headers accordingly. A couple of important things to note. 1. mpv.com now gets made in build/player/mpv.com (necessary because of a meson limitation) 2. The macos icon generation path is shortened to TOOLS/osxbundle/icon.icns.inc. --- .../Resources => TOOLS/osxbundle}/meson.build | 0 common/version.c | 2 +- demux/ebml.c | 2 +- demux/ebml.h | 2 +- {generated/etc => etc}/meson.build | 0 generated/meson.build | 25 --------------- input/input.c | 2 +- input/meson.build | 20 ++++++++++++ meson.build | 31 ++++++++++++++----- osdep/macosx_application.m | 2 +- {generated/osdep => osdep}/meson.build | 0 osdep/mpv.rc | 2 +- player/javascript.c | 2 +- .../player => player}/javascript/meson.build | 0 player/lua.c | 16 +++++----- {generated/player => player}/lua/meson.build | 0 player/main.c | 2 +- player/meson.build | 10 ++++++ {generated/sub => sub}/meson.build | 0 sub/osd_libass.c | 2 +- video/out/cocoa_common.m | 2 +- {generated/wayland => video/out}/meson.build | 2 +- video/out/vo_dmabuf_wayland.c | 6 ++-- video/out/wayland_common.c | 20 ++++++------ video/out/x11_common.c | 8 ++--- 25 files changed, 89 insertions(+), 69 deletions(-) rename {generated/TOOLS/osxbundle/mpv.app/Contents/Resources => TOOLS/osxbundle}/meson.build (100%) rename {generated/etc => etc}/meson.build (100%) delete mode 100644 generated/meson.build create mode 100644 input/meson.build rename {generated/osdep => osdep}/meson.build (100%) rename {generated/player => player}/javascript/meson.build (100%) rename {generated/player => player}/lua/meson.build (100%) create mode 100644 player/meson.build rename {generated/sub => sub}/meson.build (100%) rename {generated/wayland => video/out}/meson.build (98%) diff --git a/generated/TOOLS/osxbundle/mpv.app/Contents/Resources/meson.build b/TOOLS/osxbundle/meson.build similarity index 100% rename from generated/TOOLS/osxbundle/mpv.app/Contents/Resources/meson.build rename to TOOLS/osxbundle/meson.build diff --git a/common/version.c b/common/version.c index 97c7345ecd..61f4018022 100644 --- a/common/version.c +++ b/common/version.c @@ -16,7 +16,7 @@ */ #include "common.h" -#include "generated/version.h" +#include "version.h" #ifdef NO_BUILD_TIMESTAMPS #undef BUILDDATE #define BUILDDATE "UNKNOWN" diff --git a/demux/ebml.c b/demux/ebml.c index 977bff43ee..7f62f1ff90 100644 --- a/demux/ebml.c +++ b/demux/ebml.c @@ -222,7 +222,7 @@ int ebml_resync_cluster(struct mp_log *log, stream_t *s) #define E_S(str, count) EVALARGS(E_SN, str, count, N) #define FN(id, name, multiple, N) { id, multiple, offsetof(struct ebml_ ## N, name), offsetof(struct ebml_ ## N, n_ ## name), &ebml_##name##_desc}, #define F(id, name, multiple) EVALARGS(FN, id, name, multiple, N) -#include "generated/ebml_defs.inc" +#include "ebml_defs.inc" #undef EVALARGS #undef SN #undef S diff --git a/demux/ebml.h b/demux/ebml.h index ceac05e00c..86a40092b6 100644 --- a/demux/ebml.h +++ b/demux/ebml.h @@ -63,7 +63,7 @@ struct ebml_parse_ctx { bool no_error_messages; }; -#include "generated/ebml_types.h" +#include "ebml_types.h" #define EBML_ID_INVALID 0xffffffff diff --git a/generated/etc/meson.build b/etc/meson.build similarity index 100% rename from generated/etc/meson.build rename to etc/meson.build diff --git a/generated/meson.build b/generated/meson.build deleted file mode 100644 index d240da4938..0000000000 --- a/generated/meson.build +++ /dev/null @@ -1,25 +0,0 @@ -ebml_defs = custom_target('ebml_defs.inc', - output: 'ebml_defs.inc', - command: [matroska, '--generate-definitions', '@OUTPUT@'], -) - -ebml_types = custom_target('ebml_types.h', - output: 'ebml_types.h', - command: [matroska, '--generate-header', '@OUTPUT@'], -) - -version_h = custom_target('version.h', - output: 'version.h', - command: [version_py, '@OUTPUT@'], - build_always_stale: true, -) - -sources += [ebml_defs, ebml_types, version_h] - -# Meson doesn't allow having multiple build targets with the same name in the same file. -# Just generate the com in here for windows builds. -if win32 and get_option('cplayer') - wrapper_sources= '../osdep/win32-console-wrapper.c' - executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode', - name_suffix: 'com', install: true) -endif diff --git a/input/input.c b/input/input.c index 03f75e40b7..07474dffa7 100644 --- a/input/input.c +++ b/input/input.c @@ -227,7 +227,7 @@ const struct m_sub_options input_config = { }; static const char builtin_input_conf[] = -#include "generated/etc/input.conf.inc" +#include "etc/input.conf.inc" ; static bool test_rect(struct mp_rect *rc, int x, int y) diff --git a/input/meson.build b/input/meson.build new file mode 100644 index 0000000000..12fe732b43 --- /dev/null +++ b/input/meson.build @@ -0,0 +1,20 @@ +icons = ['16', '32', '64', '128'] +foreach size: icons + name = 'mpv-icon-8bit-'+size+'x'+size+'.png' + icon = custom_target(name, + input: join_paths(source_root, 'etc', name), + output: name + '.inc', + command: [file2string, '@INPUT@', '@OUTPUT@'], + ) + sources += icon +endforeach + +etc_files = ['input.conf', 'builtin.conf'] +foreach file: etc_files + etc_file = custom_target(file, + input: join_paths(source_root, 'etc', file), + output: file + '.inc', + command: [file2string, '@INPUT@', '@OUTPUT@'], + ) + sources += etc_file +endforeach diff --git a/meson.build b/meson.build index 62b98b60a5..56d8888fc9 100644 --- a/meson.build +++ b/meson.build @@ -558,12 +558,29 @@ file2string = find_program(join_paths(tools_directory, 'file2string.py')) matroska = find_program(join_paths(tools_directory, 'matroska.py')) version_py = find_program(join_paths(source_root, 'version.py')) -subdir('generated') -subdir(join_paths('generated', 'etc')) -subdir(join_paths('generated', 'sub')) +ebml_defs = custom_target('ebml_defs.inc', + output: 'ebml_defs.inc', + command: [matroska, '--generate-definitions', '@OUTPUT@'], +) + +ebml_types = custom_target('ebml_types.h', + output: 'ebml_types.h', + command: [matroska, '--generate-header', '@OUTPUT@'], +) + +version_h = custom_target('version.h', + output: 'version.h', + command: [version_py, '@OUTPUT@'], + build_always_stale: true, +) +sources += [ebml_defs, ebml_types, version_h] + +subdir('etc') +subdir('player') +subdir('sub') if darwin - subdir(join_paths('generated', 'TOOLS', 'osxbundle', 'mpv.app', 'Contents', 'Resources')) + subdir(join_paths('TOOLS', 'osxbundle')) endif @@ -618,7 +635,6 @@ if features['javascript'] dependencies += javascript sources += files('player/javascript.c', 'sub/filter_jsre.c') - subdir(join_paths('generated', 'player', 'javascript')) endif lcms2 = dependency('lcms2', version: '>= 2.6', required: get_option('lcms2')) @@ -691,7 +707,6 @@ lua_version = lua.name() if features['lua'] dependencies += lua sources += files('player/lua.c') - subdir(join_paths('generated', 'player', 'lua')) endif if not features['lua'] and lua_opt == 'enabled' error('lua enabled but no suitable lua version could be found!') @@ -1004,7 +1019,7 @@ endforeach features += {'wayland': wayland_deps and wayland['header'] and wayland['scanner'].found()} if features['wayland'] - subdir(join_paths('generated', 'wayland')) + subdir(join_paths('video', 'out')) endif features += {'memfd_create': false} @@ -1571,7 +1586,7 @@ if features['macos-media-player'] endif if swift.allowed() - subdir(join_paths('generated', 'osdep')) + subdir('osdep') endif macos_touchbar = get_option('macos-touchbar').require( diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 95f6a9fcd2..f351088a47 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -147,7 +147,7 @@ static void terminate_cocoa_application(void) } static const char macosx_icon[] = -#include "generated/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns.inc" +#include "TOOLS/osxbundle/icon.icns.inc" ; - (NSImage *)getMPVIcon diff --git a/generated/osdep/meson.build b/osdep/meson.build similarity index 100% rename from generated/osdep/meson.build rename to osdep/meson.build diff --git a/osdep/mpv.rc b/osdep/mpv.rc index afc84ead5c..7deb785144 100644 --- a/osdep/mpv.rc +++ b/osdep/mpv.rc @@ -16,7 +16,7 @@ */ #include -#include "generated/version.h" +#include "version.h" VS_VERSION_INFO VERSIONINFO FILEVERSION 2, 0, 0, 0 diff --git a/player/javascript.c b/player/javascript.c index a43f38753b..ec14582575 100644 --- a/player/javascript.c +++ b/player/javascript.c @@ -51,7 +51,7 @@ // All these are generated from player/javascript/*.js static const char *const builtin_files[][3] = { {"@/defaults.js", -# include "generated/player/javascript/defaults.js.inc" +# include "player/javascript/defaults.js.inc" }, {0} }; diff --git a/generated/player/javascript/meson.build b/player/javascript/meson.build similarity index 100% rename from generated/player/javascript/meson.build rename to player/javascript/meson.build diff --git a/player/lua.c b/player/lua.c index 6a90d4f404..448bfa6fe7 100644 --- a/player/lua.c +++ b/player/lua.c @@ -56,28 +56,28 @@ // All these are generated from player/lua/*.lua static const char * const builtin_lua_scripts[][2] = { {"mp.defaults", -# include "generated/player/lua/defaults.lua.inc" +# include "player/lua/defaults.lua.inc" }, {"mp.assdraw", -# include "generated/player/lua/assdraw.lua.inc" +# include "player/lua/assdraw.lua.inc" }, {"mp.options", -# include "generated/player/lua/options.lua.inc" +# include "player/lua/options.lua.inc" }, {"@osc.lua", -# include "generated/player/lua/osc.lua.inc" +# include "player/lua/osc.lua.inc" }, {"@ytdl_hook.lua", -# include "generated/player/lua/ytdl_hook.lua.inc" +# include "player/lua/ytdl_hook.lua.inc" }, {"@stats.lua", -# include "generated/player/lua/stats.lua.inc" +# include "player/lua/stats.lua.inc" }, {"@console.lua", -# include "generated/player/lua/console.lua.inc" +# include "player/lua/console.lua.inc" }, {"@auto_profiles.lua", -# include "generated/player/lua/auto_profiles.lua.inc" +# include "player/lua/auto_profiles.lua.inc" }, {0} }; diff --git a/generated/player/lua/meson.build b/player/lua/meson.build similarity index 100% rename from generated/player/lua/meson.build rename to player/lua/meson.build diff --git a/player/main.c b/player/main.c index 8026f016aa..91b17dc66d 100644 --- a/player/main.c +++ b/player/main.c @@ -69,7 +69,7 @@ #include "screenshot.h" static const char def_config[] = -#include "generated/etc/builtin.conf.inc" +#include "etc/builtin.conf.inc" ; #if HAVE_COCOA diff --git a/player/meson.build b/player/meson.build new file mode 100644 index 0000000000..dc334b8c96 --- /dev/null +++ b/player/meson.build @@ -0,0 +1,10 @@ +subdir('javascript') +subdir('lua') + +# Meson doesn't allow having multiple build targets with the same name in the same file. +# Just generate the com in here for windows builds. +if win32 and get_option('cplayer') + wrapper_sources= '../osdep/win32-console-wrapper.c' + executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode', + name_suffix: 'com', install: true) +endif diff --git a/generated/sub/meson.build b/sub/meson.build similarity index 100% rename from generated/sub/meson.build rename to sub/meson.build diff --git a/sub/osd_libass.c b/sub/osd_libass.c index 1687f145b3..d4c0b1107a 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -29,7 +29,7 @@ #include "osd_state.h" static const char osd_font_pfb[] = -#include "generated/sub/osd_font.otf.inc" +#include "sub/osd_font.otf.inc" ; #include "sub/ass_mp.h" diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 222dde4520..5d5a423fe3 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -161,7 +161,7 @@ static void disable_power_management(struct vo_cocoa_state *s) } static const char macosx_icon[] = -#include "generated/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns.inc" +#include "TOOLS/osxbundle/icon.icns.inc" ; static void set_application_icon(NSApplication *app) diff --git a/generated/wayland/meson.build b/video/out/meson.build similarity index 98% rename from generated/wayland/meson.build rename to video/out/meson.build index ec2dc6e7f4..a254e508bb 100644 --- a/generated/wayland/meson.build +++ b/video/out/meson.build @@ -48,4 +48,4 @@ client_protocols = declare_dependency(link_with: lib_client_protocols, dependencies += [client_protocols, wayland['deps']] -sources += ['video/out/wayland_common.c'] +sources += files('wayland_common.c') diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c index ef1f767c1b..43c94882f2 100644 --- a/video/out/vo_dmabuf_wayland.c +++ b/video/out/vo_dmabuf_wayland.c @@ -41,11 +41,11 @@ #endif // Generated from wayland-protocols -#include "generated/wayland/linux-dmabuf-unstable-v1.h" -#include "generated/wayland/viewporter.h" +#include "linux-dmabuf-unstable-v1.h" +#include "viewporter.h" #if HAVE_WAYLAND_PROTOCOLS_1_27 -#include "generated/wayland/single-pixel-buffer-v1.h" +#include "single-pixel-buffer-v1.h" #endif // We need at least enough buffers to avoid a diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 2e6722c8c2..49412ee46c 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -35,24 +35,24 @@ #include "win_state.h" // Generated from wayland-protocols -#include "generated/wayland/idle-inhibit-unstable-v1.h" -#include "generated/wayland/linux-dmabuf-unstable-v1.h" -#include "generated/wayland/presentation-time.h" -#include "generated/wayland/xdg-decoration-unstable-v1.h" -#include "generated/wayland/xdg-shell.h" -#include "generated/wayland/viewporter.h" +#include "idle-inhibit-unstable-v1.h" +#include "linux-dmabuf-unstable-v1.h" +#include "presentation-time.h" +#include "xdg-decoration-unstable-v1.h" +#include "xdg-shell.h" +#include "viewporter.h" #if HAVE_WAYLAND_PROTOCOLS_1_27 -#include "generated/wayland/content-type-v1.h" -#include "generated/wayland/single-pixel-buffer-v1.h" +#include "content-type-v1.h" +#include "single-pixel-buffer-v1.h" #endif #if HAVE_WAYLAND_PROTOCOLS_1_31 -#include "generated/wayland/fractional-scale-v1.h" +#include "fractional-scale-v1.h" #endif #if HAVE_WAYLAND_PROTOCOLS_1_32 -#include "generated/wayland/cursor-shape-v1.h" +#include "cursor-shape-v1.h" #endif #if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 22 diff --git a/video/out/x11_common.c b/video/out/x11_common.c index b3bdf1c014..03d624ac0c 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -110,19 +110,19 @@ typedef struct } MotifWmHints; static const char x11_icon_16[] = -#include "generated/etc/mpv-icon-8bit-16x16.png.inc" +#include "etc/mpv-icon-8bit-16x16.png.inc" ; static const char x11_icon_32[] = -#include "generated/etc/mpv-icon-8bit-32x32.png.inc" +#include "etc/mpv-icon-8bit-32x32.png.inc" ; static const char x11_icon_64[] = -#include "generated/etc/mpv-icon-8bit-64x64.png.inc" +#include "etc/mpv-icon-8bit-64x64.png.inc" ; static const char x11_icon_128[] = -#include "generated/etc/mpv-icon-8bit-128x128.png.inc" +#include "etc/mpv-icon-8bit-128x128.png.inc" ; #define ICON_ENTRY(var) { (char *)var, sizeof(var) }