There were a couple of upstream releases for libcpucycles
during 2024 and I think it makes sense to update the port.

ok?

20240318 changelog:

- Port to MacOS X
- Include cpucycles-info man page.

20240114 changelog:

- Add arm32-1176 counter.
- Allow slop 0.2 rather than 0.1 for FINDMULTIPLIER.
- Improve platform detection.
- Port to FreeBSD.
- Use blue boldface during compilation for "skipping option that did
  not compile".
- doc/install.md: headings, note manual pages.
- Add doc/license.md
- Update HTML style for better tt visibility and copy-paste.



Index: Makefile
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/Makefile,v
diff -u -p -u -p -r1.3 Makefile
--- Makefile    6 May 2024 12:23:46 -0000       1.3
+++ Makefile    8 Jan 2025 17:27:05 -0000
@@ -1,12 +1,11 @@
 COMMENT=               library for counting CPU cycles
 
-V=                     20230115
+V=                     20240318
 DISTNAME=              libcpucycles-${V}
 SHARED_LIBS+=          cpucycles       0.0     # 1.0
 CATEGORIES=            misc
 HOMEPAGE=              https://cpucycles.cr.yp.to/
 SITES=                 ${HOMEPAGE}
-REVISION=              0
 
 MAINTAINER=            Miguel Landaeta <mig...@miguel.cc>
 
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/distinfo,v
diff -u -p -u -p -r1.1.1.1 distinfo
--- distinfo    14 Aug 2023 08:01:46 -0000      1.1.1.1
+++ distinfo    8 Jan 2025 17:29:06 -0000
@@ -1,2 +1,2 @@
-SHA256 (libcpucycles-20230115.tar.gz) = 
3TjBIgVVAha5Jgfw9CcnxSoBCaFq8uqnoTg11T67wiU=
-SIZE (libcpucycles-20230115.tar.gz) = 34852
+SHA256 (libcpucycles-20240318.tar.gz) = 
GWRqG2nY8BNkcxP87fFbaokyekt85VNTbVE/H25U0y0=
+SIZE (libcpucycles-20240318.tar.gz) = 42790
Index: patches/patch-configure_fix_soname
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/patches/patch-configure_fix_soname,v
diff -u -p -u -p -r1.1.1.1 patch-configure_fix_soname
--- patches/patch-configure_fix_soname  14 Aug 2023 08:01:46 -0000      1.1.1.1
+++ patches/patch-configure_fix_soname  8 Jan 2025 20:10:19 -0000
@@ -6,14 +6,14 @@ Index: configure
 @@ -10,6 +10,7 @@
  prefix = '/usr/local'
  clean = True
- linktype = 'so'
+ darwin = platform.system() == 'Darwin'
 +soversion = '0.0'
  
- host = platform.machine()
- host = ''.join(c for c in host if c in 
'_0123456789abcdefghijklmnopqrstuvwxyz')
+ def hostsanitize(host):
+   host = host.split('-')[0]
 @@ -43,6 +44,9 @@
-     host = arg[7:]
-     host = host.split('-')[0]
+   if arg.startswith('--host='):
+     host = hostsanitize(arg[7:])
      continue
 +  if arg.startswith('--soversion='):
 +    soversion = arg[12:]
@@ -21,59 +21,59 @@ Index: configure
    if arg == '--clean':
      clean = True
      continue
-@@ -54,6 +58,7 @@
+@@ -60,6 +64,7 @@
  echoargs = './configure'
  echoargs += ' --prefix=%s' % prefix
  echoargs += ' --host=%s' % host
 +echoargs += ' --soversion=%s' % soversion
  if clean: echoargs += ' --clean'
  if not clean: echoargs += ' --noclean'
- print(echoargs)
-@@ -222,23 +227,17 @@
-   f.write('%s -shared \\\n' % firstcompiler)
-   if rpath:
-     f.write('  -Wl,-rpath=%s \\\n' % rpath)
--  f.write('  -Wl,-soname,libcpucycles.so.1 \\\n')
--  f.write('  -o package/lib/libcpucycles.so.1 \\\n')
-+  f.write('  -Wl,-soname,libcpucycles.so.%s \\\n' % soversion)
-+  f.write('  -o package/lib/libcpucycles.so.%s \\\n' % soversion)
-   f.write('  "$@"\n')
--  f.write('chmod 644 package/lib/libcpucycles.so.1\n')
-+  f.write('chmod 644 package/lib/libcpucycles.so.%s\n' % soversion)
+ if darwin: echoargs += ' --darwin'
+@@ -96,7 +101,7 @@
+ # ----- shared-library variations
+ 
+ so = 'dylib' if darwin else 'so'
+-so1 = '1.dylib' if darwin else 'so.1'
++so1 = f'so.{soversion}'
+ soname = 'install_name' if darwin else 'soname'
+ syslibs = '-lm' if darwin else '-lm -lrt'
+ 
+@@ -245,17 +250,11 @@
+   f.write(f'chmod 644 package/lib/libcpucycles.{so1}\n')
  os.chmod('build/%s/scripts/sharedlib' % host,0o755)
  
--M = 'package/lib/libcpucycles.so.1: scripts/sharedlib %s\n' % ' 
'.join(cpucyclesofiles)
-+M = 'package/lib/libcpucycles.so.$(LIBcpucycles_VERSION): scripts/sharedlib 
%s\n' % ' '.join(cpucyclesofiles)
+-M = f'package/lib/libcpucycles.{so1}: scripts/sharedlib %s\n' % ' 
'.join(cpucyclesofiles)
++M = f'package/lib/libcpucycles.so.$(LIBcpucycles_VERSION): scripts/sharedlib 
%s\n' % ' '.join(cpucyclesofiles)
  M += '\tscripts/sharedlib %s\n' % ' '.join(cpucyclesofiles)
  M += '\n'
  makefile = M + makefile
  
--M = 'package/lib/libcpucycles.so: package/lib/libcpucycles.so.1\n'
--M += '\trm -f package/lib/libcpucycles.so\n'
--M += '\tln -s libcpucycles.so.1 package/lib/libcpucycles.so\n'
+-M = f'package/lib/libcpucycles.{so}: package/lib/libcpucycles.{so1}\n'
+-M += f'\trm -f package/lib/libcpucycles.{so}\n'
+-M += f'\tln -s libcpucycles.{so1} package/lib/libcpucycles.{so}\n'
 -M += '\n'
 -makefile = M + makefile
 -
  # ----- command
  
  os.makedirs('build/%s/command'%host)
-@@ -267,8 +266,8 @@
+@@ -284,8 +283,8 @@
    M += '\tscripts/compiledefault command %s c -I include\n' % base
    M += '\n'
    makefile = M + makefile
--  M = 'package/bin/%s: command/%s.o%s\n' % (base,base,''.join(' 
package/lib/%s.%s' % (x,linktype) for x in libs))
--  M += '\tcd command && ./link bin/%s %s.o%s -lm -lrt\n' % 
(base,base,''.join(' lib/%s.%s' % (x,linktype) for x in libs))
-+  M = 'package/bin/%s: command/%s.o%s.$(LIBcpucycles_VERSION)\n' % 
(base,base,''.join(' package/lib/%s.%s' % (x,linktype) for x in libs))
-+  M += '\tcd command && ./link bin/%s %s.o%s.$(LIBcpucycles_VERSION) -lm 
-lrt\n' % (base,base,''.join(' lib/%s.%s' % (x,linktype) for x in libs))
+-  M = 'package/bin/%s: command/%s.o%s\n' % (base,base,''.join(' 
package/lib/%s.%s' % (x,so) for x in libs))
+-  M += f'\tcd command && ./link bin/%s %s.o%s {syslibs}\n' % 
(base,base,''.join(' lib/%s.%s' % (x,so) for x in libs))
++  M = 'package/bin/%s: command/%s.o%s.$(LIBcpucycles_VERSION)\n' % 
(base,base,''.join(' package/lib/%s.%s' % (x,so) for x in libs))
++  M += f'\tcd command && ./link bin/%s %s.o%s.$(LIBcpucycles_VERSION) 
{syslibs}\n' % (base,base,''.join(' lib/%s.%s' % (x,so) for x in libs))
    M += '\n'
    makefile = M + makefile
    commands += ['package/bin/%s' % base]
-@@ -286,7 +285,7 @@
+@@ -303,7 +302,7 @@
  
  # ----- make default
  
--M = 'default: package/lib/libcpucycles.a package/lib/libcpucycles.so 
package/lib/libcpucycles.so.1 \\\n'
-+M = 'default: package/lib/libcpucycles.a 
package/lib/libcpucycles.so.$(LIBcpucycles_VERSION) \\\n'
+-M = f'default: package/lib/libcpucycles.a package/lib/libcpucycles.{so} 
package/lib/libcpucycles.{so1} \\\n'
++M = f'default: package/lib/libcpucycles.a 
package/lib/libcpucycles.so.$(LIBcpucycles_VERSION) \\\n'
  M += 'commands\n'
  M += '\n'
  makefile = M + makefile
Index: patches/patch-configure_remove_librt
===================================================================
RCS file: 
/home/cvs/ports/misc/libcpucycles/patches/patch-configure_remove_librt,v
diff -u -p -u -p -r1.1.1.1 patch-configure_remove_librt
--- patches/patch-configure_remove_librt        14 Aug 2023 08:01:46 -0000      
1.1.1.1
+++ patches/patch-configure_remove_librt        8 Jan 2025 20:11:37 -0000
@@ -3,12 +3,12 @@ OpenBSD neither provides nor requires li
 Index: configure
 --- configure.orig
 +++ configure
-@@ -267,7 +267,7 @@
-   M += '\n'
-   makefile = M + makefile
-   M = 'package/bin/%s: command/%s.o%s.$(LIBcpucycles_VERSION)\n' % 
(base,base,''.join(' package/lib/%s.%s' % (x,linktype) for x in libs))
--  M += '\tcd command && ./link bin/%s %s.o%s.$(LIBcpucycles_VERSION) -lm 
-lrt\n' % (base,base,''.join(' lib/%s.%s' % (x,linktype) for x in libs))
-+  M += '\tcd command && ./link bin/%s %s.o%s.$(LIBcpucycles_VERSION) -lm\n' % 
(base,base,''.join(' lib/%s.%s' % (x,linktype) for x in libs))
-   M += '\n'
-   makefile = M + makefile
-   commands += ['package/bin/%s' % base]
+@@ -103,7 +103,7 @@
+ so = 'dylib' if darwin else 'so'
+ so1 = soversion
+ soname = 'install_name' if darwin else 'soname'
+-syslibs = '-lm' if darwin else '-lm -lrt'
++syslibs = '-lm'
+ 
+ # ----- compilers
+ 
Index: patches/patch-configure_translate_host_arch
===================================================================
RCS file: 
/home/cvs/ports/misc/libcpucycles/patches/patch-configure_translate_host_arch,v
diff -u -p -u -p -r1.1.1.1 patch-configure_translate_host_arch
--- patches/patch-configure_translate_host_arch 14 Aug 2023 08:01:46 -0000      
1.1.1.1
+++ patches/patch-configure_translate_host_arch 8 Jan 2025 17:02:34 -0000
@@ -3,35 +3,19 @@ Translate OpenBSD architecture name to t
 Index: configure
 --- configure.orig
 +++ configure
-@@ -36,13 +36,30 @@ if host.startswith('sparc') or host.startswith('sun'):
- 
- makefile = ''
- 
-+
-+# Some OpenBSD architecture names don't match the
-+# architecture name used by upstream, so they require to
-+# be translated, so they can be recognized by build scripts.
-+#
-+def translate_arch(openbsd_arch):
-+  archs = {
-+    'arm': 'arm32',
-+    'armv7': 'arm32',
-+    'i386': 'x86',
-+    'powerpc64': 'ppc64',
-+    'macppc': 'ppc32',
-+    'powerpc': 'ppc32',
-+  }
-+  return archs.get(openbsd_arch, openbsd_arch)
-+
-+
- for arg in sys.argv[1:]:
-   if arg.startswith('--prefix='):
-     prefix = arg[9:]
-     continue
-   if arg.startswith('--host='):
-     host = arg[7:]
--    host = host.split('-')[0]
-+    host = translate_arch(host.split('-')[0])
-     continue
-   if arg.startswith('--soversion='):
-     soversion = arg[12:]
+@@ -19,6 +19,7 @@
+     ('amd64','amd64'), ('x86_64','amd64'),
+     ('x86','x86'), ('i386','x86'), ('i686','x86'),
+     ('arm64','arm64'), ('armv8','arm64'), ('aarch64','arm64'),
++    ('armv7','arm32'),
+     ('arm','arm32'),
+     ('riscv64','riscv64'),
+     ('riscv','riscv32'),
+@@ -27,6 +28,7 @@
+     ('ppc64','ppc64'), ('powerpc64','ppc64'),
+     ('powerpc','ppc32'),
+     ('ppc','ppc32'),
++    ('macppc','ppc32'),
+     ('sparc64','sparc64'), ('sparcv9','sparc64'), ('sun4u','sparc64'),
+     ('sparc','sparc32'), ('sun','sparc32'),
+   ):
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/pkg/PLIST,v
diff -u -p -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   14 Aug 2023 08:01:46 -0000      1.1.1.1
+++ pkg/PLIST   8 Jan 2025 21:12:11 -0000
@@ -2,4 +2,5 @@
 include/cpucycles.h
 @static-lib lib/libcpucycles.a
 @lib lib/libcpucycles.so.${LIBcpucycles_VERSION}
+@man man/man1/cpucycles-info.1
 @man man/man3/cpucycles.3

Reply via email to