#!/bin/bash # Slackware build script for actionlint # Copyright 2023-2024 Andrew Clemons, Tokyo Japan # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=actionlint VERSION=${VERSION:-1.7.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION mkdir -p vendor/github.com for DEPENDENCY in fatih/color/1.16.0 \ google/go-cmp/0.6.0 \ mattn/go-colorable/0.1.13 \ mattn/go-isatty/0.0.20 \ mattn/go-runewidth/0.0.15 \ rivo/uniseg/0.4.7 \ robfig/cron/3.0.1 \ yuin/goldmark/1.7.0 ; do DEPENDENCY_OWNER="$(echo "$DEPENDENCY" | cut -d/ -f1)" DEPENDENCY_NAME="$(echo "$DEPENDENCY" | cut -d/ -f2)" DEPENDENCY_REV="$(echo "$DEPENDENCY" | cut -d/ -f3)" mkdir -p "vendor/github.com/$DEPENDENCY_OWNER" tar xf "$CWD/$DEPENDENCY_NAME-$DEPENDENCY_REV.tar.gz" if [ "$DEPENDENCY_NAME" = "cron" ] ; then mkdir "vendor/github.com/$DEPENDENCY_OWNER/$DEPENDENCY_NAME/" mv "$DEPENDENCY_NAME-$DEPENDENCY_REV" "vendor/github.com/$DEPENDENCY_OWNER/$DEPENDENCY_NAME/v3" else mv "$DEPENDENCY_NAME-$DEPENDENCY_REV" "vendor/github.com/$DEPENDENCY_OWNER/$DEPENDENCY_NAME" fi done mkdir -p vendor/golang.org/x for DEPENDENCY in sync/0.7.0 \ sys/0.20.0 ; do DEPENDENCY_NAME="$(echo "$DEPENDENCY" | cut -d/ -f1)" DEPENDENCY_REV="$(echo "$DEPENDENCY" | cut -d/ -f2)" tar xf "$CWD/$DEPENDENCY_NAME-$DEPENDENCY_REV.tar.gz" mv "$DEPENDENCY_NAME-$DEPENDENCY_REV" "vendor/golang.org/x/$DEPENDENCY_NAME" done mkdir -p vendor/gopkg.in tar -xf "$CWD/yaml-3.0.1.tar.gz" mv yaml-3.0.1 "vendor/gopkg.in/yaml.v3" cat << EOF > vendor/modules.txt # github.com/fatih/color v1.16.0 ## explicit; go 1.17 github.com/fatih/color # github.com/google/go-cmp v0.6.0 ## explicit; go 1.13 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/cmpopts github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value # github.com/mattn/go-colorable v0.1.13 ## explicit; go 1.15 github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.20 ## explicit; go 1.15 github.com/mattn/go-isatty # github.com/mattn/go-runewidth v0.0.15 ## explicit; go 1.9 github.com/mattn/go-runewidth # github.com/rivo/uniseg v0.4.7 ## explicit; go 1.18 github.com/rivo/uniseg # github.com/robfig/cron/v3 v3.0.1 ## explicit; go 1.12 github.com/robfig/cron/v3 # github.com/yuin/goldmark v1.7.1 ## explicit; go 1.19 github.com/yuin/goldmark github.com/yuin/goldmark/ast github.com/yuin/goldmark/extension github.com/yuin/goldmark/extension/ast github.com/yuin/goldmark/parser github.com/yuin/goldmark/renderer github.com/yuin/goldmark/renderer/html github.com/yuin/goldmark/text github.com/yuin/goldmark/util # golang.org/x/sync v0.7.0 ## explicit; go 1.18 golang.org/x/sync/errgroup golang.org/x/sync/semaphore # golang.org/x/sys v0.20.0 ## explicit; go 1.18 golang.org/x/sys/execabs golang.org/x/sys/unix golang.org/x/sys/windows # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 EOF chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; go build -ldflags "-s -w -X github.com/rhysd/actionlint.version=$VERSION" -mod=vendor ./cmd/actionlint install -D -m0755 actionlint $PKG/usr/bin/actionlint find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true ronn man/actionlint.1.ronn install -D -m0644 man/actionlint.1 $PKG/usr/man/man1/actionlint.1 find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ CHANGELOG.md CONTRIBUTING.md LICENSE.txt README.md docs \ $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE