Hello community, here is the log from the commit of package switcheroo-control for openSUSE:Factory checked in at 2020-07-18 21:03:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/switcheroo-control (Old) and /work/SRC/openSUSE:Factory/.switcheroo-control.new.3592 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "switcheroo-control" Sat Jul 18 21:03:11 2020 rev:8 rq:821648 version:2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/switcheroo-control/switcheroo-control.changes 2020-01-05 15:22:19.417596088 +0100 +++ /work/SRC/openSUSE:Factory/.switcheroo-control.new.3592/switcheroo-control.changes 2020-07-18 21:03:39.587653840 +0200 @@ -1,0 +2,13 @@ +Tue Jul 14 15:00:36 UTC 2020 - Atri Bhattacharya <[email protected]> + +- Update to version 2.3: + * Fix the path to the interpreter for the switcherooctl tool + added in 2.2. +- Changes from version 2.2: + * Port build system to meson. + * Add a command-line utility to launch specific commands on a + specific GPU, or the first discrete one. +- Adapt to meson build system; drop autoconf, automake from + BuildRequires and add meson. + +------------------------------------------------------------------- Old: ---- switcheroo-control-2.1.tar.gz New: ---- switcheroo-control-2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ switcheroo-control.spec ++++++ --- /var/tmp/diff_new_pack.U0iBO2/_old 2020-07-18 21:03:40.707655044 +0200 +++ /var/tmp/diff_new_pack.U0iBO2/_new 2020-07-18 21:03:40.711655048 +0200 @@ -17,7 +17,7 @@ Name: switcheroo-control -Version: 2.1 +Version: 2.3 Release: 0 Summary: D-Bus service to check the availability of dual-GPU License: GPL-3.0-only @@ -25,9 +25,8 @@ URL: https://gitlab.freedesktop.org/hadess/switcheroo-control Source0: https://gitlab.freedesktop.org/hadess/switcheroo-control/-/archive/%{version}/%{name}-%{version}.tar.gz Source1: %{name}-rpmlintrc -BuildRequires: autoconf -BuildRequires: automake BuildRequires: gtk-doc +BuildRequires: meson BuildRequires: pkgconfig BuildRequires: systemd-rpm-macros BuildRequires: pkgconfig(gio-2.0) @@ -50,15 +49,15 @@ %setup -q %build -NOCONFIGURE=1 sh autogen.sh -%configure \ - --with-systemdsystemunitdir=%{_unitdir} \ - --with-hwdbdir=%{_udevhwdbdir} \ - --enable-gtk-doc -make %{?_smp_mflags} +%meson \ + -Dsystemdsystemunitdir=%{_unitdir} \ + -Dhwdbdir=%{_udevhwdbdir} \ + -Dgtk_doc=true + +%meson_build %install -%make_install +%meson_install %pre %service_add_pre switcheroo-control.service @@ -77,8 +76,10 @@ %files %defattr(-,root,root) %license COPYING -%doc NEWS README +%doc NEWS README.md +%{_bindir}/switcherooctl %{_libexecdir}/switcheroo-control +%{_mandir}/man1/switcherooctl.1%{?ext_man} %{_unitdir}/switcheroo-control.service %{_udevhwdbdir}/30-pci-intel-gpu.hwdb # Own dirs to avoid depending on dbus while building. ++++++ switcheroo-control-2.1.tar.gz -> switcheroo-control-2.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/.gitlab-ci.yml new/switcheroo-control-2.3/.gitlab-ci.yml --- old/switcheroo-control-2.1/.gitlab-ci.yml 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/.gitlab-ci.yml 2020-04-28 13:48:10.000000000 +0200 @@ -1,14 +1,40 @@ image: fedora:rawhide variables: - DEPENDENCIES: glib2-devel libgudev-devel gtk-doc intltool autoconf automake - gcc gcc-c++ glibc-devel make + DEPENDENCIES: glib2-devel + libgudev-devel + gtk-doc + gcc + gcc-c++ + glibc-devel + meson + git + libxslt build: before_script: - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES script: - - ./autogen.sh --disable-dependency-tracking - - make - - make install - - make distcheck + - meson -Dgtk_doc=true _build + - ninja -v -C _build + - ninja -v -C _build switcheroo-control-doc + - ninja -v -C _build install + - ninja -v -C _build uninstall + - ninja -v -C _build dist + +dist-job: + stage: build + only: + - tags + before_script: + - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES + script: + - meson --buildtype release -Dgtk_doc=true _build + - cd _build + - ninja dist + - ninja switcheroo-control-doc + - tar -c -f "switcheroo-control-docs-$CI_COMMIT_TAG.tar.xz" -C docs/ html + artifacts: + paths: + - "${CI_PROJECT_DIR}/_build/switcheroo-control-docs-$CI_COMMIT_TAG.tar.xz" + - "${CI_PROJECT_DIR}/_build/meson-dist/switcheroo-control-*.tar.xz" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/Makefile.am new/switcheroo-control-2.3/Makefile.am --- old/switcheroo-control-2.1/Makefile.am 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -SUBDIRS = data src docs - -DISTCHECK_CONFIGURE_FLAGS = \ - --enable-gtk-doc \ - --with-hwdbdir=$$dc_install_base/$(hwdbdir) \ - --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) - -EXTRA_DIST = README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/NEWS new/switcheroo-control-2.3/NEWS --- old/switcheroo-control-2.1/NEWS 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/NEWS 2020-04-28 13:48:10.000000000 +0200 @@ -1,3 +1,17 @@ +2.3 +--- + +This release fixes the path to the interpreter for the switcherooctl +tool added in 2.2. + +2.2 +--- + +This release adds a command-line utility to launch specific commands on +a specific GPU, or the first discrete one. See the reference documentation +or the switcherooctl(1) man page for details. The build system was also +ported to meson. + 2.1 --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/README new/switcheroo-control-2.3/README --- old/switcheroo-control-2.1/README 2020-07-18 21:03:40.767655108 +0200 +++ new/switcheroo-control-2.3/README 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/autogen.sh new/switcheroo-control-2.3/autogen.sh --- old/switcheroo-control-2.1/autogen.sh 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/autogen.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -#!/bin/sh - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -olddir=`pwd` -cd "$srcdir" - -aclocal || exit 1 -gtkdocize --copy || exit 1 -autoconf || exit 1 -automake -a -c || exit 1 - -cd "$olddir" - -if test -z "$NOCONFIGURE"; then - $srcdir/configure --enable-maintainer-mode $* -fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/configure.ac new/switcheroo-control-2.3/configure.ac --- old/switcheroo-control-2.1/configure.ac 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/configure.ac 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -AC_PREREQ(2.59) - -AC_INIT([switcheroo-control], [2.1], [[email protected]]) -AM_INIT_AUTOMAKE(1.9 dist-xz no-dist-gzip check-news) - -# Enable silent build when available (Automake 1.11) -m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) - -AC_PROG_CC -AC_PROG_MAKE_SET -AC_PROG_INSTALL -AC_PROG_SED -AM_PROG_CC_C_O - -GTK_DOC_CHECK([1.11],[--flavour no-tmpl]) - -AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], - [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) -if test x$with_systemdsystemunitdir != xno; then - AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) -fi - -AC_ARG_WITH([hwdbdir], - AS_HELP_STRING([--with-hwdbdir=DIR], [Directory for hwdb files]), - [], - [with_hwdbdir=$($PKG_CONFIG --variable=udevdir udev)"/hwdb.d"]) -AC_SUBST([hwdbdir], [$with_hwdbdir]) - -PKG_CHECK_MODULES(SWITCHEROO_CONTROL, gio-2.0 gudev-1.0 >= 232) - -AC_PATH_PROG([GDBUS_CODEGEN],[gdbus-codegen]) -AC_PATH_PROG([SYSTEMD_HWDB],[systemd-hwdb]) - -AC_CONFIG_FILES([ - Makefile - data/Makefile - src/Makefile - docs/Makefile - docs/version.xml -]) -AC_OUTPUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/data/Makefile.am new/switcheroo-control-2.3/data/Makefile.am --- old/switcheroo-control-2.1/data/Makefile.am 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/data/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -systemdservicedir = $(systemdsystemunitdir) -systemdservice_in_files = switcheroo-control.service.in -systemdservice_DATA = switcheroo-control.service -switcheroo-control.service: switcheroo-control.service.in Makefile - $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ - -dbusconfdir = $(sysconfdir)/dbus-1/system.d -dbusconf_DATA = net.hadess.SwitcherooControl.conf - -hwdb_DATA = 30-pci-intel-gpu.hwdb - -install-data-hook: - $(SYSTEMD_HWDB) update || : - -uninstall-hook: - $(SYSTEMD_HWDB) update || : - -CLEANFILES = switcheroo-control.service -EXTRA_DIST = \ - $(dbusconf_DATA) \ - $(hwdb_DATA) \ - $(systemdservice_in_files) \ - scripts/generate-hwdb.c \ - scripts/Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/data/meson.build new/switcheroo-control-2.3/data/meson.build --- old/switcheroo-control-2.1/data/meson.build 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/data/meson.build 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,19 @@ +data_conf = configuration_data() +data_conf.set('libexecdir', libexecdir) + +configure_file( + input: 'switcheroo-control.service.in', + output: 'switcheroo-control.service', + configuration: data_conf, + install_dir: systemd_systemunitdir, +) + +install_data( + 'net.hadess.SwitcherooControl.conf', + install_dir: sysconfdir / 'dbus-1/system.d', +) + +install_data( + '30-pci-intel-gpu.hwdb', + install_dir: hwdb_dir, +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/data/scripts/Makefile new/switcheroo-control-2.3/data/scripts/Makefile --- old/switcheroo-control-2.1/data/scripts/Makefile 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/data/scripts/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -all: generate-hwdb - -generate-hwdb: generate-hwdb.c - gcc -Wall -o $@ $< `pkg-config --libs --cflags glib-2.0` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/docs/Makefile.am new/switcheroo-control-2.3/docs/Makefile.am --- old/switcheroo-control-2.1/docs/Makefile.am 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/docs/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,61 +0,0 @@ -NULL = - -AUTOMAKE_OPTIONS = 1.7 - -# The name of the module. -DOC_MODULE=switcheroo-control - -# The top-level SGML file. -DOC_MAIN_SGML_FILE=switcheroo-control-docs.xml - -# Extra options to supply to gtkdoc-scan -SCAN_OPTIONS=--ignore-headers=config.h --rebuild-sections --rebuild-types - -# The directory containing the source code. Relative to $(srcdir) -DOC_SOURCE_DIR= - -# Used for dependencies -HFILE_GLOB= -CFILE_GLOB= - -# Headers to ignore -IGNORE_HFILES= \ - $(NULL) - -GTKDOC_LIBS = - -# Extra options to supply to gtkdoc-mkdb -MKDB_OPTIONS=--sgml-mode --output-format=xml - -# Extra options to supply to gtkdoc-mktmpl -MKTMPL_OPTIONS= - -docs-net.hadess.SwitcherooControl.xml: $(top_srcdir)/src/net.hadess.SwitcherooControl.xml - $(AM_V_GEN)$(GDBUS_CODEGEN) --generate-docbook=docs $< - -# Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE) -content_files = \ - version.xml \ - docs-net.hadess.SwitcherooControl.xml \ - $(NULL) - -# FIXME -MAINTAINERCLEANFILES = \ - *~ \ - Makefile.in \ - switcheroo-control.types \ - switcheroo-control-*.txt \ - $(NULL) - -include $(top_srcdir)/gtk-doc.make -EXTRA_DIST += switcheroo-control-docs.xml - -CLEANFILES += \ - docs-net.hadess.SwitcherooControl.xml \ - docs-net.hadess.SwitcherooControl.Compass.xml \ - $(NULL) - -# Version information for marking the documentation -EXTRA_DIST += version.xml.in - --include $(top_srcdir)/git.mk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/docs/meson.build new/switcheroo-control-2.3/docs/meson.build --- old/switcheroo-control-2.1/docs/meson.build 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/docs/meson.build 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,54 @@ +content_files = files() + +version_conf = configuration_data() +version_conf.set('VERSION', meson.project_version()) + +content_files += configure_file( + input: 'version.xml.in', + output: 'version.xml', + configuration: version_conf, +) + +content_files += gnome.gdbus_codegen( + meson.project_name(), + sources: meson.source_root() / 'src' / 'net.hadess.SwitcherooControl.xml', + interface_prefix: 'net.hadess', + namespace: 'SwitcherooControl', + docbook: 'docs', + build_by_default: true, +) + +gnome.gtkdoc( + meson.project_name(), + main_xml: meson.project_name() + '-docs.xml', + content_files: content_files, + src_dir: [ + meson.source_root() /'src', + meson.build_root() / 'src', + ], + ignore_headers: ['info-cleanup.h'], + scan_args: ['--rebuild-sections'], +) + +man1_dir = join_paths(get_option('prefix'), get_option('mandir'), 'man1') + +xsltproc = find_program('xsltproc', required : true) +xsltproc_command = [ + xsltproc, + '--nonet', + '--stringparam', 'man.output.quietly', '1', + '--stringparam', 'funcsynopsis.style', 'ansi', + '--stringparam', 'man.th.extra1.suppress', '1', + '--stringparam', 'man.authors.section.enabled', '0', + '--stringparam', 'man.copyright.section.enabled', '0', + '-o', '@OUTPUT@', + 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl', + '@INPUT@', +] + +custom_target('switcherooctl-man', + input: 'switcherooctl.xml', + output: 'switcherooctl.1', + command: xsltproc_command, + install: true, + install_dir: man1_dir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/docs/switcheroo-control-docs.xml new/switcheroo-control-2.3/docs/switcheroo-control-docs.xml --- old/switcheroo-control-2.1/docs/switcheroo-control-docs.xml 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/docs/switcheroo-control-docs.xml 2020-04-28 13:48:10.000000000 +0200 @@ -66,6 +66,11 @@ <xi:include href="docs-net.hadess.SwitcherooControl.xml"/> </reference> + <chapter id="tools"> + <title>Tools</title> + <xi:include href="switcherooctl.xml"/> + </chapter> + <index> <title>Index</title> </index> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/docs/switcherooctl.xml new/switcheroo-control-2.3/docs/switcherooctl.xml --- old/switcheroo-control-2.1/docs/switcherooctl.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/docs/switcherooctl.xml 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,120 @@ +<?xml version="1.0"?> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> +<refentry id="switcherooctl"> + <refentryinfo> + <title>switcherooctl</title> + <productname>switcherooctl</productname> + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>Bastien</firstname> + <surname>Nocera</surname> + <email>[email protected]</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>switcherooctl</refentrytitle> + <manvolnum>1</manvolnum> + <refmiscinfo class="manual">User Commands</refmiscinfo> + </refmeta> + + <refnamediv> + <refname>switcherooctl</refname> + <refpurpose>Launch a command on a specific GPU</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <cmdsynopsis> + <command>switcherooctl</command> + <arg choice="plain">help</arg> + <arg choice="opt"><replaceable>COMMAND</replaceable></arg> + </cmdsynopsis> + <cmdsynopsis> + <command>switcherooctl</command> + <arg choice="plain">version</arg> + </cmdsynopsis> + <cmdsynopsis> + <command>switcherooctl</command> + <arg choice="plain">list</arg> + </cmdsynopsis> + <cmdsynopsis> + <command>switcherooctl</command> + <arg choice="plain">launch</arg> + <arg choice="opt"><replaceable>OPTION</replaceable></arg> + <arg choice="plain" rep="repeat"><replaceable>COMMAND</replaceable></arg> + </cmdsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Description</title> + <para><command>switcherooctl</command> is a utility to launch a specific + command on a specific GPU.</para> + </refsect1> + + <refsect1> + <title>Commands</title> + + <variablelist> + <varlistentry> + <term> + <command>help</command> + <arg choice="opt"><replaceable>COMMAND</replaceable></arg> + </term> + <listitem> + <para>Displays a short synopsis of the available commands or provides + detailed help on a specific command.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>version</command> + </term> + <listitem> + <para>Prints the switcheroo-control version to which <command>switcherooctl</command> + belongs.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>list</command> + </term> + <listitem> + <para>List the known GPUs. The device number can be used to specify the GPU to + launch on for the <literal>launch</literal> command. This is the default command + if no commands are passed to <literal>switcherooctl</literal>.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <command>launch</command> + <arg choice="opt"><replaceable>OPTION</replaceable></arg> + <arg choice="plain" rep="repeat"><replaceable>COMMAND</replaceable></arg> + </term> + <listitem> + <para>Launch <replaceable>COMMAND</replaceable> on a specific GPU. If no GPU are specified the first discrete + (non-default) GPU is used, or the default GPU if there's no discrete GPU.</para> + <refsect3> + <title>Options</title> + <variablelist> + <varlistentry> + <term><option>-g</option> <option>--gpu=<replaceable>GPU</replaceable></option></term> + <listitem><para>The GPU to launch on. The GPU identifier can be gathered using the <literal>list</literal> command.</para></listitem> + </varlistentry> + </variablelist> + </refsect3> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1> + <title>Exit status</title> + <para>On success 0 is returned, a non-zero failure code otherwise.</para> + </refsect1> + +</refentry> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/meson.build new/switcheroo-control-2.3/meson.build --- old/switcheroo-control-2.1/meson.build 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/meson.build 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,47 @@ +project('switcheroo-control', 'c', + version : '2.3', + license: 'GPLv3+', + default_options : [ + 'buildtype=debugoptimized', + 'warning_level=1', + 'c_std=c99', + ], + meson_version : '>= 0.50.0', +) + +cc = meson.get_compiler('c') + +prefix = get_option('prefix') +libexecdir = prefix / get_option('libexecdir') +sysconfdir = prefix / get_option('sysconfdir') + +gnome = import('gnome') + +glib = dependency('glib-2.0', version: '>= 2.56.0') +gio = dependency('gio-2.0', version: '>= 2.56.0') +gudev = dependency('gudev-1.0', version: '>= 232') + +systemd_systemunitdir = get_option('systemdsystemunitdir') +if systemd_systemunitdir == '' + systemd_systemunitdir = dependency('systemd').get_pkgconfig_variable('systemdsystemunitdir') +endif + +hwdb_dir = get_option('hwdbdir') +if hwdb_dir == '' + udevdir = dependency('udev').get_pkgconfig_variable('udevdir') + hwdb_dir = udevdir / 'hwdb.d' +endif + +# Make like license available in the build root for docs +configure_file( + input: 'COPYING', + output: 'COPYING', + copy: true, +) + +subdir('data') +subdir('src') + +if get_option('gtk_doc') + subdir('docs') +endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/meson_options.txt new/switcheroo-control-2.3/meson_options.txt --- old/switcheroo-control-2.1/meson_options.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/meson_options.txt 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,17 @@ +option('systemdsystemunitdir', + type: 'string', + value: '', + description: 'Directory for systemd service files', +) + +option('hwdbdir', + type: 'string', + value: '', + description: 'Directory for hwdb files', +) + +option('gtk_doc', + type: 'boolean', + value: false, + description: 'Build docs', +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/src/Makefile.am new/switcheroo-control-2.3/src/Makefile.am --- old/switcheroo-control-2.1/src/Makefile.am 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/src/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -BUILT_SOURCES = \ - switcheroo-control-resources.c \ - switcheroo-control-resources.h - -resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/switcheroo-control.gresource.xml) -switcheroo-control-resources.c: switcheroo-control.gresource.xml $(resource_files) - $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name switcheroo_control $< -switcheroo-control-resources.h: switcheroo-control.gresource.xml $(resource_files) - $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name switcheroo_control $< - -libexec_PROGRAMS = switcheroo-control - -switcheroo_control_SOURCES = \ - switcheroo-control.c \ - info-cleanup.c \ - info-cleanup.h \ - $(BUILT_SOURCES) - -switcheroo_control_CPPFLAGS = \ - $(SWITCHEROO_CONTROL_CFLAGS) \ - $(WARN_CFLAGS) -switcheroo_control_LDADD = $(SWITCHEROO_CONTROL_LIBS) - -EXTRA_DIST = \ - net.hadess.SwitcherooControl.xml \ - switcheroo-control.gresource.xml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/src/meson.build new/switcheroo-control-2.3/src/meson.build --- old/switcheroo-control-2.1/src/meson.build 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/src/meson.build 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,36 @@ +deps = [glib, gio, gudev] + +sources = [ + 'info-cleanup.c', + 'info-cleanup.h', + 'switcheroo-control.c', +] + +resources = gnome.compile_resources( + 'switcheroo-control-resources', + 'switcheroo-control.gresource.xml', + source_dir: '.', + c_name: 'switcheroo_control', + export: true, +) + +executable('switcheroo-control', + sources, resources, + dependencies: deps, + install: true, + install_dir: libexecdir, +) + +python = import('python') +py_installation = python.find_installation('python3', required: true) + +switcherooctl_conf = configuration_data() +switcherooctl_conf.set('VERSION', meson.project_version()) +switcherooctl_conf.set('PYTHON3', py_installation.path()) + +configure_file( + input: 'switcherooctl.in', + output: 'switcherooctl', + configuration: switcherooctl_conf, + install_dir: get_option('bindir') +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/src/switcheroo-control.c new/switcheroo-control-2.3/src/switcheroo-control.c --- old/switcheroo-control-2.1/src/switcheroo-control.c 2020-01-02 11:06:46.000000000 +0100 +++ new/switcheroo-control-2.3/src/switcheroo-control.c 2020-04-28 13:48:10.000000000 +0200 @@ -349,6 +349,27 @@ GPtrArray *cards; cards = g_ptr_array_new_with_free_func ((GDestroyNotify) free_card_data); + +#if 0 + { + CardData *card; + const char *env[] = { + "INTEL_AGP_OFFLOADING", "1", + "INTEL_PCI_MODE", "false", + NULL + }; + guint i; + + card = g_new0 (CardData, 1); + card->name = "Intel i740 “Auburn”"; + card->env = g_ptr_array_new (); + for (i = 0; env[i] != NULL; i++) + g_ptr_array_add (card->env, g_strdup (env[i])); + + g_ptr_array_add (cards, card); + } +#endif + devices = g_udev_client_query_by_subsystem (data->client, "drm"); for (l = devices; l != NULL; l = l->next) { GUdevDevice *d = l->data; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/switcheroo-control-2.1/src/switcherooctl.in new/switcheroo-control-2.3/src/switcherooctl.in --- old/switcheroo-control-2.1/src/switcherooctl.in 1970-01-01 01:00:00.000000000 +0100 +++ new/switcheroo-control-2.3/src/switcherooctl.in 2020-04-28 13:48:10.000000000 +0200 @@ -0,0 +1,182 @@ +#!@PYTHON3@ + +from gi.repository import Gio, GLib +import sys, os + +VERSION = '@VERSION@' + +def usage_main(): + print('Usage:') + print(' switcherooctl COMMAND [ARGS…]') + print('') + print('Commands:') + print(' help Print help') + print(' version Print version') + print(' list List the known GPUs') + print(' launch Launch a command on a specific GPU') + print('') + print('Use “switcherooctl help COMMAND” to get detailed help.') + +def usage_version(): + print('Usage:') + print(' switcherooctl version') + print('') + print('Print version information and exit.') + +def usage_list(): + print('Usage:') + print(' switcherooctl list') + print('') + print('List the known GPUs.') + +def usage_launch(): + print('Usage:') + print(' switcherooctl launch [COMMAND…]') + print('') + print('Launch a command on a specific GPU.') + print('') + print('Options:') + print(' -g, --gpu=GPU-ID The GPU to launch on') + print('') + print('The default GPU to launch on will be the first discrete GPU, or the') + print('default GPU if there’s only one. Identifiers can be found using the') + print('list command.') + +def usage(command=None): + if not command: + usage_main() + elif command == 'list': + usage_list() + elif command == 'launch': + usage_launch() + elif command == 'version': + usage_version() + else: + usage_main() + +def version(): + print (VERSION) + +def launch(args, gpu): + if gpu: + # print (gpu['Environment']) + for k,v in zip(gpu['Environment'][0::2], gpu['Environment'][1::2]): + os.environ[k] = v + # print ('%s = %s' % (k, v)) + os.execvp(args[0], args) + +def env_to_str(env): + s = '' + for k,v in zip(env[0::2], env[1::2]): + s += str('%s=%s ' % (k, v)) + return s.rstrip() + +def print_gpu(gpu, index): + if index > 0: + print('') + print('Device:', index) + print(' Name: ', gpu['Name']) + print(' Default: ', "yes" if gpu['Default'] else "no") + print(' Environment:', env_to_str(gpu['Environment'])) + +def _list(): + try: + gpus = get_gpus() + except: + # print("Couldn\'t get GPUs: ", sys.exc_info()[0]) + return + + index = 0 + for gpu in gpus: + print_gpu(gpu, index) + index += 1 + +def get_gpus(): + try: + bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None) + proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None, + 'net.hadess.SwitcherooControl', + '/net/hadess/SwitcherooControl', + 'org.freedesktop.DBus.Properties', None) + except: + raise SystemError + + gpus = None + try: + gpus = proxy.Get('(ss)', 'net.hadess.SwitcherooControl', 'GPUs') + except: + raise ReferenceError + else: + # Move the first GPU to the front, it's the default + default_gpu = next(gpu for gpu in gpus if gpu['Default']) + gpus.remove(default_gpu) + gpus.insert(0, default_gpu) + return gpus + +def get_discrete_gpu(): + try: + gpus = get_gpus() + except: + # print("Couldn\'t get GPUs: ", sys.exc_info()[0]) + return None + + try: + gpu = next(gpu for gpu in gpus if not gpu['Default']) + except StopIteration: + return None + else: + return gpu + +def get_gpu(index): + try: + gpus = get_gpus() + except: + # print("Couldn\'t get GPUs: ", sys.exc_info()[0]) + return None + + try: + gpu = gpus[index] + except: + return None + else: + return gpu + +args = None +if len(sys.argv) == 1: + command = 'list' +elif len(sys.argv) >= 2: + command = sys.argv[1] + if command == '--help': + command = 'help' + if command == '--version': + command = 'version' + if command != 'help' and command != 'launch' and command != 'list' and command != 'version': + command = 'launch' + args = sys.argv[1:] + else: + args = sys.argv[2:] + +if command == 'help': + if len(args) > 0: + usage(args[0]) + else: + usage(None) +elif command == 'version': + version() +elif command == 'launch': + if len(args) == 0: + sys.exit(0) + if args[0] == '--gpu' or args[0] == '-g': + if len(args) == 2: + sys.exit(0) + if len(args) == 1: + usage_launch() + sys.exit(1) + index = int(args[1]) + args = args[2:] + gpu = get_gpu(index) + else: + gpu = get_discrete_gpu() + launch(args, gpu) +elif command == 'list': + _list()
