diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..a683a03
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,4 @@
+
+ utils
+
+
diff --git a/libcddb-utils.changes b/libcddb-utils.changes
deleted file mode 100644
index 9f06f68..0000000
--- a/libcddb-utils.changes
+++ /dev/null
@@ -1,140 +0,0 @@
--------------------------------------------------------------------
-Mon Jun 7 15:02:24 UTC 2021 - Jan Engelhardt
-
-- Drop --with-pic (no effect with --disable-static)
-- Trim old/redundant rpm constructs
-
--------------------------------------------------------------------
-Thu Apr 11 14:17:46 UTC 2013 - mmeister@suse.com
-
-- Added url as source.
- Please see http://en.opensuse.org/SourceUrls
-
--------------------------------------------------------------------
-Thu Feb 16 21:09:31 UTC 2012 - coolo@suse.com
-
-- move license outside a %if to fix build of libcddb-utils
-
--------------------------------------------------------------------
-Thu Jan 19 07:51:46 UTC 2012 - coolo@suse.com
-
-- fix pre_checkin.sh
-
--------------------------------------------------------------------
-Thu Dec 1 16:59:06 UTC 2011 - coolo@suse.com
-
-- add libtool as buildrequire to avoid implicit dependency
-
--------------------------------------------------------------------
-Sun Jan 31 21:09:13 CET 2010 - jengelh@medozas.de
-
-- Package baselibs.conf
-
--------------------------------------------------------------------
-Thu Aug 6 15:00:44 CEST 2009 - sbrabec@suse.cz
-
-- Updated to version 1.3.2:
- * ported to more platforms
- * new functions in the API
- * minor fixes
-- Build in two stages to break build loop without removing
- utilities.
-
--------------------------------------------------------------------
-Wed Dec 10 12:34:56 CET 2008 - olh@suse.de
-
-- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
- (bnc#437293)
-
--------------------------------------------------------------------
-Thu Dec 4 12:34:56 CET 2008 - olh@suse.de
-
-- obsolete old -XXbit packages (bnc#437293)
-
--------------------------------------------------------------------
-Thu Nov 27 14:14:33 CET 2008 - ro@suse.de
-
-- update baselibs.conf
-
--------------------------------------------------------------------
-Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de
-
-- added baselibs.conf file to build xxbit packages
- for multilib support
-
--------------------------------------------------------------------
-Tue Oct 9 08:23:50 CEST 2007 - crrodriguez@suse.de
-
-- fix build using library packaging policy
-- remove static libraries and useless libtool archive
-- permanently break build loop by removing the example code that caused it
-
--------------------------------------------------------------------
-Tue Sep 11 12:46:28 CEST 2007 - sbrabec@suse.cz
-
-- Break build loop libcddb -> libcdio -> libcddb.
-
--------------------------------------------------------------------
-Fri Oct 20 15:26:57 CEST 2006 - sbrabec@suse.cz
-
-- Updated to version 1.3.0:
- * Support for the 'album' command of the freedb2.org.
- * Functions to set or reset some flags.
-
--------------------------------------------------------------------
-Fri Oct 6 16:23:58 CEST 2006 - sbrabec@suse.cz
-
-- Updated to version 1.2.2:
- * Correct character set is specified when submitting data.
-
--------------------------------------------------------------------
-Fri Jun 30 13:18:50 CEST 2006 - sbrabec@suse.cz
-
-- Fixed cyclic dependencies in a correct way.
-
--------------------------------------------------------------------
-Thu Jun 22 18:36:21 CEST 2006 - sbrabec@suse.cz
-
-- Simpler solution of cyclic dependencies.
-
--------------------------------------------------------------------
-Tue Jan 31 14:20:12 CET 2006 - sbrabec@suse.cz
-
-- Enabled parallel build.
-- Fixed devel splitting.
-
--------------------------------------------------------------------
-Wed Jan 25 21:42:30 CET 2006 - mls@suse.de
-
-- converted neededforbuild to BuildRequires
-
--------------------------------------------------------------------
-Wed Oct 26 13:32:11 CEST 2005 - sbrabec@suse.cz
-
-- Build with libcdio-0.76.
-
--------------------------------------------------------------------
-Fri Aug 5 11:00:12 CEST 2005 - sbrabec@suse.cz
-
-- Updated to version 1.2.1.
-
--------------------------------------------------------------------
-Fri Jul 29 15:57:55 CEST 2005 - sbrabec@suse.cz
-
-- Updated to version 1.2.0.
-
--------------------------------------------------------------------
-Mon May 9 13:07:34 CEST 2005 - sbrabec@suse.cz
-
-- Updated to version 1.0.2.
-
--------------------------------------------------------------------
-Tue Apr 26 13:23:02 CEST 2005 - sbrabec@suse.cz
-
-- Updated to version 1.0.1.
-
--------------------------------------------------------------------
-Tue Nov 09 14:52:28 CET 2004 - sbrabec@suse.cz
-
-- New SuSE package, version 0.9.6.
-
diff --git a/libcddb-utils.spec b/libcddb-utils.spec
deleted file mode 100644
index e8affad..0000000
--- a/libcddb-utils.spec
+++ /dev/null
@@ -1,153 +0,0 @@
-#
-# spec file for package libcddb-utils
-#
-# Copyright (c) 2021 SUSE LLC
-#
-# All modifications and additions to the file contributed by third parties
-# remain the property of their copyright owners, unless otherwise agreed
-# upon. The license for this file, and modifications and additions to the
-# file, is the same license as for the pristine package itself (unless the
-# license for the pristine package is not an Open Source License, in which
-# case the license is the MIT License). An "Open Source License" is a
-# license that conforms to the Open Source Definition (Version 1.9)
-# published by the Open Source Initiative.
-
-# Please submit bugfixes or comments via https://bugs.opensuse.org/
-#
-
-
-Name: libcddb-utils
-# WARNING: Do not edit this auto generated file.
-#%(sh %{_sourcedir}/libcddb_spec-prepare.sh %{_sourcedir} %{name})
-# To break libcddb<->libcdio dependency loop, this package is built in two stages.
-%define BUILD_CORE 0
-%define BUILD_UTILS 1
-%define _name libcddb
-Version: 1.3.2
-Release: 0
-URL: http://libcddb.sourceforge.net/
-Summary: CDDB Access Library Utilities
-License: LGPL-2.1-or-later
-Group: Productivity/Multimedia/Other
-%if %BUILD_CORE
-# bug437293
-%ifarch ppc64
-Obsoletes: libcddb-64bit
-%endif
-%endif
-Source: http://downloads.sourceforge.net/project/%{_name}/%{_name}/%{version}/%{_name}-%{version}.tar.bz2
-Source1: %{_name}_spec-prepare.sh
-Source2: baselibs.conf
-BuildRequires: libtool
-BuildRequires: pkg-config
-%if %BUILD_UTILS
-BuildRequires: libcdio-devel
-%if !%BUILD_CORE
-BuildRequires: libcddb-devel
-%endif
-%endif
-Patch: libcddb-no-examples.patch
-
-%description
-Libcddb is a library that implements the different protocols (CDDBP,
-HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
-tries to be as cross-platform as possible.
-
-%if %BUILD_UTILS
-%if %BUILD_CORE
-
-%package -n libcddb-utils
-Summary: CDDB Access Library Utilities
-Group: Productivity/Multimedia/Other
-
-%description -n libcddb-utils
-Libcddb is a library that implements the different protocols (CDDBP,
-HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
-tries to be as cross-platform as possible.
-
-%endif
-%endif
-%if %BUILD_CORE
-
-%package -n libcddb2
-Summary: CDDB Access Library
-Group: System/Libraries
-# bug437293
-%ifarch ppc64
-Obsoletes: libcddb-64bit
-%endif
-#
-Provides: %{_name} = %{version}
-#opensuse 10.3
-Obsoletes: %{_name} <= 1.3.0
-
-%description -n libcddb2
-Libcddb is a library that implements the different protocols (CDDBP,
-HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
-tries to be as cross-platform as possible.
-
-%package devel
-Summary: CDDB Access Library
-Group: Development/Libraries/C and C++
-Requires: glibc-devel
-Requires: libcddb2 = %{version}
-# bug437293
-%ifarch ppc64
-Obsoletes: libcddb-devel-64bit
-%endif
-
-%description devel
-Libcddb is a library that implements the different protocols (CDDBP,
-HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
-tries to be as cross-platform as possible.
-
-%endif
-
-%prep
-%setup -q -n %{_name}-%{version}
-%if !%BUILD_UTILS
-%patch
-%endif
-%if !%BUILD_CORE
-sed -i 's:\(\.\.\|\$(top_builddir)\)/[^/]*/lib\([^ ]*\)\.la:-l\2:g' */Makefile.am
-%endif
-
-%build
-autoreconf -f -i
-%configure\
- --disable-rpath\
- --disable-static
-%if !%BUILD_CORE
-cd examples
-%endif
-%make_build
-
-%install
-%if !%BUILD_CORE
-cd examples
-%endif
-%make_install
-rm -f %{buildroot}%{_libdir}/libcddb.la
-
-%if %BUILD_UTILS
-
-%files -n libcddb-utils
-%{_bindir}/*
-%endif
-%if %BUILD_CORE
-
-%post -n libcddb2 -p /sbin/ldconfig
-
-%postun -n libcddb2 -p /sbin/ldconfig
-
-%files -n libcddb2
-%{_libdir}/*.so.2*
-
-%files devel
-%doc AUTHORS COPYING ChangeLog NEWS README THANKS TODO
-%{_libdir}/*.so
-%{_libdir}/pkgconfig/*.pc
-%{_includedir}/cddb
-%endif
-
-%changelog
diff --git a/libcddb.changes b/libcddb.changes
index 9f06f68..1ac00a7 100644
--- a/libcddb.changes
+++ b/libcddb.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Thu May 4 09:53:33 UTC 2023 - Dominique Leuenberger
+
+- Transform into a proper _multibuild package: the spec is already
+ prepared and uses a few variables to distinguish flavors.
+
-------------------------------------------------------------------
Mon Jun 7 15:02:24 UTC 2021 - Jan Engelhardt
diff --git a/libcddb.spec b/libcddb.spec
index 23859e7..fb2f2dc 100644
--- a/libcddb.spec
+++ b/libcddb.spec
@@ -1,7 +1,7 @@
#
-# spec file for package libcddb
+# spec file
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,66 +16,40 @@
#
-Name: libcddb
-# WARNING: After editing this file please call Re or rpmbuild to update spec file:
-#%(sh %{_sourcedir}/libcddb_spec-prepare.sh %{_sourcedir} %{name})
-# To break libcddb<->libcdio dependency loop, this package is built in two stages.
-%define BUILD_CORE 1
+%define flavor @BUILD_FLAVOR@%{nil}
%define BUILD_UTILS 0
+%if "%{flavor}" == "utils"
+%define BUILD_UTILS 1
+%define nsuffix -utils
+%endif
+# To break libcddb<->libcdio dependency loop, this package is built in two stages.
%define _name libcddb
+Name: libcddb%{?nsuffix}
Version: 1.3.2
Release: 0
-URL: http://libcddb.sourceforge.net/
Summary: CDDB Access Library Utilities
License: LGPL-2.1-or-later
Group: Productivity/Multimedia/Other
-%if %BUILD_CORE
-# bug437293
-%ifarch ppc64
-Obsoletes: libcddb-64bit
-%endif
-%endif
+URL: https://libcddb.sourceforge.net/
Source: http://downloads.sourceforge.net/project/%{_name}/%{_name}/%{version}/%{_name}-%{version}.tar.bz2
-Source1: %{_name}_spec-prepare.sh
Source2: baselibs.conf
+Patch0: libcddb-no-examples.patch
BuildRequires: libtool
-BuildRequires: pkg-config
-%if %BUILD_UTILS
-BuildRequires: libcdio-devel
-%if !%BUILD_CORE
+BuildRequires: pkgconfig
+%if %{BUILD_UTILS}
BuildRequires: libcddb-devel
+BuildRequires: libcdio-devel
%endif
-%endif
-Patch: libcddb-no-examples.patch
%description
Libcddb is a library that implements the different protocols (CDDBP,
HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
tries to be as cross-platform as possible.
-%if %BUILD_UTILS
-%if %BUILD_CORE
-
-%package -n libcddb-utils
-Summary: CDDB Access Library Utilities
-Group: Productivity/Multimedia/Other
-
-%description -n libcddb-utils
-Libcddb is a library that implements the different protocols (CDDBP,
-HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
-tries to be as cross-platform as possible.
-
-%endif
-%endif
-%if %BUILD_CORE
-
+%if ! %{BUILD_UTILS}
%package -n libcddb2
Summary: CDDB Access Library
Group: System/Libraries
-# bug437293
-%ifarch ppc64
-Obsoletes: libcddb-64bit
-%endif
#
Provides: %{_name} = %{version}
#opensuse 10.3
@@ -91,24 +65,18 @@ Summary: CDDB Access Library
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libcddb2 = %{version}
-# bug437293
-%ifarch ppc64
-Obsoletes: libcddb-devel-64bit
-%endif
%description devel
Libcddb is a library that implements the different protocols (CDDBP,
HTTP, and SMTP) to access data on a CDDB server (http://freedb.org). It
tries to be as cross-platform as possible.
-
%endif
%prep
%setup -q -n %{_name}-%{version}
-%if !%BUILD_UTILS
-%patch
-%endif
-%if !%BUILD_CORE
+%if !%{BUILD_UTILS}
+%patch0
+%else
sed -i 's:\(\.\.\|\$(top_builddir)\)/[^/]*/lib\([^ ]*\)\.la:-l\2:g' */Makefile.am
%endif
@@ -117,34 +85,32 @@ autoreconf -f -i
%configure\
--disable-rpath\
--disable-static
-%if !%BUILD_CORE
+%if %{BUILD_UTILS}
cd examples
%endif
%make_build
%install
-%if !%BUILD_CORE
+%if %{BUILD_UTILS}
cd examples
%endif
%make_install
rm -f %{buildroot}%{_libdir}/libcddb.la
-%if %BUILD_UTILS
-
-%files -n libcddb-utils
+%if %{BUILD_UTILS}
+%files
%{_bindir}/*
-%endif
-%if %BUILD_CORE
-%post -n libcddb2 -p /sbin/ldconfig
+%else
-%postun -n libcddb2 -p /sbin/ldconfig
+%ldconfig_scriptlets -n libcddb2
%files -n libcddb2
%{_libdir}/*.so.2*
%files devel
-%doc AUTHORS COPYING ChangeLog NEWS README THANKS TODO
+%license COPYING
+%doc AUTHORS ChangeLog NEWS README THANKS TODO
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/cddb
diff --git a/libcddb_spec-prepare.sh b/libcddb_spec-prepare.sh
deleted file mode 100644
index e0937a3..0000000
--- a/libcddb_spec-prepare.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-# Autobuild doesn't support package names with macros. This script will update versions in package names.
-
-ORIG_SPEC=${2%-utils}
-# Never update -utils fíle when it is already opened. It will break advanced build scripts:
-if test "$2" != "$ORIG_SPEC" ; then
- exit
-fi
-
-if ! test -f $1/$ORIG_SPEC.spec ; then
- exit
-fi
-
-# Edit file to fit -utils build needs:
-sed '
- s/BUILD_UTILS\ 0/BUILD_UTILS 1/;
- s/BUILD_CORE\ 1/BUILD_CORE 0/;
- s/^.ame:.*/&-utils/;
- # No more needed.
- #s/^..hangelog.*/& utils/;
- s/^\(# WARNING:\).*After editing.*/\1 Do not edit this auto generated file./
-' <$1/$ORIG_SPEC.spec >$1/$ORIG_SPEC-utils.spec
-
-cp -a $1/$ORIG_SPEC.changes $1/$ORIG_SPEC-utils.changes
diff --git a/pre_checkin.sh b/pre_checkin.sh
deleted file mode 100644
index 9f18195..0000000
--- a/pre_checkin.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-bash libcddb_spec-prepare.sh "$PWD" libcddb