#!/bin/bash # Slackware build script for wechat-universal # Copyright 2024, Lockywolf # 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=wechat-universal VERSION=${VERSION:-1.0.0.242} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} content_disposition_prefix=9d7b342b1a654ce5a63981a46aa64d81 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} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" elif [ "$ARCH" = "aarch64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PKG-build mkdir $PKG-build cd $PKG-build #cp $CWD/com.tencent.wechat_${VERSION}_amd64.deb ./package.deb || cp $CWD/$content_disposition_prefix.deb ./package.deb #cp $CWD/wechat-beta_${VERSION}_amd64.rpm ./ #rpm2targz ./*rpm #tar xvf ./*.tar.gz rpm2cpio $CWD/wechat-beta_${VERSION}_amd64.rpm | cpio -id 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 {} + mkdir -p $PKG #rm ./opt/apps/com.tencent.wechat/files/libuosdevicea.so mkdir -p $PKG/opt #mv ./opt/apps/com.tencent.wechat/files $PKG/opt/$PRGNAM mv ./opt/wechat-beta $PKG/opt/$PRGNAM install -DTm644 "$PKG"/opt/$PRGNAM/icons/wechat.png $PKG/"usr/share/icons/hicolor/256x256/apps/$PRGNAM.png" # for res in 16 32 48 64 128 256; do # install -Dm644 \ # ./opt/apps/com.tencent.wechat/entries/icons/hicolor/${res}x${res}/apps/com.tencent.wechat.png \ # $PKG/usr/share/icons/hicolor/${res}x${res}/apps/$PRGNAM.png # done #rm -rf ./opt/apps install -d -m 755 $PKG/usr/lib/license/ install -d -m 755 $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/license/ printf '\n' > $PKG/usr/lib/license/.do-not-delete gcc ${SLKCFLAGS} -fPIC -shared $CWD/resources/libuosdevicea.c -o $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/license/libuosdevicea.so strip --strip-unneeded $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/license/libuosdevicea.so g++ ${SLKCFLAGS} -fPIC -shared $CWD/resources/keyBlocker.cpp -o $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/keyBlocker.so strip --strip-unneeded $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/keyBlocker.so printf '%s\n' 'DISTRIB_ID=uos' | install -Dm755 /dev/stdin $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/etc/lsb-release install -Dm755 $CWD/resources/wechat-universal.sh $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/ install -Dm755 $CWD/resources/fake_dde-file-manager $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/bin/dde-file-manager install -Dm644 $CWD/resources/$PRGNAM.desktop "$PKG"/usr/share/applications/$PRGNAM.desktop sed -i "s|/usr/lib|/usr/lib$LIBDIRSUFFIX|g" "$PKG"/usr/share/applications/$PRGNAM.desktop printf '%s\n' '#!/bin/bash' 'exec /usr/lib'$LIBDIRSUFFIX'/'"$PRGNAM"'/wechat-universal.sh "$@"' | install -DTm 755 /dev/stdin $PKG/usr/bin/$PRGNAM ( mkdir -p $PKG/usr/bin cd $PKG/usr/bin ln -srf ../../bin/lsblk ./ ) mkdir -p $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 cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE