sys-apps/readahead-list: EAPI 8, fix build w/ Clang 16

Closes: https://bugs.gentoo.org/875047
Closes: https://bugs.gentoo.org/851825
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2022-12-25 21:24:10 +00:00
parent 0fbcc55623
commit edbec5e721
10 changed files with 256 additions and 40 deletions
@@ -0,0 +1,44 @@
https://github.com/robbat2/readahead-list/pull/1
From 8cfc35923827b6f6e3aff9641aa4cb7c4ac7949c Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 25 Dec 2022 20:33:44 +0000
Subject: [PATCH 1/6] Modernise autotools
Signed-off-by: Sam James <sam@gentoo.org>
--- a/configure.ac
+++ b/configure.ac
@@ -1,14 +1,14 @@
# Copyright (C) 2004-2005 Robin Hugh Johnson <robbat2@orbis-terrarum.net>
-#
+#
# This file is free software; as a special exception the author gives
-# unlimited permission to copy and/or distribute it, with or without
+# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-#
+#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-AC_PREREQ(2.59)
+AC_PREREQ([2.71])
# version stamp is 0.YYYYMMDD.HHMM in UTC!
# date +"1.%Y%m%d.%H%M" -u
AC_INIT([readahead-list],[1.20060421.1016],[Robin H. Johnson robbat2@orbis-terrarum.net],[readahead-list])
@@ -38,11 +38,9 @@ AC_PATH_PROG(SED, sed, sed)
AC_PATH_PROG(CMP, cmp, cmp)
AC_CANONICAL_HOST
-LF_SET_WARNINGS
AC_PROG_RANLIB
# Checks for header files.
-AC_HEADER_STDC
AC_CHECK_HEADERS([ errno.h fcntl.h getopt.h linux/fs.h sched.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/syscall.h sys/types.h unistd.h ])
# Checks for typedefs, structures, and compiler characteristics.
--
2.39.0
@@ -0,0 +1,70 @@
https://github.com/robbat2/readahead-list/pull/1
From 37e699689661249c88a020681a70cd0633ee7ef4 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 25 Dec 2022 20:34:38 +0000
Subject: [PATCH 2/6] Set -D_GNU_SOURCE for readahead() to fix
-Wimplicit-function-declaration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
readahead-list.c: In function ‘process_file’:
readahead-list.c:111:17: error: implicit declaration of function ‘readahead’ [-Werror=implicit-function-declaration]
111 | readahead(fd, (loff_t)0, (size_t)buf.st_size);
| ^~~~~~~~~
Signed-off-by: Sam James <sam@gentoo.org>
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,9 @@ AC_PATH_PROG(CMP, cmp, cmp)
AC_CANONICAL_HOST
AC_PROG_RANLIB
+# Provides _GNU_SOURCE for readahead()
+AC_USE_SYSTEM_EXTENSIONS
+
# Checks for header files.
AC_CHECK_HEADERS([ errno.h fcntl.h getopt.h linux/fs.h sched.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/syscall.h sys/types.h unistd.h ])
--- a/src/filelist-order.cxx
+++ b/src/filelist-order.cxx
@@ -14,6 +14,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
+
+#include <../config.h>
+
#include <map>
#include <set>
#include <iostream>
@@ -31,7 +34,6 @@
#include <fcntl.h>
#include <linux/fs.h>
-#include <../config.h>
#ifndef BUFFER_SIZE
#define BUFFER_SIZE 2048
--- a/src/readahead-list.c
+++ b/src/readahead-list.c
@@ -19,6 +19,7 @@
// Based on code originally written by Erich Schubert <erich@debian.org>.
// $Header: /code/convert/cvsroot/infrastructure/readahead-list/src/readahead-list.c,v 1.5 2006/04/21 10:13:54 robbat2 Exp $
+#include <../config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -31,7 +32,6 @@
#include <sched.h>
#include <string.h>
#include <errno.h>
-#include <../config.h>
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
--
2.39.0
@@ -0,0 +1,43 @@
https://github.com/robbat2/readahead-list/pull/1
From 9d7b7a13ac265b76bb7933072a20bf462e5377a6 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 25 Dec 2022 20:35:38 +0000
Subject: [PATCH 3/6] Simplify setting up Large File Support (use
AC_SYS_LARGEFILE)
Signed-off-by: Sam James <sam@gentoo.org>
--- a/configure.ac
+++ b/configure.ac
@@ -13,18 +13,15 @@ AC_PREREQ([2.71])
# date +"1.%Y%m%d.%H%M" -u
AC_INIT([readahead-list],[1.20060421.1016],[Robin H. Johnson robbat2@orbis-terrarum.net],[readahead-list])
-LFS_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
WARN_CFLAGS="-Wall -W"
CFLAGS="$CFLAGS $WARN_CFLAGS"
CXXFLAGS="$CXXFLAGS $WARN_CFLAGS"
-CPPFLAGS="$CPPFLAGS $LFS_CPPFLAGS"
-export CFLAGS CXXFLAGS CPPFLAGS
+export CFLAGS CXXFLAGS
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([dist-bzip2])
-
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
@@ -43,6 +40,8 @@ AC_PROG_RANLIB
# Provides _GNU_SOURCE for readahead()
AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+
# Checks for header files.
AC_CHECK_HEADERS([ errno.h fcntl.h getopt.h linux/fs.h sched.h stdio.h stdlib.h string.h sys/ioctl.h sys/mman.h sys/syscall.h sys/types.h unistd.h ])
--
2.39.0
@@ -0,0 +1,22 @@
https://github.com/robbat2/readahead-list/pull/1
From f0f32adfb4eaf26e33fc1655a22a529961257db9 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 25 Dec 2022 20:38:01 +0000
Subject: [PATCH 4/6] filelist-order.cxx: Add missing <cstdlib> include for
exit()
Signed-off-by: Sam James <sam@gentoo.org>
--- a/src/filelist-order.cxx
+++ b/src/filelist-order.cxx
@@ -17,6 +17,7 @@
#include <../config.h>
+#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
--
2.39.0
@@ -0,0 +1,50 @@
https://github.com/robbat2/readahead-list/pull/1
From 4a22080a30c8906f99eb5899218b9a5f1291b634 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sun, 25 Dec 2022 20:57:43 +0000
Subject: [PATCH 5/6] Fix build with modern C++
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
```
filelist-order.cxx: In function ‘void printItem(std::pair<mapkey*, const char*>, std::vector<OrderField*>*)’:
filelist-order.cxx:276:37: error: unable to find string literal operator ‘operator""fmt’ with ‘const char [3]’, ‘long unsigned int’ arguments
276 | #define case_entry(fmt,func) printf("%s"fmt,(first ? "" : " "),func_##func(mk)); break;
| ^~~~~~~
```
Signed-off-by: Sam James <sam@gentoo.org>
--- a/src/filelist-order.cxx
+++ b/src/filelist-order.cxx
@@ -15,8 +15,6 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
-#include <../config.h>
-
#include <cstdlib>
#include <map>
#include <set>
@@ -36,6 +34,8 @@
#include <fcntl.h>
#include <linux/fs.h>
+#include <../config.h>
+
#ifndef BUFFER_SIZE
#define BUFFER_SIZE 2048
#endif
@@ -275,7 +275,7 @@ void printItem(PAIR_COMPLETE_TYPE p,vector <OrderField*> *ofa) {
continue;
}
OrderField of = *ofp;
-#define case_entry(fmt,func) printf("%s"fmt,(first ? "" : " "),func_##func(mk)); break;
+#define case_entry(fmt,func) printf("%s" fmt,(first ? "" : " "),func_##func(mk)); break;
switch(of.type) {
case ST_DEV: case_entry("%lld",ST_DEV);
case ST_INO: case_entry("%lld",ST_INO);
--
2.39.0
@@ -11,7 +11,7 @@ depend() {
start() {
# force reading
source /etc/conf.d/readahead-list
. /etc/conf.d/readahead-list
f="${READAHEAD_LIST_call_main}"
ebegin "readahead(2): ${f}"
@@ -2,7 +2,6 @@
# Copyright 2005 Robin H. Johnson <robbat2@orbis-terrarum.net>
# Distributed under the terms of the GNU General Public License v2
depend() {
after checkroot
# this should start as early as possible
@@ -12,7 +11,7 @@ depend() {
start() {
# force reading
source /etc/conf.d/readahead-list
. /etc/conf.d/readahead-list
f="${READAHEAD_LIST_call_early}"
ebegin "readahead(2): ${f}"
/sbin/readahead-list ${f}
@@ -1,10 +0,0 @@
--- a/src/filelist-order.cxx
+++ b/src/filelist-order.cxx
@@ -19,6 +19,7 @@
#include <iostream>
#include <fstream>
#include <vector>
+#include <cstdlib>
#include <assert.h>
#include <string.h>
@@ -1,15 +0,0 @@
filelist-order.cxx:276:37: error: unable to find string literal operator ‘operator""fmt’ with ‘const char [3]’, ‘long unsigned int’ arguments
https://bugs.gentoo.org/594092
--- a/src/filelist-order.cxx
+++ b/src/filelist-order.cxx
@@ -273,7 +273,7 @@ void printItem(PAIR_COMPLETE_TYPE p,vector <OrderField*> *ofa) {
continue;
}
OrderField of = *ofp;
-#define case_entry(fmt,func) printf("%s"fmt,(first ? "" : " "),func_##func(mk)); break;
+#define case_entry(fmt,func) printf("%s" fmt,(first ? "" : " "),func_##func(mk)); break;
switch(of.type) {
case ST_DEV: case_entry("%lld",ST_DEV);
case ST_INO: case_entry("%lld",ST_INO);
@@ -1,11 +1,14 @@
# Copyright 1999-2021 Gentoo Authors
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
EAPI=8
inherit autotools
DESCRIPTION="Preloads files into the page cache to accelerate program loading"
HOMEPAGE="https://github.com/robbat2/readahead-list"
SRC_URI="mirror://gentoo/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ppc x86"
@@ -14,10 +17,16 @@ IUSE="doc"
DEPEND="virtual/os-headers"
PATCHES=(
"${FILESDIR}/${P}-gcc-4.3.patch"
"${FILESDIR}/${P}-gcc6.patch"
"${FILESDIR}/1.20060421.1016/"
)
src_prepare() {
default
# Drop once ${P}-modernisation.patch is in a release
eautoreconf
}
src_configure() {
econf --sbindir=/sbin
}
@@ -25,33 +34,37 @@ src_configure() {
src_install() {
default
# init scripts
#cd "${S}/contrib/init/gentoo/"
# Init scripts
#cd "${S}/contrib/init/gentoo" || die
#newinitd init.d-readahead-list readahead-list
#newinitd init.d-readahead-list-early readahead-list-early
#newconfd conf.d-readahead-list readahead-list
newinitd "${FILESDIR}"/init.d-readahead-list readahead-list
newinitd "${FILESDIR}"/init.d-readahead-list-early readahead-list-early
newconfd "${FILESDIR}"/conf.d-readahead-list readahead-list
# default config
# Default config
insinto /etc/readahead-list
cd "${S}/contrib/data"
cd "${S}/contrib/data" || die
newins readahead.runlevel-default.list runlevel-default
newins readahead.runlevel-boot.list runlevel-boot
newins readahead._sbin_rc.list exec_sbin_rc
# docs
cd "${S}"
cd "${S}" || die
if use doc; then
docinto scripts
dodoc contrib/scripts/*
fi
# clean up a bit
find "${D}/usr/share/doc/${PF}/" -type f -name 'Makefile*' -exec rm -f \{\} \;
# Clean up a bit
find "${ED}/usr/share/doc/${PF}/" -type f -name 'Makefile*' -exec rm -f \{\} \;
}
pkg_postinst() {
einfo "You should add readahead-list to your runlevels:"
einfo " rc-update add readahead-list-early boot"
einfo " rc-update add readahead-list boot"
einfo "Also consider customizing the lists in /etc/readahead-list"
einfo "Also consider customizing the lists in ${EROOT}/etc/readahead-list"
einfo "for maximum performance gain."
}