Initial commit

This commit is contained in:
crt0mega 2021-05-24 00:21:33 +02:00
commit 49a28ef288
Signed by: crt0mega
GPG Key ID: DCAA09100B14F420
30 changed files with 434 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
debian/debhelper*
debian/.debhelper
debian/*.log
debian/*.debhelper
debian/*.substvars
debian/debhelper-build-stamp
debian/asus-wmi-sensors-dkms
debian/asus-wmi-sensors-dkms*
debian/files
.pc
debian/*.ex
debian/*.EX

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src"]
path = src
url = https://gitlab.com/torkel104/libstrangle.git

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
libstrangle (0.1.1-1) unstable; urgency=medium
* Initial release
-- crt0mega <crt0mega@c-r-t.tk> Sun, 23 May 2021 20:38:41 +0200

17
debian/control vendored Normal file
View File

@ -0,0 +1,17 @@
Source: libstrangle
Section: misc
Priority: optional
Maintainer: crt0mega <crt0mega@c-r-t.tk>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.5.1
Homepage: https://gitlab.com/torkel104/libstrangle
#Vcs-Browser: https://salsa.debian.org/debian/libstrangle
#Vcs-Git: https://salsa.debian.org/debian/libstrangle.git
Rules-Requires-Root: no
Package: libstrangle
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Frame rate limiter for Linux.
Cap the FPS (frames per second) of a chosen game by using the included script strangle.

39
debian/copyright vendored Normal file
View File

@ -0,0 +1,39 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libstrangle
Upstream-Contact: <preferred name and address to reach the upstream project>
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: GPL-3.0+
Files: debian/*
Copyright: 2021 crt0mega <crt0mega@c-r-t.tk>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid picking licenses with terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
#
# If you need, there are some extra license texts available in two places:
# /usr/share/debhelper/dh_make/licenses/
# /usr/share/common-licenses/

2
debian/libstrangle-docs.docs vendored Normal file
View File

@ -0,0 +1,2 @@
README.Debian
README.source

1
debian/libstrangle/DEBIAN/conffiles vendored Normal file
View File

@ -0,0 +1 @@
/etc/ld.so.conf.d/libstrangle.conf

11
debian/libstrangle/DEBIAN/control vendored Normal file
View File

@ -0,0 +1,11 @@
Package: libstrangle
Version: 0.1.1-1
Architecture: amd64
Maintainer: crt0mega <crt0mega@c-r-t.tk>
Installed-Size: 443
Depends: libc6 (>> 2.31), libc6 (<< 2.32), libgcc-s1 (>= 4.2), libstdc++6 (>= 5)
Section: misc
Priority: optional
Homepage: https://gitlab.com/torkel104/libstrangle
Description: Frame rate limiter for Linux.
Cap the FPS (frames per second) of a chosen game by using the included script strangle.

11
debian/libstrangle/DEBIAN/md5sums vendored Normal file
View File

@ -0,0 +1,11 @@
35dbf6d202f84a15f8d000d7c623c62d usr/bin/strangle
39b053e5bd7cec95da60c75c688f862a usr/bin/stranglevk
abe5912ec1cb73983d325ee42b094650 usr/lib/libstrangle/lib32/libstrangle.so
c434950b4af80cd75efb2f4474e669a6 usr/lib/libstrangle/lib32/libstrangle_nodlsym.so
f940f90e16de2dc7ac49693754bfcc65 usr/lib/libstrangle/lib32/libstrangle_vk.so
ad4b13369f5eddf52ba8913e62dab6da usr/lib/libstrangle/lib64/libstrangle.so
ff49a204ba0497ef0a46f3ad66b97ed5 usr/lib/libstrangle/lib64/libstrangle_nodlsym.so
695049abfd0e2effb37230abab4fd67c usr/lib/libstrangle/lib64/libstrangle_vk.so
dc1b2e6fc57a67b68b5ae17bc1e37c31 usr/share/doc/libstrangle/changelog.Debian.gz
1080fc22867256e9238f95e7e82e534c usr/share/doc/libstrangle/copyright
f11c08ce53d1732355707d4cb07cd773 usr/share/vulkan/implicit_layer.d/libstrangle_vk.json

43
debian/libstrangle/DEBIAN/postinst vendored Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# postinst script for libstrangle
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
;;
triggered)
ldconfig
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0

1
debian/libstrangle/DEBIAN/triggers vendored Normal file
View File

@ -0,0 +1 @@
activate-noawait ldconfig

View File

@ -0,0 +1,2 @@
/usr/lib/libstrangle/lib32/
/usr/lib/libstrangle/lib64/

135
debian/libstrangle/usr/bin/strangle vendored Executable file
View File

@ -0,0 +1,135 @@
#!/bin/sh
programName=$(basename "$0")
STRANGLE_LIB_NAME="libstrangle.so"
STRANGLE_LIB_NAME_NO_DLSYM="libstrangle_nodlsym.so"
print_usage_info() {
echo "Usage: ${programName} [OPTION]... [FPS] PROGRAM"
echo " or: ${programName} [OPTION]... [FPS]:[BATTERY_FPS] PROGRAM"
echo "Limit the framerate of PROGRAM to FPS"
echo
echo "Mandatory arguments to long options are mandatory for short options too."
echo " -a, --aniso AF sets the anisotropic filtering level. Makes textures"
echo " sharper at an angle. Limited OpenGL support"
echo " -b, --battery-fps FPS alternative framerate cap for when running on"
echo " battery power. See --fps"
echo " -f, --fps FPS limit the framerate to FPS."
echo " A value of 0 will disable the limiter."
echo " -k, --vulkan-only prevent the OpenGL libs from loading"
echo " -n, --no-dlsym disable dlsym hijacking in the OpenGL library"
echo " -p, --picmip PICMIP set the mipmap LoD bias to PICMIP. A higher value"
echo " means blurrier textures. Can be negative"
echo " -t, --trilinear force trilinear filtering. Vulkan only"
echo " -v, --vsync VSYNC Force vertical synchronisation on or off."
echo " For OpenGL the following rules apply:"
echo " 0 - Force off"
echo " 1 - Force on"
echo " n - Sync to refresh rate / n"
echo " For Vulkan the following rules apply:"
echo " 0 - Force off"
echo " 1 - Mailbox mode. Uncapped framerate"
echo " 2 - Traditional vsync. Capped framerate"
echo " 3 - Adaptive vsync. tearing at low framerates"
echo
echo "Short options may not be combined into one string."
echo "Options will override environment variables."
echo
echo "Some programs will crash, freeze or behave unexpectedly when dlsym is hijacked"
echo "If a program is exhibiting these symptoms when run with strangle try using the"
echo "'--no-dlsym' option. Or if the program uses the Vulkan API you can disable"
echo "strangle's OpenGL libs altogether with the '--vulkan-only' option."
echo
echo "Strangle home page: <https://gitlab.com/torkel104/libstrangle>"
}
while [ $# -gt 0 ]; do
if echo $1 | grep -Pq '^\d+(\.\d+)?$'; then
export STRANGLE_FPS="$1"
shift
elif echo $1 | grep -Pq '^\d+(\.\d+)?:\d+(\.\d+)?$'; then
export STRANGLE_FPS="$(echo $1 | cut -d':' -f1)"
export STRANGLE_FPS_BATTERY="$(echo $1 | cut -d':' -f2)"
shift
else
case "$1" in
-a|--aniso)
export STRANGLE_AF="$2"
shift
shift
;;
-b|--battery-fps)
export STRANGLE_FPS_BATTERY="$2"
shift
shift
;;
-f|--fps)
export STRANGLE_FPS="$2"
shift
shift
;;
-h|--help)
print_usage_info
exit 0
;;
-k|--vulkan-only)
STRANGLE_VKONLY="1"
shift
;;
-n|--no-dlsym)
STRANGLE_NODLSYM="1"
shift
;;
-p|--picmip)
export STRANGLE_PICMIP="$2"
shift
shift
;;
-t|--trilinear)
STRANGLE_TRILINEAR="1"
shift
;;
-v|--vsync)
export STRANGLE_VSYNC="$2"
shift
shift
;;
--)
shift
break 2
;;
*)
break 2
;;
esac
fi
done
if [ "$#" -eq 0 ]; then
echo "${programName}: no program supplied"
echo "Try '${programName} --help' for more information"
exit 1
fi
if [ -n "$STRANGLE_AF" ]; then
# AMD
export AMD_TEX_ANISO="$STRANGLE_AF"
export R600_TEX_ANISO="$STRANGLE_AF"
export RADV_TEX_ANISO="$STRANGLE_AF"
# Nvidia
# http://us.download.nvidia.com/XFree86/Linux-x86_64/440.64/README/openglenvvariables.html
export __GL_LOG_MAX_ANISO=$(echo $STRANGLE_AF | awk '{printf "%d", log($1)/log(2)}')
fi
if [ "$STRANGLE_VKONLY" != "1" ]; then
if [ "$STRANGLE_NODLSYM" = "1" ]; then
LD_PRELOAD="${LD_PRELOAD}:${STRANGLE_LIB_NAME_NO_DLSYM}"
else
LD_PRELOAD="${LD_PRELOAD}:${STRANGLE_LIB_NAME}"
fi
fi
# Execute the strangled program under a clean environment
# pass through the FPS and overriden LD_PRELOAD environment variables
exec env ENABLE_VK_LAYER_TORKEL104_libstrangle=1 LD_PRELOAD="${LD_PRELOAD}" "$@"

3
debian/libstrangle/usr/bin/stranglevk vendored Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
ENABLE_VK_LAYER_TORKEL104_libstrangle=1 STRANGLE_VKONLY=1 strangle "$@"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,39 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libstrangle
Upstream-Contact: <preferred name and address to reach the upstream project>
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: GPL-3.0+
Files: debian/*
Copyright: 2021 crt0mega <crt0mega@c-r-t.tk>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid picking licenses with terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
#
# If you need, there are some extra license texts available in two places:
# /usr/share/debhelper/dh_make/licenses/
# /usr/share/common-licenses/

View File

@ -0,0 +1,17 @@
{
"file_format_version" : "1.0.0",
"layer" : {
"name": "VK_LAYER_TORKEL104_libstrangle",
"type": "GLOBAL",
"api_version": "1.1.125",
"library_path": "libstrangle_vk.so",
"implementation_version": "1",
"description": "Libstrangle framerate limiter",
"enable_environment": {
"ENABLE_VK_LAYER_TORKEL104_libstrangle": "1"
},
"disable_environment": {
"DISABLE_VK_LAYER_TORKEL104_libstrangle": "1"
}
}
}

21
debian/patches/01_fix_makefile vendored Normal file
View File

@ -0,0 +1,21 @@
Fixes makefile by removing ldconfig and correcting installation prefix to /usr
--- a/src/makefile
+++ b/src/makefile
@@ -4,7 +4,7 @@
LDFLAGS=-Wl,-z,relro,-z,now
LDLIBS=-ldl -lrt
-prefix=/usr/local
+prefix=/usr
exec_prefix=$(prefix)
bindir=$(exec_prefix)/bin
libdir=$(exec_prefix)/lib
@@ -88,7 +88,7 @@
install-ld: ld
install -m 0644 -D -T $(BUILDDIR)/libstrangle.conf $(DESTDIR)/etc/ld.so.conf.d/libstrangle.conf
- ldconfig
+# ldconfig
install-32: 32-bit
install -m 0755 -D -T $(BUILDDIR)/libstrangle32.so $(DESTDIR)$(LIB32_PATH)/libstrangle.so

1
debian/patches/series vendored Normal file
View File

@ -0,0 +1 @@
01_fix_makefile

43
debian/postinst vendored Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# postinst script for libstrangle
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
;;
triggered)
ldconfig
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

25
debian/rules vendored Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@ -Dsrc
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

1
debian/triggers vendored Normal file
View File

@ -0,0 +1 @@
activate-noawait ldconfig

1
src Submodule

@ -0,0 +1 @@
Subproject commit 36122dfa7e4faf0eaf70629b8305dd97b61b0ba5