Skip to content

Instantly share code, notes, and snippets.

@timhughes
Last active May 30, 2018 10:09
Show Gist options
  • Save timhughes/ad9ec7f5d1a97c10ec19ec8d2652b7a6 to your computer and use it in GitHub Desktop.
Save timhughes/ad9ec7f5d1a97c10ec19ec8d2652b7a6 to your computer and use it in GitHub Desktop.
Build a rpm for watchman on Fedora 28
#! /bin/sh
#
# build_wachman_rpm.sh
# Copyright (C) 2018 Tim Hughes <[email protected]>
#
# Distributed under terms of the MIT license.
#
# Uses FPM to create a rpm for easy installation and removal
VERSION='v4.9.0'
BUILD_DEPS='openssl-devel redhat-rpm-config python2-devel'
DESCRIPTION="Watches files and records, or triggers actions, when they change. https://facebook.github.io/watchman/"
GIT_ROOT=$(mktemp -d)
INSTALL_TMP=$(mktemp -d)
trap "rm -rf $GIT_ROOT $INSTALL_TMP" EXIT
if ! type fpm; then
echo "FPM is required - http://fpm.readthedocs.io/en/latest/"
exit 1
fi
check_deps(){
rslt=0
for D in $BUILD_DEPS; do
if ! rpm -q $D; then
rslt=1
fi
done
if [ $rslt -eq 1 ]; then
echo 'Not all dependencies are installed'
exit 1
fi
}
check_deps
git clone https://github.com/facebook/watchman.git $GIT_ROOT
cd $GIT_ROOT
git checkout v4.9.0
./autogen.sh
./configure --enable-lenient # see https://github.com/facebook/watchman/issues/607
make -j$(ls -1d /sys/devices/system/cpu/cpu[0-9]* | wc -l)
make DESTDIR=$INSTALL_TMP install
v=${VERSION/v/}
fpm -s dir -t rpm -C $INSTALL_TMP --name watchman --version $v --iteration 1 --description "$DESCRIPTION" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment