Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolated build environment #3136

Open
1 task done
thomas-mc-work opened this issue Mar 21, 2022 · 3 comments
Open
1 task done

Isolated build environment #3136

thomas-mc-work opened this issue Mar 21, 2022 · 3 comments

Comments

@thomas-mc-work
Copy link

thomas-mc-work commented Mar 21, 2022

Is your feature request related to a problem? Please describe.

In order to compile the project on my machine it's required to install a couple of build dependencies that I don't want to pollute my system.

Describe the solution you'd like

I've created a build environment based on docker/podman to do the compilation task isolated in a docker container. This would also allow you to provide a failsafe build environment to all users.

Describe alternatives you've considered

Do what is described in the readme. My system would end up with dependencies that won't be required anymore, except for that one task from time to time. In the long term I gonna lose track of the dev dependencies.

My solution

Dockerfile-ubuntu-20.04:

FROM ubuntu:focal-20220302

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq
RUN apt-get install -qy \
        ffmpeg libsdl2-2.0-0 adb wget \
        gcc git pkg-config meson ninja-build libsdl2-dev \
        libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
        libusb-1.0-0 libusb-1.0-0-dev

WORKDIR /src

CMD ["/src/install_release.sh"]

fetch+compile.sh:

#!/usr/bin/env sh
set -o nounset   ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit   ## set -e : exit the script if any statement returns a non-true return value

git clone --quiet https://github.com/Genymobile/scrcpy . || git pull

docker build -f "Dockerfile-ubuntu-20.04" -t "scrcpy/scrcpy-build-env" .
docker run --rm -v "$PWD:/src" "scrcpy/scrcpy-build-env" || true

echo "-----"
echo "alias scrcpy='./run scrcpy/build-auto'"

Issues

Currently, your install_release.sh combines two processes within a single file: compile and install. Since install requires the sudo command my script would fail (thus the workaround … || true). It would be great to have these aspects split into separate files upstream.


What do you think?

@thomas-mc-work
Copy link
Author

ping @rom1v 🙂

@rom1v
Copy link
Collaborator

rom1v commented May 31, 2022

Using docker for that is a possibility, but the purpose of install_release.sh was to get the latest version of the app installed. Here, the app is not installed (it's just run with the ./run script, which is a tool for development only).

FYI, in the long term, I'd like to post a "portable" version with dependencies included, for simplicity (see #3283).

@thomas-mc-work
Copy link
Author

thomas-mc-work commented Jan 8, 2024

Using docker for that is a possibility, but the purpose of install_release.sh was to get the latest version of the app installed. Here, the app is not installed (it's just run with the ./run script, which is a tool for development only).

That's what I was writing in my issues section. A solution could be to separate these processes into two shell scripts:

  • build.sh: Includes only the build part
  • install_release.sh: If desired keeps the focus of download + build + install. Just the build part is stripped out and invoked by calling the build.sh script

FYI, in the long term, I'd like to post a "portable" version with dependencies included, for simplicity (see #3283).

That sounds like just another output artifact to me, which is independent of the issues here. For me as a user it would be great, to either have a way to compile the app without cluttering my system. Or to have a prebuilt binary created by a CI action and attached to the according tag/release. This is already happening for the Windows target, but not for Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants