[build scripts] mono-arch Linux file watcher build script

GitOrigin-RevId: a357e4f7ca466d6054b63e68c1cd8a3f8bbf5daf
This commit is contained in:
Roman Shevchenko
2021-07-27 15:31:28 +02:00
committed by intellij-monorepo-bot
parent 7b0b160cd0
commit 871d238bbe

View File

@@ -1,24 +1,8 @@
#!/bin/sh
# Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
compile_clang() { clang -O2 -Wall -Wextra -Wpedantic -std=c11 "$@"; }
compile_cc() { cc -O2 -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -std=c11 "$@"; }
# Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
VER=$(date "+%Y%m%d.%H%M")
sed -i.bak "s/#define VERSION .*/#define VERSION \"${VER}\"/" fsnotifier.h && rm fsnotifier.h.bak
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
echo "*** Compiling amd64 version (fsnotifier64) ..."
compile_clang -o fsnotifier64 main.c inotify.c util.c && \
chmod 755 fsnotifier64
# dependencies: libc6-dev-i386 libgcc-9-dev-i386-cross
printf "\n\n*** Compiling i386 version (fsnotifier) ...\n"
compile_clang -target i686-linux-elf -o fsnotifier main.c inotify.c util.c && \
${CC:-clang} -O2 -Wall -Wextra -Wpedantic -std=c11 -o fsnotifier main.c inotify.c util.c && \
chmod 755 fsnotifier
else
echo "*** Compiling platform-specific version (fsnotifier-$ARCH)..."
compile_cc -o fsnotifier-"$ARCH" main.c inotify.c util.c && \
chmod 755 fsnotifier-"$ARCH"
fi