comparison mupdf-source/scripts/pipcl.py @ 14:59f1bd90b2a0

Use "soname" on FreeBSD also. FreeBSD and Linux are now handled identical with regard to soname and library naming and packaging.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 17 Sep 2025 20:35:45 +0200
parents b50eed0cc0ef
children dd663470c57c
comparison
equal deleted inserted replaced
13:d6cbc8049ab0 14:59f1bd90b2a0
1857 def linux(): 1857 def linux():
1858 return platform.system() == 'Linux' 1858 return platform.system() == 'Linux'
1859 1859
1860 def openbsd(): 1860 def openbsd():
1861 return platform.system() == 'OpenBSD' 1861 return platform.system() == 'OpenBSD'
1862
1863 def freebsd():
1864 return platform.system() == 'FreeBSD'
1865
1862 1866
1863 class PythonFlags: 1867 class PythonFlags:
1864 ''' 1868 '''
1865 Compile/link flags for the current python, for example the include path 1869 Compile/link flags for the current python, for example the include path
1866 needed to get `Python.h`. 1870 needed to get `Python.h`.
2307 If we are on Linux and `path` is softlink and points to a shared library 2311 If we are on Linux and `path` is softlink and points to a shared library
2308 for which `objdump -p` contains 'SONAME', return the pointee. Otherwise 2312 for which `objdump -p` contains 'SONAME', return the pointee. Otherwise
2309 return `path`. Useful if Linux shared libraries have been created with 2313 return `path`. Useful if Linux shared libraries have been created with
2310 `-Wl,-soname,...`, where we need to embed the versioned library. 2314 `-Wl,-soname,...`, where we need to embed the versioned library.
2311 ''' 2315 '''
2312 if linux() and os.path.islink(path): 2316 if (linux() or freebsd()) and os.path.islink(path):
2313 path2 = os.path.realpath(path) 2317 path2 = os.path.realpath(path)
2314 if subprocess.run(f'objdump -p {path2}|grep SONAME', shell=1, check=0).returncode == 0: 2318 if subprocess.run(f'objdump -p {path2}|grep SONAME', shell=1, check=0).returncode == 0:
2315 return path2 2319 return path2
2316 elif openbsd(): 2320 elif openbsd():
2317 # Return newest .so with version suffix. 2321 # Return newest .so with version suffix.