mirror of
https://github.com/TakeV-Lambda/Tooth.git
synced 2024-11-21 14:34:36 +00:00
chore: build system cleanup (#39)
Co-authored-by: Evangelos Paterakis <evan@geopjr.dev>
This commit is contained in:
parent
cba8078930
commit
b34191ee2c
21 changed files with 199 additions and 170 deletions
|
@ -3,6 +3,11 @@
|
|||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "43",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"sdk-extensions" : ["org.freedesktop.Sdk.Extension.vala"],
|
||||
"build-options" : {
|
||||
"prepend-path" : "/usr/lib/sdk/vala/bin/",
|
||||
"prepend-ld-library-path" : "/usr/lib/sdk/vala/lib"
|
||||
},
|
||||
"command": "dev.geopjr.tooth",
|
||||
"finish-args": [
|
||||
"--device=dri",
|
||||
|
|
144
meson.build
144
meson.build
|
@ -9,28 +9,21 @@ project(
|
|||
],
|
||||
)
|
||||
|
||||
add_global_arguments(
|
||||
[
|
||||
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
|
||||
],
|
||||
language: 'c',
|
||||
)
|
||||
|
||||
devel = get_option('devel')
|
||||
|
||||
# Setup configuration file, accessed via vapi/build.vapi
|
||||
config = configuration_data()
|
||||
config.set('EXEC_NAME', meson.project_name())
|
||||
config.set('GETTEXT_PACKAGE', meson.project_name())
|
||||
config.set('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/')
|
||||
config.set('VERSION', meson.project_version())
|
||||
config.set('PREFIX', get_option('prefix'))
|
||||
config.set('PROFILE', devel ? 'development' : 'production')
|
||||
config.set('NAME', 'Tooth')
|
||||
config.set('WEBSITE', 'https://github.com/GeopJr/tooth')
|
||||
config.set('SUPPORT_WEBSITE', 'https://github.com/GeopJr/tooth/issues')
|
||||
config.set(
|
||||
'COPYRIGHT',
|
||||
'© 2022 bleak_grey\n© 2022 Evangelos \"GeopJr\" Paterakis',
|
||||
)
|
||||
config.set_quoted('EXEC_NAME', meson.project_name())
|
||||
config.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
||||
config.set_quoted('DOMAIN', meson.project_name ())
|
||||
config.set_quoted('G_LOG_DOMAIN', 'Tooth')
|
||||
config.set_quoted('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/')
|
||||
config.set_quoted('VERSION', meson.project_version())
|
||||
config.set_quoted('PREFIX', get_option('prefix'))
|
||||
config.set_quoted('NAME', 'Tooth')
|
||||
config.set_quoted('WEBSITE', 'https://github.com/GeopJr/tooth')
|
||||
config.set_quoted('SUPPORT_WEBSITE', 'https://github.com/GeopJr/tooth/issues')
|
||||
config.set_quoted('PROFILE', devel ? 'development' : 'production')
|
||||
|
||||
if devel
|
||||
git = find_program('git')
|
||||
|
@ -38,10 +31,18 @@ if devel
|
|||
branch = run_command('git', 'branch', '--show-current', check: true).stdout().strip()
|
||||
revision = run_command('git', 'rev-parse', '--short', 'HEAD', check: true).stdout().strip()
|
||||
version = '@0@-@1@'.format(branch, revision)
|
||||
config.set('VERSION', version)
|
||||
config.set_quoted('VERSION', version)
|
||||
endif
|
||||
endif
|
||||
|
||||
configure_file(output: 'config.h', configuration: config)
|
||||
|
||||
add_project_arguments (
|
||||
'--include','config.h',
|
||||
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
|
||||
language: 'c'
|
||||
)
|
||||
|
||||
gnome = import('gnome')
|
||||
i18n = import('i18n')
|
||||
|
||||
|
@ -56,110 +57,13 @@ libgtk_dep = dependency('gtk4', version: '>=4.0.0', required: true)
|
|||
libadwaita_dep = dependency('libadwaita-1', version: '>=1.2', required: true)
|
||||
|
||||
sources = files(
|
||||
'src/API/Account.vala',
|
||||
'src/API/AccountField.vala',
|
||||
'src/API/Attachment.vala',
|
||||
'src/API/Conversation.vala',
|
||||
'src/API/Emoji.vala',
|
||||
'src/API/EmojiReaction.vala',
|
||||
'src/API/Entity.vala',
|
||||
'src/API/Instance.vala',
|
||||
'src/API/Instance/Mastodon/Configuration.vala',
|
||||
'src/API/Instance/Mastodon/Configuration/MediaAttachments.vala',
|
||||
'src/API/Instance/Mastodon/Configuration/Polls.vala',
|
||||
'src/API/Instance/Mastodon/Configuration/Reactions.vala',
|
||||
'src/API/Instance/Mastodon/Configuration/Statuses.vala',
|
||||
'src/API/List.vala',
|
||||
'src/API/Mention.vala',
|
||||
'src/API/Notification.vala',
|
||||
'src/API/Pleroma.vala',
|
||||
'src/API/Relationship.vala',
|
||||
'src/API/SearchResults.vala',
|
||||
'src/API/Status.vala',
|
||||
'src/API/Tag.vala',
|
||||
'src/API/TagHistory.vala',
|
||||
'src/API/Poll.vala',
|
||||
'src/API/PollOption.vala',
|
||||
'src/Application.vala',
|
||||
'src/Dialogs/Composer/AttachmentsPage.vala',
|
||||
'src/Dialogs/Composer/AttachmentsPageAttachment.vala',
|
||||
'src/Dialogs/Composer/Dialog.vala',
|
||||
'src/Dialogs/Composer/EditorPage.vala',
|
||||
'src/Dialogs/Composer/Page.vala',
|
||||
'src/Dialogs/Composer/PollPage.vala',
|
||||
'src/Dialogs/MainWindow.vala',
|
||||
'src/Dialogs/NewAccount.vala',
|
||||
'src/Dialogs/Preferences.vala',
|
||||
'src/Dialogs/Saveable.vala',
|
||||
'src/Services/Accounts/AccountHolder.vala',
|
||||
'src/Services/Accounts/AccountStore.vala',
|
||||
'src/Services/Accounts/InstanceAccount.vala',
|
||||
'src/Services/Accounts/Mastodon/Account.vala',
|
||||
'src/Services/Accounts/Places.vala',
|
||||
'src/Services/Accounts/SecretAccountStore.vala',
|
||||
'src/Services/Cache/AbstractCache.vala',
|
||||
'src/Services/Cache/EntityCache.vala',
|
||||
'src/Services/Cache/ImageCache.vala',
|
||||
'src/Services/Network/Network.vala',
|
||||
'src/Services/Network/Request.vala',
|
||||
'src/Services/Network/Streamable.vala',
|
||||
'src/Services/Network/Streams.vala',
|
||||
'src/Services/Settings.vala',
|
||||
'src/Utils/DateTime.vala',
|
||||
'src/Utils/Host.vala',
|
||||
'src/Utils/Html.vala',
|
||||
'src/Views/Base.vala',
|
||||
'src/Views/Bookmarks.vala',
|
||||
'src/Views/ContentBase.vala',
|
||||
'src/Views/Conversations.vala',
|
||||
'src/Views/EditHistory.vala',
|
||||
'src/Views/Favorites.vala',
|
||||
'src/Views/Federated.vala',
|
||||
'src/Views/Hashtag.vala',
|
||||
'src/Views/Home.vala',
|
||||
'src/Views/List.vala',
|
||||
'src/Views/Lists.vala',
|
||||
'src/Views/Local.vala',
|
||||
'src/Views/FollowRequests.vala',
|
||||
'src/Views/Main.vala',
|
||||
'src/Views/Notifications.vala',
|
||||
'src/Views/Profile.vala',
|
||||
'src/Views/Search.vala',
|
||||
'src/Views/Sidebar.vala',
|
||||
'src/Views/TabbedBase.vala',
|
||||
'src/Views/Thread.vala',
|
||||
'src/Views/Timeline.vala',
|
||||
'src/Widgets/Attachment/Box.vala',
|
||||
'src/Widgets/Attachment/Image.vala',
|
||||
'src/Widgets/Attachment/Item.vala',
|
||||
'src/Widgets/Avatar.vala',
|
||||
'src/Widgets/Background.vala',
|
||||
'src/Widgets/Conversation.vala',
|
||||
'src/Widgets/Emoji.vala',
|
||||
'src/Widgets/LockableToggleButton.vala',
|
||||
'src/Widgets/MarkupView.vala',
|
||||
'src/Widgets/Notification.vala',
|
||||
'src/Widgets/RelationshipButton.vala',
|
||||
'src/Widgets/RichLabel.vala',
|
||||
'src/Widgets/RichLabelContainer.vala',
|
||||
'src/Widgets/EmojiLabel.vala',
|
||||
'src/Widgets/Status.vala',
|
||||
'src/Widgets/StatusActionButton.vala',
|
||||
'src/Widgets/Widgetizable.vala',
|
||||
'src/Widgets/VoteBox.vala',
|
||||
'src/Widgets/VoteCheckButton.vala',
|
||||
)
|
||||
|
||||
build_file = configure_file(
|
||||
input: 'src/Build.vala.in',
|
||||
output: 'Build.vala',
|
||||
configuration: config,
|
||||
'vapi/build.vapi',
|
||||
)
|
||||
subdir('src')
|
||||
|
||||
executable(
|
||||
meson.project_name(),
|
||||
asresources,
|
||||
build_file,
|
||||
sources,
|
||||
dependencies: [
|
||||
dependency('glib-2.0', version: '>=2.70'),
|
||||
|
|
6
src/API/Instance/Mastodon/Configuration/meson.build
Normal file
6
src/API/Instance/Mastodon/Configuration/meson.build
Normal file
|
@ -0,0 +1,6 @@
|
|||
sources += files(
|
||||
'MediaAttachments.vala',
|
||||
'Polls.vala',
|
||||
'Reactions.vala',
|
||||
'Statuses.vala',
|
||||
)
|
5
src/API/Instance/Mastodon/meson.build
Normal file
5
src/API/Instance/Mastodon/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
sources += files(
|
||||
'Configuration.vala',
|
||||
)
|
||||
|
||||
subdir('Configuration')
|
1
src/API/Instance/meson.build
Normal file
1
src/API/Instance/meson.build
Normal file
|
@ -0,0 +1 @@
|
|||
subdir('Mastodon')
|
23
src/API/meson.build
Normal file
23
src/API/meson.build
Normal file
|
@ -0,0 +1,23 @@
|
|||
sources += files(
|
||||
'Account.vala',
|
||||
'AccountField.vala',
|
||||
'Attachment.vala',
|
||||
'Conversation.vala',
|
||||
'Emoji.vala',
|
||||
'EmojiReaction.vala',
|
||||
'Entity.vala',
|
||||
'Instance.vala',
|
||||
'List.vala',
|
||||
'Mention.vala',
|
||||
'Notification.vala',
|
||||
'Pleroma.vala',
|
||||
'Poll.vala',
|
||||
'PollOption.vala',
|
||||
'Relationship.vala',
|
||||
'SearchResults.vala',
|
||||
'Status.vala',
|
||||
'Tag.vala',
|
||||
'TagHistory.vala',
|
||||
)
|
||||
|
||||
subdir('Instance')
|
|
@ -97,7 +97,10 @@ namespace Tooth {
|
|||
protected override void startup () {
|
||||
base.startup ();
|
||||
try {
|
||||
Build.print_info ();
|
||||
var lines = troubleshooting.split ("\n");
|
||||
foreach (unowned string line in lines) {
|
||||
message (line);
|
||||
}
|
||||
Adw.init ();
|
||||
|
||||
settings = new Settings ();
|
||||
|
@ -207,7 +210,9 @@ namespace Tooth {
|
|||
refresh ();
|
||||
}
|
||||
|
||||
string troubleshooting = "flatpak: %s\nversion: %s (%s)\ngtk: %u.%u.%u (%d.%d.%d)\nlibadwaita: %u.%u.%u (%d.%d.%d)\nlibsoup: %u.%u.%u (%d.%d.%d)\n".printf(
|
||||
string troubleshooting = "os: %s %s\nprefix: %s\nflatpak: %s\nversion: %s (%s)\ngtk: %u.%u.%u (%d.%d.%d)\nlibadwaita: %u.%u.%u (%d.%d.%d)\nlibsoup: %u.%u.%u (%d.%d.%d)\n".printf(
|
||||
GLib.Environment.get_os_info ("NAME"), GLib.Environment.get_os_info ("VERSION"),
|
||||
Build.PREFIX,
|
||||
(GLib.Environment.get_variable("FLATPAK_ID") != null || GLib.File.new_for_path("/.flatpak-info").query_exists()).to_string(),
|
||||
Build.VERSION, Build.PROFILE,
|
||||
Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version(),
|
||||
|
@ -219,15 +224,17 @@ namespace Tooth {
|
|||
);
|
||||
|
||||
void about_activated () {
|
||||
const string[] artists = {
|
||||
const string[] ARTISTS = {
|
||||
"Tobias Bernard"
|
||||
};
|
||||
|
||||
const string[] developers = {
|
||||
const string[] DEVELOPERS = {
|
||||
"bleak_grey",
|
||||
"Evangelos \"GeopJr\" Paterakis"
|
||||
};
|
||||
|
||||
const string COPYRIGHT = "© 2022 bleak_grey\n© 2022 Evangelos \"GeopJr\" Paterakis";
|
||||
|
||||
var dialog = new Adw.AboutWindow () {
|
||||
transient_for = main_window,
|
||||
modal = true,
|
||||
|
@ -237,13 +244,13 @@ namespace Tooth {
|
|||
version = Build.VERSION,
|
||||
support_url = Build.SUPPORT_WEBSITE,
|
||||
license_type = License.GPL_3_0_ONLY,
|
||||
copyright = Build.COPYRIGHT,
|
||||
debug_info = Build.SYSTEM_INFO,
|
||||
developers = developers,
|
||||
artists = artists,
|
||||
copyright = COPYRIGHT,
|
||||
developers = DEVELOPERS,
|
||||
artists = ARTISTS,
|
||||
debug_info = troubleshooting,
|
||||
debug_info_filename = @"$(Build.NAME).txt",
|
||||
translator_credits = Build.TRANSLATOR != " " ? Build.TRANSLATOR : ""
|
||||
// translators: Name <email@domain.com> or Name https://website.example
|
||||
translator_credits = _("translator-credits")
|
||||
};
|
||||
|
||||
// For some obscure reason, const arrays produce duplicates in the credits.
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
public class Build {
|
||||
|
||||
public const string NAME = "@NAME@";
|
||||
public const string VERSION = "@VERSION@";
|
||||
public const string DOMAIN = "@EXEC_NAME@";
|
||||
public const string RESOURCES = "@RESOURCES@";
|
||||
public const string WEBSITE = "@WEBSITE@";
|
||||
public const string SUPPORT_WEBSITE = "@SUPPORT_WEBSITE@";
|
||||
public const string COPYRIGHT = "@COPYRIGHT@";
|
||||
public const string PREFIX = "@PREFIX@";
|
||||
public const string PROFILE = "@PROFILE@";
|
||||
|
||||
public static string SYSTEM_INFO;
|
||||
|
||||
// Please do not remove the credits below. You may add your own, but keep the existing ones intact.
|
||||
|
||||
// TRANSLATORS: Replace this with your name. It will be displayed in the About dialog.
|
||||
public const string TRANSLATOR = _(" ");
|
||||
|
||||
public static string print_info () {
|
||||
var os_name = get_os_info ("NAME");
|
||||
var os_ver = get_os_info ("VERSION");
|
||||
|
||||
SYSTEM_INFO = @"$NAME $VERSION";
|
||||
SYSTEM_INFO += @"\nRunning on: $os_name $os_ver";
|
||||
SYSTEM_INFO += @"\nBuild prefix: \"$PREFIX\"";
|
||||
SYSTEM_INFO += @"\nBuild profile: \"$PROFILE\"";
|
||||
|
||||
var lines = SYSTEM_INFO.split ("\n");
|
||||
foreach (unowned string line in lines) {
|
||||
message (line);
|
||||
}
|
||||
|
||||
return SYSTEM_INFO;
|
||||
}
|
||||
|
||||
static string get_os_info (string key) {
|
||||
return GLib.Environment.get_os_info (key) ?? "Unknown";
|
||||
}
|
||||
|
||||
}
|
8
src/Dialogs/Composer/meson.build
Normal file
8
src/Dialogs/Composer/meson.build
Normal file
|
@ -0,0 +1,8 @@
|
|||
sources += files(
|
||||
'AttachmentsPage.vala',
|
||||
'AttachmentsPageAttachment.vala',
|
||||
'Dialog.vala',
|
||||
'EditorPage.vala',
|
||||
'Page.vala',
|
||||
'PollPage.vala',
|
||||
)
|
8
src/Dialogs/meson.build
Normal file
8
src/Dialogs/meson.build
Normal file
|
@ -0,0 +1,8 @@
|
|||
sources += files(
|
||||
'MainWindow.vala',
|
||||
'NewAccount.vala',
|
||||
'Preferences.vala',
|
||||
'Saveable.vala',
|
||||
)
|
||||
|
||||
subdir('Composer')
|
3
src/Services/Accounts/Mastodon/meson.build
Normal file
3
src/Services/Accounts/Mastodon/meson.build
Normal file
|
@ -0,0 +1,3 @@
|
|||
sources += files(
|
||||
'Account.vala',
|
||||
)
|
9
src/Services/Accounts/meson.build
Normal file
9
src/Services/Accounts/meson.build
Normal file
|
@ -0,0 +1,9 @@
|
|||
sources += files(
|
||||
'AccountHolder.vala',
|
||||
'AccountStore.vala',
|
||||
'InstanceAccount.vala',
|
||||
'Places.vala',
|
||||
'SecretAccountStore.vala',
|
||||
)
|
||||
|
||||
subdir('Mastodon')
|
5
src/Services/Cache/meson.build
Normal file
5
src/Services/Cache/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
sources += files(
|
||||
'AbstractCache.vala',
|
||||
'EntityCache.vala',
|
||||
'ImageCache.vala',
|
||||
)
|
6
src/Services/Network/meson.build
Normal file
6
src/Services/Network/meson.build
Normal file
|
@ -0,0 +1,6 @@
|
|||
sources += files(
|
||||
'Network.vala',
|
||||
'Request.vala',
|
||||
'Streamable.vala',
|
||||
'Streams.vala',
|
||||
)
|
7
src/Services/meson.build
Normal file
7
src/Services/meson.build
Normal file
|
@ -0,0 +1,7 @@
|
|||
sources += files(
|
||||
'Settings.vala',
|
||||
)
|
||||
|
||||
subdir('Accounts')
|
||||
subdir('Cache')
|
||||
subdir('Network')
|
5
src/Utils/meson.build
Normal file
5
src/Utils/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
sources += files(
|
||||
'DateTime.vala',
|
||||
'Host.vala',
|
||||
'Html.vala',
|
||||
)
|
23
src/Views/meson.build
Normal file
23
src/Views/meson.build
Normal file
|
@ -0,0 +1,23 @@
|
|||
sources += files(
|
||||
'Base.vala',
|
||||
'Bookmarks.vala',
|
||||
'ContentBase.vala',
|
||||
'Conversations.vala',
|
||||
'EditHistory.vala',
|
||||
'Favorites.vala',
|
||||
'Federated.vala',
|
||||
'FollowRequests.vala',
|
||||
'Hashtag.vala',
|
||||
'Home.vala',
|
||||
'List.vala',
|
||||
'Lists.vala',
|
||||
'Local.vala',
|
||||
'Main.vala',
|
||||
'Notifications.vala',
|
||||
'Profile.vala',
|
||||
'Search.vala',
|
||||
'Sidebar.vala',
|
||||
'TabbedBase.vala',
|
||||
'Thread.vala',
|
||||
'Timeline.vala',
|
||||
)
|
5
src/Widgets/Attachment/meson.build
Normal file
5
src/Widgets/Attachment/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
sources += files(
|
||||
'Box.vala',
|
||||
'Image.vala',
|
||||
'Item.vala',
|
||||
)
|
20
src/Widgets/meson.build
Normal file
20
src/Widgets/meson.build
Normal file
|
@ -0,0 +1,20 @@
|
|||
sources += files(
|
||||
'Avatar.vala',
|
||||
'Background.vala',
|
||||
'Conversation.vala',
|
||||
'Emoji.vala',
|
||||
'EmojiLabel.vala',
|
||||
'LockableToggleButton.vala',
|
||||
'MarkupView.vala',
|
||||
'Notification.vala',
|
||||
'RelationshipButton.vala',
|
||||
'RichLabel.vala',
|
||||
'RichLabelContainer.vala',
|
||||
'Status.vala',
|
||||
'StatusActionButton.vala',
|
||||
'VoteBox.vala',
|
||||
'VoteCheckButton.vala',
|
||||
'Widgetizable.vala',
|
||||
)
|
||||
|
||||
subdir('Attachment')
|
8
src/meson.build
Normal file
8
src/meson.build
Normal file
|
@ -0,0 +1,8 @@
|
|||
sources += files('Application.vala')
|
||||
|
||||
subdir('API')
|
||||
subdir('Dialogs')
|
||||
subdir('Services')
|
||||
subdir('Utils')
|
||||
subdir('Views')
|
||||
subdir('Widgets')
|
12
vapi/build.vapi
Normal file
12
vapi/build.vapi
Normal file
|
@ -0,0 +1,12 @@
|
|||
[CCode (cprefix="", lower_case_cprefix = "", cheader_filename = "config.h")]
|
||||
namespace Build {
|
||||
public const string NAME;
|
||||
public const string VERSION;
|
||||
public const string DOMAIN;
|
||||
public const string RESOURCES;
|
||||
public const string PROFILE;
|
||||
|
||||
public const string WEBSITE;
|
||||
public const string SUPPORT_WEBSITE;
|
||||
public const string PREFIX;
|
||||
}
|
Loading…
Reference in a new issue