From nobody Sun Apr 28 23:47:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1642693694; cv=none; d=zohomail.com; s=zohoarc; b=BbjoMYU1lkENEkmJosDodo/wVBg0h/fyIyC8z6+Pa87DReMntHn8eSIOR6VevmlOpQTtqT+fVz0Xaxra+VGq8a0zkGsLfieQoKppBgTT2OMU+RGZal6MSJa4OlVBviidZbs1824aMBoHtW9N6Q96qm/bOZIHqhlfWpDfoAmWeLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642693694; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=iwa0QiMM09QiGRtM8OJblJuEzGH+8VDB6vPus4TXTRg=; b=F9R/K+TZcT8jr8h/z4p8e2Kq9T7pIJDwQs8XnLArW/Wrv7FyMSWcU+minIDlJmDhFJPnu+ZsjeawUDiF/J+de1atv+qXIGzTOnFcM1ntHIw+EH2trdnOoh8Z4EcTv22pp7PkbgLT5SaNDzxkQqxmGsBxSIzD/y1vqfGuuJEKsOM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1642693694300119.35867371268876; Thu, 20 Jan 2022 07:48:14 -0800 (PST) Received: from localhost ([::1]:55472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAZfY-0005bc-6R for importer@patchew.org; Thu, 20 Jan 2022 10:48:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAVk1-0007X3-7h for qemu-devel@nongnu.org; Thu, 20 Jan 2022 06:36:33 -0500 Received: from [2a00:1450:4864:20::52d] (port=33772 helo=mail-ed1-x52d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAVjy-0002YP-4o for qemu-devel@nongnu.org; Thu, 20 Jan 2022 06:36:32 -0500 Received: by mail-ed1-x52d.google.com with SMTP id b13so27609040edn.0 for ; Thu, 20 Jan 2022 03:36:29 -0800 (PST) Received: from localhost.localdomain ([188.25.251.197]) by smtp.gmail.com with ESMTPSA id e12sm20652eje.18.2022.01.20.03.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 03:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=livius-net.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iwa0QiMM09QiGRtM8OJblJuEzGH+8VDB6vPus4TXTRg=; b=YO+aA31ilg85rJTzkM0TwO0RGsaClBtcYzcZ91s3qLi3bpCtKrkOW098Q84FqqeXgs PJvqERhvnQZottjX4cqVqRiUqUQRpTCRwmQ9HFjqHKy9SI//OaURqQqv/WUfFhweyFHt XNOIuOJf/4AoZnxNGx8lNJYWmSQ2+Ovw/7RFVhCmGNHWXtz7DwVEh1khMUFwyjnTEchW of2lDzVhJEsj/7dN1JTXxTLEZRhpDVFIbYDJy73MNKW827vkjYZjS0ufDbrKxSzmtluo 3iHJ9u6del38mAorw0LPZIfJeOWo7olMBv2gVioiR3ePFF0a2NDzzytoPr3A9D7pisc4 g4Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iwa0QiMM09QiGRtM8OJblJuEzGH+8VDB6vPus4TXTRg=; b=R39KlPStgd8B2AIsb1kdzSpAmnU9QMw3kqBfCmAPVUV5srhHrMUbIiDcn+KyEdfDdg CRHhcPf9XrVV82CwsPCm0tTlqhGvtGrRXAwwRf9M6T9F02XoJqP/4HNR/psbPLKW8FkH ej0OA3YKZuNf19SCekXvirE5JxyA8LMaKaj85qYv9g+9nPS8lqdeSBgearIyQBeNdNsI vlog7UZ4iroTjirU9v883CqQB5EB0wiN4iASfOccfPDVnb1Xt1Z5cvHZrL9iVgyuTxsK JgsXn+qW0dwR184vXFzdFUEJnhBh9SU3yCXJ69tljSKHC/bWsCfCh2V5eCwRdUmscdW/ rZLw== X-Gm-Message-State: AOAM5306eycHPmagGp83tfXrze0kB1v5lSFxV1Ctn2wav4dV/8JwXgDo RgAHP16DwqlwC7DnzESPE3nbaIihGbs5NFIV X-Google-Smtp-Source: ABdhPJzRKS1PvDFvlvqWlRM/UB5UWKmb/YOvdTKmsuJSivNqlBWfd3bh0fTS15ItlYwi6jqlBAfuyg== X-Received: by 2002:a17:906:9f16:: with SMTP id fy22mr360892ejc.464.1642678587957; Thu, 20 Jan 2022 03:36:27 -0800 (PST) From: Liviu Ionescu To: qemu-devel@nongnu.org Subject: [PATCH] Add --with-branding-prefix and QEMU_BRANDING_PREFIX Date: Thu, 20 Jan 2022 13:35:45 +0200 Message-Id: <20220120113545.55820-1-ilg@livius.net> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::52d (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2a00:1450:4864:20::52d; envelope-from=ilg@livius.net; helo=mail-ed1-x52d.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Liviu Ionescu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @livius-net.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1642693696431100001 Content-Type: text/plain; charset="utf-8" It is usual for various distributions to identify themselves by prepending a string to the greeting message, for example 'xPack QEMU emulator version 6.2.0 (v6.2.0-2-xpack-arm)'. To achieve this, a new configuration option (--with-branding-prefix=3D) was added, which, if not empty, adds a string preprocessor macro (QEMU_BRANDING_PREFIX) to 'config-host.h'. If this macro is defined, in QEMU and various tools, the string is displayed before the existing greeting messages. --- bsd-user/main.c | 3 +++ configure | 5 +++++ linux-user/main.c | 3 +++ meson.build | 5 +++++ meson_options.txt | 3 +++ qemu-img.c | 10 ++++++++-- qemu-io.c | 3 +++ qemu-nbd.c | 3 +++ qga/main.c | 5 ++++- scsi/qemu-pr-helper.c | 3 +++ softmmu/vl.c | 3 +++ storage-daemon/qemu-storage-daemon.c | 3 +++ tools/virtiofsd/passthrough_ll.c | 3 +++ ui/cocoa.m | 5 +++++ 14 files changed, 54 insertions(+), 3 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index cb5ea40236..a4eab8feef 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -149,6 +149,9 @@ void cpu_loop(CPUArchState *env) =20 static void usage(void) { +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n" "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n" diff --git a/configure b/configure index e1a31fb332..579a8cf55d 100755 --- a/configure +++ b/configure @@ -356,6 +356,7 @@ ninja=3D"" gio=3D"$default_feature" skip_meson=3Dno slirp_smbd=3D"$default_feature" +branding_prefix=3D"" =20 # The following Meson options are handled manually (still they # are included in the automatically generated help message) @@ -1179,6 +1180,8 @@ for opt do # everything else has the same name in configure and meson --enable-* | --disable-*) meson_option_parse "$opt" "$optarg" ;; + --with-branding-prefix=3D*) branding_prefix=3D"$optarg" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1352,6 +1355,7 @@ Advanced options (experts only): --firmwarepath=3DPATH search PATH for firmware files --efi-aarch64=3DPATH PATH of efi file to use for aarch64 VMs. --with-suffix=3DSUFFIX suffix for QEMU data inside datadir/libdir/sy= sconfdir/docdir [$qemu_suffix] + --with-branding-prefix=3DSTRING prepend string to greeting messages --with-pkgversion=3DVERS use specified string as sub-version of the pa= ckage --without-default-features default all --enable-* options to "disabled" --without-default-devices do not include any device that is not needed = to @@ -3810,6 +3814,7 @@ if test "$skip_meson" =3D no; then -Db_coverage=3D$(if test "$gcov" =3D yes; then echo true; else ech= o false; fi) \ -Db_lto=3D$lto -Dcfi=3D$cfi -Dtcg=3D$tcg -Dxen=3D$xen \ -Dcapstone=3D$capstone -Dfdt=3D$fdt -Dslirp=3D$slirp \ + -Dbranding_prefix=3D"$branding_prefix" \ $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=3D= $LIB_FUZZING_ENGINE") \ $(if test "$default_feature" =3D no; then echo "-Dauto_features=3D= disabled"; fi) \ "$@" $cross_arg "$PWD" "$source_path" diff --git a/linux-user/main.c b/linux-user/main.c index 16def5215d..19abd1436f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -382,6 +382,9 @@ static void handle_arg_strace(const char *arg) =20 static void handle_arg_version(const char *arg) { +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); exit(EXIT_SUCCESS); diff --git a/meson.build b/meson.build index 762d7cee85..80807a771d 100644 --- a/meson.build +++ b/meson.build @@ -1455,6 +1455,10 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATED= IR', get_option('prefix') / config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / q= emu_moddir) config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / ge= t_option('sysconfdir')) =20 +if get_option('branding_prefix') !=3D '' + config_host_data.set_quoted('QEMU_BRANDING_PREFIX', get_option('branding= _prefix')) +endif + config_host_data.set('HOST_' + host_arch.to_upper(), 1) =20 config_host_data.set('CONFIG_ATTR', libattr.found()) @@ -3320,6 +3324,7 @@ endif summary_info +=3D {'strip binaries': get_option('strip')} summary_info +=3D {'sparse': sparse} summary_info +=3D {'mingw32 support': targetos =3D=3D 'windows'} +summary_info +=3D {'branding prefix': get_option('branding_prefix')} =20 # snarf the cross-compilation information for tests foreach target: target_dirs diff --git a/meson_options.txt b/meson_options.txt index 921967eddb..be044cc1e6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -208,3 +208,6 @@ option('fdt', type: 'combo', value: 'auto', =20 option('selinux', type: 'feature', value: 'auto', description: 'SELinux support in qemu-nbd') + +option('branding_prefix', type: 'string', value: '', + description: 'String to prepend to greeting messages') diff --git a/qemu-img.c b/qemu-img.c index 6fe2466032..c10c0066e5 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -52,8 +52,14 @@ #include "qemu/throttle.h" #include "block/throttle-groups.h" =20 +#if defined(QEMU_BRANDING_PREFIX) +#define QEMU_IMG_VERSION QEMU_BRANDING_PREFIX " qemu-img version " \ + QEMU_FULL_VERSION \ + "\n" QEMU_COPYRIGHT "\n" +#else #define QEMU_IMG_VERSION "qemu-img version " QEMU_FULL_VERSION \ - "\n" QEMU_COPYRIGHT "\n" + "\n" QEMU_COPYRIGHT "\n" +#endif =20 typedef struct img_cmd_t { const char *name; @@ -235,7 +241,7 @@ static void QEMU_NORETURN help(void) * an odd number of ',' (or else a separating ',' following it gets * escaped), or be empty (or else a separating ',' preceding it can * escape a separating ',' following it). - *=20 + * */ static bool is_valid_option_list(const char *optarg) { diff --git a/qemu-io.c b/qemu-io.c index 3924639b92..ec880dc49e 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -597,6 +597,9 @@ int main(int argc, char **argv) trace_opt_parse(optarg); break; case 'V': +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf("%s version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n", error_get_progname()); exit(0); diff --git a/qemu-nbd.c b/qemu-nbd.c index c6c20df68a..7b3667626c 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -157,6 +157,9 @@ QEMU_HELP_BOTTOM "\n" =20 static void version(const char *name) { +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf( "%s " QEMU_FULL_VERSION "\n" "Written by Anthony Liguori.\n" diff --git a/qga/main.c b/qga/main.c index 15fd3a4149..c66b87f72c 100644 --- a/qga/main.c +++ b/qga/main.c @@ -224,8 +224,11 @@ void reopen_fd_to_null(int fd) =20 static void usage(const char *cmd) { + printf("Usage: %s [-m -p ] []\n"); +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf( -"Usage: %s [-m -p ] []\n" "QEMU Guest Agent " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n" "\n" diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index f281daeced..d7fcdb8216 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -108,6 +108,9 @@ QEMU_HELP_BOTTOM "\n" =20 static void version(const char *name) { +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf( "%s " QEMU_FULL_VERSION "\n" "Written by Paolo Bonzini.\n" diff --git a/softmmu/vl.c b/softmmu/vl.c index 5e1b35ba48..d83118d939 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -826,6 +826,9 @@ static MachineClass *find_default_machine(GSList *machi= nes) =20 static void version(void) { +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf("QEMU emulator version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); } diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index 9d76d1114d..1a8de7c59d 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -212,6 +212,9 @@ static void process_options(int argc, char *argv[]) trace_init_file(); break; case 'V': +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf("qemu-storage-daemon version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); exit(EXIT_SUCCESS); diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough= _ll.c index 64b5b4fbb1..2179a502d6 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -3896,6 +3896,9 @@ static void fuse_lo_data_cleanup(struct lo_data *lo) =20 static void qemu_version(void) { +#if defined(QEMU_BRANDING_PREFIX) + printf("%s ", QEMU_BRANDING_PREFIX); +#endif printf("virtiofsd version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"= ); } =20 diff --git a/ui/cocoa.m b/ui/cocoa.m index ac18e14ce0..5a1e56ac46 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1524,8 +1524,13 @@ - (void)make_about_window =20 /* Create the version string*/ NSString *version_string; +#if defined(QEMU_BRANDING_PREFIX) + version_string =3D [[NSString alloc] initWithFormat: + @"%s QEMU emulator version %s", QEMU_BRANDING_PREFIX, QEMU_FULL_VERSIO= N]; +#else version_string =3D [[NSString alloc] initWithFormat: @"QEMU emulator version %s", QEMU_FULL_VERSION]; +#endif [version_label setStringValue: version_string]; [superView addSubview: version_label]; =20 --=20 2.32.0 (Apple Git-132)