Skip to content

Add signal-desktop 7.37.0 #313

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
277 changes: 277 additions & 0 deletions signal-desktop-7.37.0-0.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
#! /bin/bash -x
{
umask 022

set -u
set -x
set -e

umask 022

PKG=signal-desktop
VERSION=7.37.0
BUILD=0

declare -A NODEVMAP
NODEVMAP["6.44.1"]="18.17.1" # good
NODEVMAP["6.46.0"]="18.17.1" # good
NODEVMAP["6.47.0"]="18.18.2" # bad
NODEVMAP["6.48.1"]="18.18.2" # bad
NODEVMAP["7.0.0"]="18.18.2" # bad
NODEVMAP["7.1.1"]="18.18.2" # bad
NODEVMAP["7.2.1"]="20.9.0" # good
NODEVMAP["7.3.1"]="20.9.0" # good
NODEVMAP["7.4.0"]="20.9.0" # good
NODEVMAP["7.5.0"]="20.9.0" # nach zwei mal good
NODEVMAP["7.5.1"]="20.9.0" # good
NODEVMAP["7.16.0"]="20.11.1" # good
NODEVMAP["7.28.0"]="20.17.0" # good
NODEVMAP["7.29.0-beta.1"]="20.17.0" # good
NODEVMAP["7.37.0"]="20.18.1" # good

# error signal-desktop@7.16.0: The engine "node" is incompatible with this module. Expected version "20.11.1". Got "20.15.1"
# error signal-desktop@7.29.0-beta.1: The engine "node" is incompatible with this module. Expected version "20.17.0". Got "20.11.1"
# error signal-desktop@7.37.0: The engine "node" is incompatible with this module. Expected version "20.18.1". Got "20.17.0"

NODEVERSION=${NODEVMAP[${VERSION}]}

PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
export PATH

PREFIX=/pkg/${PKG}-${VERSION}-${BUILD}

mkdir -vp ${PREFIX}
cat >${PREFIX}/profile <<EOF
PATH=$PREFIX/bin:\$PATH
EOF

BUILDDIR=/scratch/local2/${USER}/signal-build/${VERSION}
mkdir -p ${BUILDDIR}

TMPDIR=${BUILDDIR}/tmp
mkdir -p ${TMPDIR}
export TMPDIR

HOME=${BUILDDIR}/home
mkdir -p ${HOME}
export HOME

_CLEANUP=(
${HOME}/.cache/node-gyp
${HOME}/.cache/pip
${HOME}/.npm
${HOME}/.config/configstore
)

for i in "${_CLEANUP[@]}"; do
test -d $i && chmod -c -R u+rwx $i && rm -rf $i && echo "removed $i"
done

cat >>${HOME}/.wgetrc <<'_EOW_'
#http_proxy = beehive:3128
#https_proxy = beehive:3128
#ftp_proxy = beehive:3128
check-certificate = quiet
_EOW_

#git config --global http.proxy http://beehive:3128
#git config --global https.proxy https://beehive.molgen.mpg.de:3128
git config --global advice.detachedHead false
git config --global http.sslVerify false
git config --global pack.threads 24

exec </dev/null

NODEPREFIX=/scratch/local2/${USER}/signal-build/node-${NODEVERSION}

pushd ${BUILDDIR}

if [ ! -d ${NODEPREFIX} ]; then

SRCURL="https://beehive.molgen.mpg.de/66b4ab021b6929201ea921bd0bd35237/node-v20.18.1.tar.gz"

# BUILD_PKG=${BUILD_node}
BUILD_PKG=node-v${NODEVERSION}

mkdir -p ${NODEPREFIX}

cat >${NODEPREFIX}/profile <<-EOF
PATH=${NODEPREFIX}/bin:\$PATH
npm_config_cache=${NODEPREFIX}/cache
EOF


test -e "${BUILD_PKG}.tar.gz" || wget -nv "${SRCURL}" -O "${BUILD_PKG}.tar.gz"
test -d "${BUILD_PKG}" || mkdir -pv "${BUILD_PKG}" && tar -xf "${BUILD_PKG}.tar.gz" --strip-components=1 -C "${BUILD_PKG}"

. "${PREFIX}/profile"

pushd "${BUILD_PKG}"

CFLAGS='-O2 -fPIC' \
./configure --prefix=${NODEPREFIX}

make -j $(nproc)

make install
popd

fi

PATH=${NODEPREFIX}/bin:$PATH

type node
node --version
type npm
npm --version

pushd ${PREFIX}
npm install yarn
rm -f ${NODEPREFIX}/bin/yarn
ln -sv ${PREFIX}/node_modules/yarn/bin/yarn ${NODEPREFIX}/bin/yarn
popd

type yarn

############ node / npm / yarn installed ############

# get git lfs organized

#go get github.com/git-lfs/git-lfs
#cd ${HOME}/go/src/github.com/git-lfs/git-lfs
#make

if [ ! -e bin/git-lfs ]; then
mkdir -p bin
pushd bin
wget "https://beehive.molgen.mpg.de/f07153c9add38691457af31d5ef60d89/git-lfs"
chmod -v 755 git-lfs
popd
fi

PATH=${BUILDDIR}/bin:$PATH
export PATH

############ git-lfs installed ############

# now go for signal
# git clone https://github.com/signalapp/Signal-Desktop.git
# ( cd Signal-Desktop; git describe )
# tar cf

# get patch


SRCURL="https://beehive.molgen.mpg.de/387c2a99b5f6a280b317a44fd79cbcaa/Signal-Desktop-v6.31.0-beta.1-1675-g5f611b74f.tar"

PKGARC=${SRCURL##*/}

test -e ${PKGARC} || wget -nv ${SRCURL}
test -d Signal-Desktop || mkdir Signal-Desktop && tar -x --directory=Signal-Desktop --strip-components=1 -f ${PKGARC}

pwd

cd Signal-Desktop

git-lfs install

git clean -d --force
git checkout tags/v${VERSION}


# der versucht backbone-min.js.map zu löschen, welches nicht existiert

# patches/backbone+1.6.0.patch
# **ERROR** Failed to apply patch for package backbone at path

# node_modules/backbone

# /scratch/local2/build/signal-build/7.37.0/Signal-Desktop> patch --dry-run -p1 < patches/backbone+1.6.0.patch
#File node_modules/backbone/backbone-min.js is read-only; trying to patch anyway
#checking file node_modules/backbone/backbone-min.js
#The next patch would delete the file node_modules/backbone/backbone-min.js.map,
#which does not exist! Assume -R? [n] y
#checking file node_modules/backbone/backbone-min.js.map
#File node_modules/backbone/backbone-min.map is read-only; trying to patch anyway
#checking file node_modules/backbone/backbone-min.map
#File node_modules/backbone/backbone.js is read-only; trying to patch anyway
#checking file node_modules/backbone/backbone.js

# get patch
PATCHURL+=("https://beehive.molgen.mpg.de/ef2cdf225dbdd9b912d06756368a65d1/signal-desktop-7.37.0-0.build.sh.patch")
wget -nv ${PATCHURL}

# patch
patch --forward --strip=1 --input=${PATCHURL##*/}


# workaround https://github.com/yarnpkg/yarn/issues/7584
cat >$HOME/.yarnrc <<EOF0
unsafe-disable-integrity-migration false
EOF0

echo $PATH
type npm
npm --version
npm config set color false

#npm config set proxy http://beehive:3128
#npm config set https-proxy https://beehive.molgen.mpg.de:3128

type node
node --version

type yarn
yarn --version

# yarn install --frozen-lockfile

pushd sticker-creator

yarn install

popd

mkdir -pv ${HOME}/.config/yarn/global
touch ${HOME}/.config/yarn/global/.yarnclean

yarn install --ignore-engines

yarn generate
yarn prepare-beta-build
yarn build || yarn build


find ${BUILDDIR} -perm -700 ! -perm -005 -exec chmod o+rx '{}' ';'

false && {
for e in signal-desktop signal-desktop-beta ; do
[ -e ${BUILDDIR}/Signal-Desktop/release/linux-unpacked/$e ] && \
cp -ax ${BUILDDIR}/Signal-Desktop/release/linux-unpacked/$e ${PREFIX}/
done

for e in \
'*.so' \
'*.pak' \
'*.bin' \
icudtl.dat \
locales \
resources \
; do
cp -ax ${BUILDDIR}/Signal-Desktop/release/linux-unpacked/$e ${PREFIX}/
done
}

cp -ax ${BUILDDIR}/Signal-Desktop/release/linux-unpacked/. ${PREFIX}/

mkdir -p ${PREFIX}/bin

cat >${PREFIX}/bin/signal-desktop <<__EOS__
#!/bin/sh
exec ${PREFIX}/signal-desktop "\$@"
__EOS__

chmod 755 ${PREFIX}/bin/signal-desktop

exit
}