diff options
-rw-r--r-- | development/cgit/README | 7 | ||||
-rw-r--r-- | development/cgit/cgit.SlackBuild | 23 | ||||
-rw-r--r-- | development/cgit/config/email-gravatar-sbo.lua | 9 | ||||
-rw-r--r-- | development/cgit/lua-md5-avatar.diff | 75 | ||||
-rw-r--r-- | development/cgit/slack-desc | 4 |
5 files changed, 107 insertions, 11 deletions
diff --git a/development/cgit/README b/development/cgit/README index 1f531470af..8239fefe01 100644 --- a/development/cgit/README +++ b/development/cgit/README @@ -5,8 +5,11 @@ The folder /var/cache/cgit, must be owned by your webserver user. A sample /etc/cgitrc (you must provide one) is in the docs folder, and so are some example configuration files for apache and lighttpd. -Optional dependencies: lua, luacrypto, and lua-md5 (for avatars -support). +Optional dependencies: For avatar support, install lua (or lua51, or +luajit) and lua-md5. cgit will search for luajit, lua, lua51 in that +order, and use the first one it finds; if none exist, it will build +without lua support. The slack-desc will show which lua package it +used, if any. If you want to use the email-libravatar-korg.lua filter or the email-gravatar-sbo.lua one, have a look also to the suggested css diff --git a/development/cgit/cgit.SlackBuild b/development/cgit/cgit.SlackBuild index f717f77a3a..a5ecdc91c5 100644 --- a/development/cgit/cgit.SlackBuild +++ b/development/cgit/cgit.SlackBuild @@ -21,6 +21,14 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20241118 bkw: Modified by SlackBuilds.org, BUILD=3: +# - modify all the email-avatar lua scripts to use only lua-md5, instead +# of a mix of lua-md5, luaossl (which we don't even have), and luacrypto. +# basically, all 3 were being used *just* to calculate md5sums; now +# all the scripts will use lua-md5 to calculate them. allows us to +# remove luacrypto from README, too. +# - make slack-desc reflect which lua package (if any) we built with. + # 20241025 bkw: Modified by SlackBuilds.org, BUILD=2: # - bump BUILD to make people rebuild with the new lua. # - remove mention of lua52/lua53 from README. @@ -29,7 +37,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=cgit VERSION=${VERSION:-1.2.3} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -86,6 +94,9 @@ chown -R root:root . find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} + +# 20241118 bkw: clean up the avatar scripts. +patch -p1 < $CWD/lua-md5-avatar.diff + # prepare sources sed -i Makefile \ -e "s|-g -Wall -Igit|-Wall ${SLKCFLAGS} -Igit|" \ @@ -122,8 +133,16 @@ mkdir -p $PKG/var/cache/cgit chown 80:80 $PKG/var/cache/cgit chmod 775 $PKG/var/cache/cgit +# 20241118 bkw: this will help the user out. +case "$( objdump -p cgit | grep 'NEEDED.*liblua' )" in + *liblua5.1.so) WITHLUA="with lua51" ;; + *liblua.so) WITHLUA="with lua" ;; + *libluajit*) WITHLUA="with luajit" ;; + *) WITHLUA="WITHOUT lua" ;; +esac + mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +sed "s,@WITHLUA@,$WITHLUA," < $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/development/cgit/config/email-gravatar-sbo.lua b/development/cgit/config/email-gravatar-sbo.lua index 0b8cb17ea2..b4903484d0 100644 --- a/development/cgit/config/email-gravatar-sbo.lua +++ b/development/cgit/config/email-gravatar-sbo.lua @@ -3,19 +3,18 @@ -- prefix in filters. It takes some part from the kernel.org's one. -- -- Requirements: --- luacrypto >= 0.3 --- <http://mkottman.github.io/luacrypto/> +-- lua-md5 (from SBo) -- -local crypto = require("crypto") +local md5 = require("md5") function filter_open(email, page) buffer = "" - md5 = crypto.digest("md5", email:sub(2, -2):lower()) + hexdigest = md5.sumhexa(email:sub(2, -2):lower()) end function filter_close() - html("<span class='gravatar'><img class='inline' src='//www.gravatar.com/avatar/" .. md5 .. "?s=13&d=retro' /><img class='onhover' src='//www.gravatar.com/avatar/" .. md5 .. "?s=128&d=retro' /></span> " .. buffer) + html("<span class='gravatar'><img class='inline' src='//www.gravatar.com/avatar/" .. hexdigest .. "?s=13&d=retro' /><img class='onhover' src='//www.gravatar.com/avatar/" .. hexdigest .. "?s=128&d=retro' /></span> " .. buffer) return 0 end diff --git a/development/cgit/lua-md5-avatar.diff b/development/cgit/lua-md5-avatar.diff new file mode 100644 index 0000000000..458f35cb1c --- /dev/null +++ b/development/cgit/lua-md5-avatar.diff @@ -0,0 +1,75 @@ +diff -Naur cgit-1.2.3/filters/email-gravatar.lua cgit-1.2.3.patched/filters/email-gravatar.lua +--- cgit-1.2.3/filters/email-gravatar.lua 2020-03-13 19:49:52.000000000 -0400 ++++ cgit-1.2.3.patched/filters/email-gravatar.lua 2024-11-18 22:09:51.781471494 -0500 +@@ -3,28 +3,18 @@ + -- prefix in filters. It is much faster than the corresponding python script. + -- + -- Requirements: +--- luaossl +--- <http://25thandclement.com/~william/projects/luaossl.html> ++-- lua-md5 + -- + +-local digest = require("openssl.digest") +- +-function md5_hex(input) +- local b = digest.new("md5"):final(input) +- local x = "" +- for i = 1, #b do +- x = x .. string.format("%.2x", string.byte(b, i)) +- end +- return x +-end ++local md5 = require("md5") + + function filter_open(email, page) +- buffer = "" +- md5 = md5_hex(email:sub(2, -2):lower()) ++ buffer = "" ++ hexdigest = md5.sumhexa(email:sub(2, -2):lower()) + end + + function filter_close() +- html("<img src='//www.gravatar.com/avatar/" .. md5 .. "?s=13&d=retro' width='13' height='13' alt='Gravatar' /> " .. buffer) ++ html("<img src='//www.gravatar.com/avatar/" .. hexdigest .. "?s=13&d=retro' width='13' height='13' alt='Gravatar' /> " .. buffer) + return 0 + end + +diff -Naur cgit-1.2.3/filters/email-libravatar.lua cgit-1.2.3.patched/filters/email-libravatar.lua +--- cgit-1.2.3/filters/email-libravatar.lua 2020-03-13 19:49:52.000000000 -0400 ++++ cgit-1.2.3.patched/filters/email-libravatar.lua 2024-11-18 22:10:41.739471304 -0500 +@@ -3,29 +3,19 @@ + -- prefix in filters. + -- + -- Requirements: +--- luaossl +--- <http://25thandclement.com/~william/projects/luaossl.html> ++-- lua-md5 + -- + +-local digest = require("openssl.digest") +- +-function md5_hex(input) +- local b = digest.new("md5"):final(input) +- local x = "" +- for i = 1, #b do +- x = x .. string.format("%.2x", string.byte(b, i)) +- end +- return x +-end ++local md5 = require("md5") + + function filter_open(email, page) +- buffer = "" +- md5 = md5_hex(email:sub(2, -2):lower()) ++ buffer = "" ++ hexdigest = md5.sumhexa(email:sub(2, -2):lower()) + end + + function filter_close() + baseurl = os.getenv("HTTPS") and "https://seccdn.libravatar.org/" or "http://cdn.libravatar.org/" +- html("<img src='" .. baseurl .. "avatar/" .. md5 .. "?s=13&d=retro' width='13' height='13' alt='Libravatar' /> " .. buffer) ++ html("<img src='" .. baseurl .. "avatar/" .. hexdigest .. "?s=13&d=retro' width='13' height='13' alt='Libravatar' /> " .. buffer) + return 0 + end + diff --git a/development/cgit/slack-desc b/development/cgit/slack-desc index c9b4091770..44da4b5327 100644 --- a/development/cgit/slack-desc +++ b/development/cgit/slack-desc @@ -10,9 +10,9 @@ cgit: cgit (web frontend for git repositories) cgit: cgit: cgit is a web interface (cgi) for git repositories, written in C. cgit: -cgit: Homepage: https://git.zx2c4.com/cgit/about/ -cgit: +cgit: This package built @WITHLUA@ support. cgit: +cgit: Homepage: https://git.zx2c4.com/cgit/about/ cgit: cgit: cgit: |