Skip to content

Commit

Permalink
Removed unrelated files from pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
vladtr committed May 10, 2023
1 parent ca4d0e1 commit 1b885f0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 66 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,22 @@ When building C/C++ software, often the build is performed in parallel via a com
If you are in an Ubuntu docker container, omit `sudo` from all commands because you run as `root` by default. Most other docker containers also exclude `sudo`, especially Debian-family containers. If your shell prompt is a hash tag (`#`), omit `sudo`.

#### Pinned Build
Make sure you are in the root of the `leap` repo, then run the pinned build script. You have to give it three arguments in the following order:
Make sure you are in the root of the `leap` repo, then run the `install_depts.sh` script to install dependencies:
```bash
sudo scripts/install_deps.sh
```

Next, run the pinned build script. You have to give it three arguments in the following order:
1. A temporary folder, for all dependencies that need to be built from source.
1. A build folder, where the binaries you need to install will be built to.
1. The number of jobs or CPU cores/threads to use (note the [jobs flag](#step-3---build) warning above).

> 🔒 You do not need to run this script with `sudo` or as root. On Debian-family operating systems such as Ubuntu, the script will determine if all package dependencies are installed and only invoke `apt-get` if you are missing packages. In that case, you may be prompted for your password if `apt-get` needs additional permissions from `sudo`. You should not run this script with `sudo` or as root because you do not need to.
> 🔒 You do not need to run this script with `sudo` or as root.
For example, the following command runs the `pinned_build.sh` script, specifies a `deps` and `build` folder in the root of the Leap repo for the first two arguments, then builds the packages using all of your computer's CPU threads:
```bash
scripts/pinned_build.sh deps build "$(nproc)"
```
If you want to by-pass the `[Y/n]` prompt from `apt-get install`, you can pass `y` to the script like this.
```bash
echo 'y' | scripts/pinned_build.sh deps build "$(nproc)"
```
All other script behavior remains unchanged.

Now you can optionally [test](#step-4---test) your build, or [install](#step-5---install) the `*.deb` binary packages, which will be in the root of your build directory.

#### Unpinned Build
Expand Down
27 changes: 27 additions & 0 deletions scripts/install_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
apt-get update
apt-get update --fix-missing
export DEBIAN_FRONTEND='noninteractive'
export TZ='Etc/UTC'
apt-get install -y \
build-essential \
bzip2 \
cmake \
curl \
file \
git \
libbz2-dev \
libcurl4-openssl-dev \
libgmp-dev \
libncurses5 \
libssl-dev \
libtinfo-dev \
libzstd-dev \
python3 \
python3-numpy \
time \
tzdata \
unzip \
wget \
zip \
zlib1g-dev
38 changes: 1 addition & 37 deletions scripts/pinned_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,47 +57,13 @@ popdir() {
}

try(){
echo "$ $*"
"$@"
res=$?
if [[ ${res} -ne 0 ]]; then
exit $res
exit 255
fi
}

install_dependencies() {
echo 'Installing package dependencies.'
if [[ "$(uname)" == 'Linux' && -f /etc/debian_version ]]; then
if [[ "$(id -u)" != '0' ]]; then # if not root, use sudo for the package manager
if dpkg -s sudo &>/dev/null; then # guard against sudo not being installed
SUDO_CMD='sudo'
else
printf '\033[1;31mERROR: This script must be run as root or sudo must be installed!\n\033[0m'
exit 2
fi
else
unset SUDO_CMD
fi
DEPENDENCIES=()
while IFS='' read -r LINE; do
DEPENDENCIES+=("$LINE");
done < <(cat "$SCRIPT_DIR/pinned_deps.txt")
echo 'Checking for missing package dependencies.'
if dpkg -s "${DEPENDENCIES[@]}" &> /dev/null; then
echo 'All package dependencies are already installed.'
else
echo 'Some package dependencies are missing, installing...'
try $SUDO_CMD apt-get update
try $SUDO_CMD apt-get update --fix-missing
export DEBIAN_FRONTEND='noninteractive'
try $SUDO_CMD apt-get install "${DEPENDENCIES[@]}"
fi
else
printf '\033[1;33mWARNING: Skipping package manager dependency installations because this is not a Debian-family operating system!\nWe currently only support Ubuntu.\033[0m\n'
fi
echo 'Done installing package dependencies.'
}

install_clang() {
CLANG_DIR="$1"
if [ ! -d "${CLANG_DIR}" ]; then
Expand Down Expand Up @@ -151,8 +117,6 @@ install_boost() {
export BOOST_DIR="${BOOST_DIR}"
}

install_dependencies

pushdir "${DEP_DIR}"

install_clang "${DEP_DIR}/clang-${CLANG_VER}"
Expand Down
21 changes: 0 additions & 21 deletions scripts/pinned_deps.txt

This file was deleted.

0 comments on commit 1b885f0

Please sign in to comment.