Skip to content

Commit

Permalink
fix: could not make symlink to snapshot script
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart-Steensma committed Feb 4, 2024
1 parent 161eb93 commit 3dadc71
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 26 deletions.
77 changes: 61 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
[![Tests](https://github.com/BartSte/snapshot/actions/workflows/tests.yml/badge.svg)](https://github.com/BartSte/snapshot/actions/workflows/tests.yml)
[![Release](https://github.com/BartSte/snapshot/actions/workflows/release.yml/badge.svg)](https://github.com/BartSte/snapshot/actions/workflows/release.yml)

> WORK IN PROGRESS!
> WORK IN PROGRESS
> This project is still under development. The code is still experimental and
> is subject to change.
## Table of Contents

- [Summary](#summary)
- [Features](#features)
- [Dependencies](#dependencies)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Building](#building)
- [Stand-alone tarball](#tarball-standalone)
- [Linux](#linux)
- [Build from source](#building)
- [Linux](#linux)
- [Raspberry Pi OS](#raspberry-pi-os)
- [Usage](#usage)
- [List the available cameras](#list-the-available-cameras)
- [Display a video](#display-a-video)
- [Record a video stream](#record-a-video-stream)
- [Set the logging level](#set-the-logging-level)
- [Using the configuration file](#using-the-configuration-file)
- [Set the logging level](#set-the-logging-level)
- [Development](#development)
- [Build](#build)
- [Test](#test)
Expand All @@ -36,9 +38,10 @@
set of snapshots. This is useful when you want to make a time-lapse of a video.
The application has a graphical user interface to view the video and a command
line interface to configure the application. It can also be configured using a
configuration file. The project is written in C++ and uses the [Qt6
framework](https://www.qt.io/). For more information, run `snapshot --help`, or
continue reading.
configuration file. The project is written in C++ and uses
[Qt6](https://www.qt.io/). It was tested on Ubuntu 22.04, Arch linux and also
on Raspberry Pi OS. For more information, run `snapshot --help`, or continue
reading.

### Features

Expand All @@ -53,16 +56,18 @@ In short, `snapshot` contains the following features:
- [x] Configure the application using a configuration file.
- [x] Has a command line interface.
- [ ] Runs on linux (including raspberry pi).
- [x] Supports 64bit systems only.

## Dependencies
### Dependencies

Ensure the following dependencies are installed:
Snapshot relies on the following dependencies:

| Dependency | Version |
| ------------------------------------------------------------- | -------- |
| [Qt6](https://www.qt.io/download): base & multimedia (ffmpeg) | ≥ 6.6.0 |
| [boost](https://www.boost.org/) | ≥ 1.83 |
| [spdlog](https://github.com/gabime/spdlog) | ≥ 1.12.0 |
| Dependency | Version |
| ---------------------------------------------------- | ------- |
| [Qt6](https://www.qt.io/download): base & multimedia | 6.6 |
| [ffmpeg](https://ffmpeg.org/) | 6.1 |
| [boost](https://www.boost.org/) | 1.74 |
| [spdlog](https://github.com/gabime/spdlog) | 1.9 |

For building the project, the following dependencies are required:

Expand All @@ -77,11 +82,50 @@ is installed using `cmake`.
## Installation

The following sections explain how to install the project. You have two
options: building the project from source, or using the pre built binaries. The
easiest way is to use the pre built binaries.
options: using the pre-built binaries. The easiest way is to use the pre-built
binaries, i.e., the stand-alone tarball.

### Stand-alone tarball

Go to the [releases](https://github.com/BartSte/snapshot/releases) page and
download the latest `tar.gz` file. Extract the file using the following
command:

```bash
tar -xvf snapshot-<version>-Linux.tar.gz
```

This creates a `snapshot-<version>` directory with the following structure:

```bash
snapshot-<version>
├── bin/
├── lib/
└── snapshot
```

where `bin` and `lib` are directories that you should not touch. On the other
hand, the `snapshot` script is the one that you should use to interact with the
application. For example:

```bash
./snapshot-<version>/snapshot --help
```

will print the help message. For convenience, you can place the
`snapshot-<version>` folder anywhere you like, and create a symlink to the
`snapshot` script in a directory that is in your `PATH`. For example:

```bash
ln -s /path/to/snapshot-<version>/snapshot $HOME/bin/snapshot
```

here it is assumed that the `$HOME/bin` directory is in your `PATH`.

### From source

- Needs an update!

The next steps explain how to build this project from source. The following
sections explain how to build the project on different environments: Linux,
Raspberry Pi OS. Despite the fact that Raspberry Pi OS is a linux distribution,
Expand Down Expand Up @@ -502,6 +546,7 @@ more information.

# TODO:

- [ ] Does the tarball work when you do a symlink to the bash script?
- [ ] lib folder:
- Check the list of shared libs in the docs. Filter out the libs that are not
needed:
Expand Down
23 changes: 13 additions & 10 deletions scripts/snapshot
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/sh
# Copied from Qt's website at: https://doc.qt.io/qt-6/linux-deployment.html
#!/bin/env bash

appname=$(basename $0 | sed s,\.sh$,,)
source=${BASH_SOURCE[0]}
# resolve $source until the file is no longer a symlink
while [ -L "$source" ]; do
this_dir=$(cd -P "$(dirname "$source")" >/dev/null 2>&1 && pwd)
source=$(readlink "$source")

dirname=$(dirname $0)
tmp="${dirname#?}"
# if $source was a relative symlink, we need to resolve it relative to
# the path where the symlink file was located
[[ $source != /* ]] && source=$this_dir/$source
done
this_dir=$(cd -P "$(dirname "$source")" >/dev/null 2>&1 && pwd)

if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH="$dirname/lib"
LD_LIBRARY_PATH="$this_dir/lib"
export LD_LIBRARY_PATH
"$dirname/bin/$appname" "$@"
"$this_dir/bin/snapshot" "$@"

0 comments on commit 3dadc71

Please sign in to comment.