diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5600faa --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +root = true +[*] +indent_style = space +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +charset = utf-8 + +[*.{build,css,doap,scss,ui,xml,xml.in,xml.in.in,yaml,yml}] +indent_size = 2 + +[*.{json,py,rs}] +indent_size = 4 + +[*.{c,h,h.in}] +indent_size = 2 +max_line_length = 80 + +[NEWS] +indent_size = 2 +max_line_length = 72 diff --git a/.gitignore b/.gitignore index dab1bb6..26b6664 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,16 @@ -/target -/libs -*.AppImage target/ build/ _build/ builddir/ build-aux/app -build-aux/.flatpak-builder/ +.flatpak-builder src/config.rs *.ui.in~ *.ui~ +.json~ .flatpak/ vendor -.flatpak-builder -*.json~ +flatpak_app +libs +*.AppImage + diff --git a/Cargo.lock b/Cargo.lock index 32c0493..1285092 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.56" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +checksum = "c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142" [[package]] name = "autocfg" @@ -22,15 +22,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytes" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "cairo-rs" -version = "0.15.10" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129e928d3eda625f53ce257589efbe5143416875fd01bddd08c8c6feb8b9962b" +checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" dependencies = [ "bitflags", "cairo-sys-rs", @@ -52,9 +52,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e068cb2806bbc15b439846dc16c5f89f8599f2c3e4d73d4449d38f9b2f0b6c5" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" dependencies = [ "smallvec", ] @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "fragile" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da1b8f89c5b5a5b7e59405cfcf0bb9588e5ed19f0b57a4cd542bbba3f164a6d" +checksum = "85dcb89d2b10c5f6133de2efd8c11959ce9dbb46a2f7a4cab208c4eeda6ce1ab" [[package]] name = "futures-channel" @@ -134,9 +134,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678516f1baef591d270ca10587c01a12542a731a7879cc62391a18191a470831" +checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" dependencies = [ "bitflags", "gdk-pixbuf-sys", @@ -160,9 +160,9 @@ dependencies = [ [[package]] name = "gdk4" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a2fc0bd03d59383fc10b71a8cb731a1fac2998732a36a0c03e9b1de1513218" +checksum = "4fabb7cf843c26b085a5d68abb95d0c0bf27a9ae2eeff9c4adb503a1eb580876" dependencies = [ "bitflags", "cairo-rs", @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "gdk4-sys" -version = "0.4.2" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48a39e34abe35ee2cf54a1e29dd983accecd113ad30bdead5050418fa92f2a1b" +checksum = "efe7dcb44f5c00aeabff3f69abfc5673de46559070f89bd3fbb7b66485d9cef2" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -193,9 +193,9 @@ dependencies = [ [[package]] name = "gio" -version = "0.15.10" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cd21a7a674ea811749661012512b0ba5237ba404ccbcab2850db5537549b64" +checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" dependencies = [ "bitflags", "futures-channel", @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.15.10" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a826fad715b57834920839d7a594c3b5e416358c7d790bdaba847a40d7c1d96d" +checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" dependencies = [ "bitflags", "futures-channel", @@ -243,9 +243,9 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac4d47c544af67747652ab1865ace0ffa1155709723ac4f32e97587dd4735b2" +checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64" dependencies = [ "anyhow", "heck", @@ -302,9 +302,9 @@ dependencies = [ [[package]] name = "gsk4" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d5a47a78c682bb67496b562495ed84972c0512ba0654888c4dc92b80a85bd3" +checksum = "05e9020d333280b3aa38d496495bfa9b50712eebf1ad63f0ec5bcddb5eb61be4" dependencies = [ "bitflags", "cairo-rs", @@ -318,9 +318,9 @@ dependencies = [ [[package]] name = "gsk4-sys" -version = "0.4.2" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31d21d7ce02ba261bb24c50c4ab238a10b41a2c97c32afffae29471b7cca69b" +checksum = "7add39ccf60078508c838643a2dcc91f045c46ed63b5ea6ab701b2e25bda3fea" dependencies = [ "cairo-sys-rs", "gdk4-sys", @@ -334,9 +334,9 @@ dependencies = [ [[package]] name = "gtk4" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5d40303dabe4608fc260de2bd7563da6f85bc90af956323f0cd8ae0abcfe03" +checksum = "c64f0c2a3d80e899dc3febddad5bac193ffcf74a0fd7e31037f30dd34d6f7396" dependencies = [ "bitflags", "cairo-rs", @@ -357,9 +357,9 @@ dependencies = [ [[package]] name = "gtk4-macros" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3c4aa605fb3d78205c7aef0eeaa6db61d8cc4dd05a465dc6ffdfdaee84f825" +checksum = "fafbcc920af4eb677d7d164853e7040b9de5a22379c596f570190c675d45f7a7" dependencies = [ "anyhow", "proc-macro-crate", @@ -372,9 +372,9 @@ dependencies = [ [[package]] name = "gtk4-sys" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47c075e8f795c38f6e9a47b51a73eab77b325f83c0154979ed4d4245c36490d" +checksum = "5bc8006eea634b7c72da3ff79e24606e45f21b3b832a3c5a1f543f5f97eb0f63" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "libadwaita" @@ -444,9 +444,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.121" +version = "0.2.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b" [[package]] name = "lock_api" @@ -460,18 +460,18 @@ dependencies = [ [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", @@ -506,9 +506,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "pango" @@ -537,9 +537,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", "parking_lot_core", @@ -560,18 +560,19 @@ dependencies = [ [[package]] name = "pest" -version = "2.1.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8" dependencies = [ + "thiserror", "ucd-trie", ] [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -581,16 +582,17 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "proc-macro-crate" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +checksum = "26d50bfb8c23f23915855a00d98b5a35ef2e0b871bb52937bacadb798fbb66c8" dependencies = [ + "once_cell", "thiserror", "toml", ] @@ -621,11 +623,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -639,27 +641,27 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.16" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] [[package]] name = "relm4" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c37490ffa536509d10dd6d57cf836b20729568b4cd2507b532445748560ccca" +checksum = "6e737555426b35a18e9f6fa8d291ce858d358504d441d1e0a7b06ce6c905cc63" dependencies = [ "fragile", "futures-core", @@ -672,9 +674,9 @@ dependencies = [ [[package]] name = "relm4-macros" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0df3a77e22dee74ce668daa437252e02a19252ae0eda49ebebb20b365afc52a" +checksum = "7136d9b9b97dc87198c619587de7bd61aca5ec4bec58a7167404c1edf750a490" dependencies = [ "proc-macro2", "quote", @@ -692,9 +694,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scopeguard" @@ -722,18 +724,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.136" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "e590c437916fb6b221e1d00df6e3294f3fccd70ca7e92541c475d6ed6ef5fee2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "34b5b8d809babe02f538c2cfec6f2c1ed10804c0e5a6a041a049a4f5588ccc2e" dependencies = [ "proc-macro2", "quote", @@ -742,9 +744,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ "itoa", "ryu", @@ -762,15 +764,18 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" @@ -784,13 +789,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.89" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -808,18 +813,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -828,10 +833,11 @@ dependencies = [ [[package]] name = "tokio" -version = "1.18.2" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" +checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" dependencies = [ + "autocfg", "bytes", "libc", "memchr", @@ -848,9 +854,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -859,16 +865,16 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "toolbx-tuner" -version = "0.0.0" +version = "0.0.1" dependencies = [ "relm4", "serde", @@ -878,15 +884,15 @@ dependencies = [ [[package]] name = "ucd-trie" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" [[package]] -name = "unicode-xid" -version = "0.2.2" +name = "unicode-ident" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "version-compare" diff --git a/Cargo.toml b/Cargo.toml index f0bbaa9..07bb28a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] -name = "toolbx-tuner" -version = "0.0.0" +name = "toolbxtuner" +version = "0.0.1" +authors = ["Hannes Kuchelmeister "] edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/build-aux/cargo.sh b/build-aux/cargo.sh deleted file mode 100644 index 3c37396..0000000 --- a/build-aux/cargo.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -export MESON_BUILD_ROOT="$1" -export MESON_SOURCE_ROOT="$2" -export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target -export CARGO_HOME="$MESON_BUILD_ROOT"/cargo-home -export OUTPUT="$3" -export BUILDTYPE="$4" -export APP_BIN="$5" - - -if [ $BUILDTYPE = "release" ] -then - echo "RELEASE MODE" - cargo build --manifest-path \ - "$MESON_SOURCE_ROOT"/Cargo.toml --release && \ - cp "$CARGO_TARGET_DIR"/release/"$APP_BIN" "$OUTPUT" -else - echo "DEBUG MODE" - cargo build --manifest-path \ - "$MESON_SOURCE_ROOT"/Cargo.toml && \ - cp "$CARGO_TARGET_DIR"/debug/"$APP_BIN" "$OUTPUT" -fi - diff --git a/build-aux/dist-vendor.sh b/build-aux/dist-vendor.sh new file mode 100644 index 0000000..be73278 --- /dev/null +++ b/build-aux/dist-vendor.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export DIST="$1" +export SOURCE_ROOT="$2" + +cd "$SOURCE_ROOT" +mkdir "$DIST"/.cargo +cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config +# Move vendor into dist tarball directory +mv vendor "$DIST" + diff --git a/build-aux/org.kuchelmeister.ToolbxTuner.Devel.json b/build-aux/org.kuchelmeister.ToolbxTuner.Devel.json new file mode 100644 index 0000000..eb9b43c --- /dev/null +++ b/build-aux/org.kuchelmeister.ToolbxTuner.Devel.json @@ -0,0 +1,46 @@ +{ + "id": "org.kuchelmeister.ToolbxTuner.Devel", + "runtime": "org.gnome.Platform", + "runtime-version": "42", + "sdk": "org.gnome.Sdk", + "sdk-extensions": [ + "org.freedesktop.Sdk.Extension.rust-stable" + ], + "command": "toolbxtuner", + "finish-args": [ + "--talk-name=org.freedesktop.Flatpak", + "--socket=fallback-x11", + "--socket=wayland", + "--device=dri", + "--env=RUST_LOG=toolbxtuner=debug", + "--env=G_MESSAGES_DEBUG=none", + "--env=RUST_BACKTRACE=1", + "--share=ipc" + ], + "build-options": { + "append-path": "/usr/lib/sdk/rust-stable/bin", + "build-args": [ + "--share=network" + ], + "test-args": [ + "--socket=x11", + "--share=network" + ] + }, + "modules": [ + { + "name": "toolbxtuner", + "buildsystem": "meson", + "run-tests": true, + "config-opts": [ + "-Dprofile=development" + ], + "sources": [ + { + "type": "dir", + "path": "../" + } + ] + } + ] +} diff --git a/build_install_from_repo.sh b/build_install_from_repo.sh deleted file mode 100755 index c77e4d3..0000000 --- a/build_install_from_repo.sh +++ /dev/null @@ -1,2 +0,0 @@ -flatpak run org.flatpak.Builder --user --install --force-clean build-dir org.kuchelmeister.toolbxtuner.json - diff --git a/build_install_local.sh b/build_install_local.sh index 225f912..65cec68 100755 --- a/build_install_local.sh +++ b/build_install_local.sh @@ -1,2 +1,2 @@ -flatpak run org.flatpak.Builder --user --install --force-clean build-dir org.kuchelmeister.toolbxtuner.dev.json +flatpak run org.flatpak.Builder --user --install --force-clean flatpak_app build-aux/org.kuchelmeister.ToolbxTuner.Devel.json diff --git a/hooks/pre-commit.hook b/hooks/pre-commit.hook new file mode 100755 index 0000000..cc44705 --- /dev/null +++ b/hooks/pre-commit.hook @@ -0,0 +1,57 @@ +#!/bin/sh +# Source: https://gitlab.gnome.org/GNOME/fractal/blob/master/hooks/pre-commit.hook + +install_rustfmt() { + if ! which rustup &> /dev/null; then + curl https://sh.rustup.rs -sSf | sh -s -- -y + export PATH=$PATH:$HOME/.cargo/bin + if ! which rustup &> /dev/null; then + echo "Failed to install rustup. Performing the commit without style checking." + exit 0 + fi + fi + + if ! rustup component list|grep rustfmt &> /dev/null; then + echo "Installing rustfmt…" + rustup component add rustfmt + fi +} + +if ! which cargo >/dev/null 2>&1 || ! cargo fmt --help >/dev/null 2>&1; then + echo "Unable to check the project’s code style, because rustfmt could not be run." + + if [ ! -t 1 ]; then + # No input is possible + echo "Performing commit." + exit 0 + fi + + echo "" + echo "y: Install rustfmt via rustup" + echo "n: Don't install rustfmt and perform the commit" + echo "Q: Don't install rustfmt and abort the commit" + + echo "" + while true + do + echo -n "Install rustfmt via rustup? [y/n/Q]: "; read yn < /dev/tty + case $yn in + [Yy]* ) install_rustfmt; break;; + [Nn]* ) echo "Performing commit."; exit 0;; + [Qq]* | "" ) echo "Aborting commit."; exit -1 >/dev/null 2>&1;; + * ) echo "Invalid input";; + esac + done + +fi + +echo "--Checking style--" +cargo fmt --all -- --check +if test $? != 0; then + echo "--Checking style fail--" + echo "Please fix the above issues, either manually or by running: cargo fmt --all" + + exit -1 +else + echo "--Checking style pass--" +fi diff --git a/meson.build b/meson.build index 70ee7de..4e0aa99 100644 --- a/meson.build +++ b/meson.build @@ -1,27 +1,71 @@ -project('toolbx-tuner', 'rust', - version: '0.1.0', - meson_version: '>= 0.59.0', - default_options: [ 'warning_level=2', - 'werror=false', - ], +project( + 'toolbxtuner', + 'rust', + version: '0.0.1', + meson_version: '>= 0.59', + license: 'GPL-3', ) i18n = import('i18n') - gnome = import('gnome') +base_id = 'org.kuchelmeister.ToolbxTuner' -cargo_sources = files( - 'Cargo.toml', - 'Cargo.lock', +dependency('glib-2.0', version: '>= 2.66') +dependency('gio-2.0', version: '>= 2.66') +dependency('gtk4', version: '>= 4.0.0') + +glib_compile_resources = find_program('glib-compile-resources', required: true) +glib_compile_schemas = find_program('glib-compile-schemas', required: true) +desktop_file_validate = find_program('desktop-file-validate', required: false) +appstream_util = find_program('appstream-util', required: false) +cargo = find_program('cargo', required: true) + +version = meson.project_version() + +prefix = get_option('prefix') +bindir = prefix / get_option('bindir') +localedir = prefix / get_option('localedir') + +datadir = prefix / get_option('datadir') +pkgdatadir = datadir / meson.project_name() +iconsdir = datadir / 'icons' +podir = meson.project_source_root() / 'po' +gettext_package = meson.project_name() + +if get_option('profile') == 'development' + profile = 'Devel' + vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() + if vcs_tag == '' + version_suffix = '-devel' + else + version_suffix = '-@0@'.format(vcs_tag) + endif + application_id = '@0@.@1@'.format(base_id, profile) +else + profile = '' + version_suffix = '' + application_id = base_id +endif + +meson.add_dist_script( + 'build-aux/dist-vendor.sh', + meson.project_build_root() / 'meson-dist' / meson.project_name() + '-' + version, + meson.project_source_root() ) +if get_option('profile') == 'development' + # Setup pre-commit hook for ensuring coding style is always consistent + message('Setting up git pre-commit hook..') + run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit') +endif + subdir('data') -subdir('src') subdir('po') +subdir('src') gnome.post_install( - glib_compile_schemas: true, gtk_update_icon_cache: true, + glib_compile_schemas: true, update_desktop_database: true, ) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..9f178cc --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,10 @@ +option( + 'profile', + type: 'combo', + choices: [ + 'default', + 'development' + ], + value: 'default', + description: 'The build profile for Toolbx Tuner. One of "default" or "development".' +) diff --git a/org.kuchelmeister.toolbxtuner.dev.json b/org.kuchelmeister.toolbxtuner.dev.json deleted file mode 100644 index ec44dc9..0000000 --- a/org.kuchelmeister.toolbxtuner.dev.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "app-id" : "org.kuchelmeister.toolbxtuner", - "runtime" : "org.gnome.Platform", - "runtime-version" : "42", - "sdk" : "org.gnome.Sdk", - "sdk-extensions" : [ - "org.freedesktop.Sdk.Extension.rust-stable" - ], - "command" : "toolbx-tuner", - "finish-args" : [ - "--share=network", - "--share=ipc", - "--socket=fallback-x11", - "--device=dri", - "--socket=wayland", - "--talk-name=org.freedesktop.Flatpak" - ], - "build-options" : { - "append-path" : "/usr/lib/sdk/rust-stable/bin", - "build-args" : [ - "--share=network" - ], - "env" : { - "RUST_BACKTRACE" : "1", - "RUST_LOG" : "toolbx-tuner=debug" - } - }, - "cleanup" : [ - "/include", - "/lib/pkgconfig", - "/man", - "/share/doc", - "/share/gtk-doc", - "/share/man", - "/share/pkgconfig", - "*.la", - "*.a" - ], - "modules" : [ - { - "name" : "toolbx-tuner", - "builddir" : true, - "buildsystem" : "meson", - "sources" : [ - { - "type" : "dir", - "path" : "." - } - ] - } - ] -} diff --git a/org.kuchelmeister.toolbxtuner.json b/org.kuchelmeister.toolbxtuner.json deleted file mode 100644 index 391c563..0000000 --- a/org.kuchelmeister.toolbxtuner.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "app-id" : "org.kuchelmeister.toolbxtuner", - "runtime" : "org.gnome.Platform", - "runtime-version" : "42", - "sdk" : "org.gnome.Sdk", - "sdk-extensions" : [ - "org.freedesktop.Sdk.Extension.rust-stable" - ], - "command" : "toolbx-tuner", - "finish-args" : [ - "--share=network", - "--share=ipc", - "--socket=fallback-x11", - "--device=dri", - "--socket=wayland", - "--talk-name=org.freedesktop.Flatpak" - ], - "build-options" : { - "append-path" : "/usr/lib/sdk/rust-stable/bin", - "build-args" : [ - "--share=network" - ], - "env" : { - "RUST_BACKTRACE" : "1", - "RUST_LOG" : "toolbx-tuner=debug" - } - }, - "cleanup" : [ - "/include", - "/lib/pkgconfig", - "/man", - "/share/doc", - "/share/gtk-doc", - "/share/man", - "/share/pkgconfig", - "*.la", - "*.a" - ], - "modules" : [ - { - "name" : "toolbx-tuner", - "builddir" : true, - "buildsystem" : "meson", - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/13hannes11/toolbx-tuner.git", - } - ] - } - ] -} diff --git a/po/POTFILES b/po/POTFILES deleted file mode 100644 index cfc1118..0000000 --- a/po/POTFILES +++ /dev/null @@ -1,3 +0,0 @@ -data/org.kuchelmeister.toolbxtuner.desktop.in -data/org.kuchelmeister.toolbxtuner.appdata.xml.in -data/org.kuchelmeister.toolbxtuner.gschema.xml diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..83bf505 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,4 @@ +data/org.kuchelmeister.ToolbxTuner.desktop.in.in +data/org.kuchelmeister.ToolbxTuner.gschema.xml.in +data/org.kuchelmeister.ToolbxTuner.metainfo.xml.in.in +src/application.rs diff --git a/po/meson.build b/po/meson.build index e8911ac..57d1266 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1 +1 @@ -i18n.gettext('toolbx-tuner', preset: 'glib') +i18n.gettext(gettext_package, preset: 'glib') diff --git a/src/config.rs.in b/src/config.rs.in index 1a24858..699897f 100644 --- a/src/config.rs.in +++ b/src/config.rs.in @@ -1,4 +1,7 @@ -pub static VERSION: &str = @VERSION@; -pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@; -pub static LOCALEDIR: &str = @LOCALEDIR@; -pub static PKGDATADIR: &str = @PKGDATADIR@; +pub const APP_ID: &str = @APP_ID@; +pub const GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@; +pub const LOCALEDIR: &str = @LOCALEDIR@; +pub const PKGDATADIR: &str = @PKGDATADIR@; +pub const PROFILE: &str = @PROFILE@; +pub const RESOURCES_FILE: &str = concat!(@PKGDATADIR@, "/resources.gresource"); +pub const VERSION: &str = @VERSION@; diff --git a/src/meson.build b/src/meson.build index 7eb2a77..d99036d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,76 +1,52 @@ -pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) -gnome = import('gnome') - -gnome.compile_resources('toolbx-tuner', - 'toolbx_tuner.gresource.xml', - gresource_bundle: true, - install: true, - install_dir: pkgdatadir, +global_conf = configuration_data() +global_conf.set_quoted('APP_ID', application_id) +global_conf.set_quoted('PKGDATADIR', pkgdatadir) +global_conf.set_quoted('PROFILE', profile) +global_conf.set_quoted('VERSION', version + version_suffix) +global_conf.set_quoted('GETTEXT_PACKAGE', gettext_package) +global_conf.set_quoted('LOCALEDIR', localedir) +config = configure_file( + input: 'config.rs.in', + output: 'config.rs', + configuration: global_conf ) - -conf = configuration_data() -conf.set_quoted('VERSION', meson.project_version()) -conf.set_quoted('GETTEXT_PACKAGE', 'toolbx-tuner') -conf.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) -conf.set_quoted('PKGDATADIR', pkgdatadir) - -configure_file( - input: 'config.rs.in', - output: 'config.rs', - configuration: conf -) - # Copy the config.rs output to the source directory. run_command( 'cp', - join_paths(meson.project_build_root(), 'src', 'config.rs'), - join_paths(meson.project_source_root(), 'src', 'config.rs'), + meson.project_build_root() / 'src' / 'config.rs', + meson.project_source_root() / 'src' / 'config.rs', check: true ) -rust_sources = files( - 'main.rs', - 'toolbx/mod.rs', - 'ui/mod.rs', - 'ui/ui_strings.rs', - 'ui/app/mod.rs', - 'ui/app/model.rs', - 'ui/app/widgets.rs', - 'ui/app/workers.rs', - 'ui/app/messages.rs', - 'ui/app/toolbox_list.rs', - 'ui/app/update.rs', - 'ui/components/mod.rs', - 'ui/components/toolbox_apps/factory.rs', - 'ui/components/toolbox_apps/messages.rs', - 'ui/components/toolbox_apps/mod.rs', - 'ui/components/toolbox_apps/model.rs', - 'ui/components/toolbox_apps/update.rs', - 'ui/components/toolbox_apps/widgets.rs', - 'ui/components/toolbox_settings/messages.rs', - 'ui/components/toolbox_settings/mod.rs', - 'ui/components/toolbox_settings/model.rs', - 'ui/components/toolbox_settings/update.rs', - 'ui/components/toolbox_settings/widgets.rs', -) +cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ] +cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ] -sources = [cargo_sources, rust_sources] +if get_option('profile') == 'default' + cargo_options += [ '--release' ] + rust_target = 'release' + message('Building in release mode') +else + rust_target = 'debug' + message('Building in debug mode') +endif -cargo_script = find_program(join_paths(meson.project_source_root(), 'build-aux/cargo.sh')) -cargo_release = custom_target( +cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ] + +cargo_build = custom_target( 'cargo-build', build_by_default: true, - input: sources, + build_always_stale: true, output: meson.project_name(), console: true, install: true, - install_dir: get_option('bindir'), + install_dir: bindir, + depends: resources, command: [ - cargo_script, - meson.project_build_root(), - meson.project_source_root(), - '@OUTPUT@', - get_option('buildtype'), - meson.project_name(), + 'env', + cargo_env, + cargo, 'build', + cargo_options, + '&&', + 'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@', ] ) diff --git a/src/toolbx_tuner.gresource.xml b/src/toolbx_tuner.gresource.xml deleted file mode 100644 index 99e9cbe..0000000 --- a/src/toolbx_tuner.gresource.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - -