Travis CI: "Unable to locate package python-opencv" Python 2.7 - python-2.7

On a normal non-virtualenv Ubuntu machine I can run:
sudo apt-get install python-opencv
And then from Python 2.7 I can run import cv2. Success!
But when I try to do the very same thing in my .travis.yml file for automated testing, I get the error:
E: Unable to locate package python-opencv
How can I get apt-get to locate python-opencv in my Travis-CI build?
I've tried the following; all were unsuccessful:
From https://askubuntu.com/questions/339217/, I tried appending these lines to /etc/apt/sources.list:
echo "deb http://de.archive.ubuntu.com/ubuntu precise main restricted universe" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://de.archive.ubuntu.com/ubuntu precise restricted main multiverse universe" | sudo tee -a /etc/apt/sources.list
echo "deb http://de.archive.ubuntu.com/ubuntu precise-updates main restricted universe" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://de.archive.ubuntu.com/ubuntu precise-updates restricted main multiverse universe" | sudo tee -a /etc/apt/sources.list
From here I tried adding these lines right before:
sudo apt-get install python-software-properties
sudo add-apt-repository python-opencv
Following this, with updated method from here, I tried using this instead of 2.7:
python:
- "2.7_with_system_site_packages"
(My full .travis.yml file is here.)
Update
Burhan Khalid's answer did get OpenCV installed, so the error went away. However, then when I tried find the package using import cv2 it still couldn't find it, because the Travis-CI build machine is wrapped in a virtualenv. So we can't access packages outside of our hermetically-sealed build environment.
So I build from source. (References: here, here and here)
Here's how to do it in the .travis.yml file:
env:
global:
# Dependencies
- DEPS_DIR="`readlink -f $TRAVIS_BUILD_DIR/..`"
- OPENCV_BUILD_DIR=$DEPS_DIR/opencv/build
And then, in the before_install section:
- travis_retry git clone --depth 1 https://github.com/Itseez/opencv.git $DEPS_DIR/opencv
- mkdir $OPENCV_BUILD_DIR && cd $OPENCV_BUILD_DIR
- |
if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then
cmake -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=OFF -DENABLE_AVX=ON -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") -DPYTHON_EXECUTABLE=$(which python) -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
else
cmake -DBUILD_TIFF=ON -DBUILD_opencv_java=OFF -DWITH_CUDA=OFF -DENABLE_AVX=ON -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_IPP=ON -DWITH_TBB=ON -DWITH_EIGEN=ON -DWITH_V4L=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") -DPYTHON_EXECUTABLE=$(which python3) -DPYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
fi
- make -j4
- sudo make install
- echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf.d/opencv.conf
- sudo ldconfig
- echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" | sudo tee -a /etc/bash.bashrc
- echo "export PKG_CONFIG_PATH" | sudo tee -a /etc/bash.bashrc
- export PYTHONPATH=$OPENCV_BUILD_DIR/lib/python3.3/site-packages:$PYTHONPATH

After:
sudo add-apt-repository python-opencv
You need
sudo apt-get update
So that the new repository information is correctly updated; before you can add packages from that repository.

Related

Duplicate symbols when linking libwebrtc.a on Android

Building WebRTC directly is somewhat painful (& rather time consuming so not ideal in paid for CI environments) so I've opted to use some excellent precompiled static libraries released on GitHub to speed things up. This has worked perfectly for all platforms I'm targetting (Windows, MacOS, iOS, Apple TVOS, linux...) except for Android.
When linking the binary on Android I encounter several duplicate symbol errors related to the std libary:
ld: error: duplicate symbol: std::logic_error::logic_error(char const*)
>>> defined at stdexcept_default.ipp:24 (../../../../../_source/android/webrtc/src/buildtools/third_party/libc++/trunk/src/support/runtime/stdexcept_default.ipp:24)
>>> stdexcept.o:(std::logic_error::logic_error(char const*)) in archive /root/webrtc/lib/armeabi-v7a/libwebrtc.a
>>> defined at stdexcept_default.ipp:24 (/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp:24)
>>> stdexcept.o:(.text._ZNSt11logic_errorC2EPKc+0x1) in archive /app/android-sdk-linux/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_static.a
...
ld: error: duplicate symbol: std::runtime_error::runtime_error(char const*)
>>> defined at stdexcept_default.ipp:35 (../../../../../_source/android/webrtc/src/buildtools/third_party/libc++/trunk/src/support/runtime/stdexcept_default.ipp:35)
>>> stdexcept.o:(std::runtime_error::runtime_error(char const*)) in archive /root/webrtc/lib/armeabi-v7a/libwebrtc.a
>>> defined at stdexcept_default.ipp:35 (/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/src/support/runtime/stdexcept_default.ipp:35)
>>> stdexcept.o:(.text._ZNSt13runtime_errorC2EPKc+0x1) in archive /app/android-sdk-linux/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_static.a
It appears that libwebrtc.a for Android includes some libc++ object files and I'm not entirely sure how to successfully link with this library here.
This might be coming down to the libwebrtc.a being compiled with Google's own patched libc++ (Based on what I've read online I believe Google contributes patches to upstream libc++ but they don't wait for the patches to go in - rather they use their fully patched version of libc++ for building WebRTC, Chrome, etc).
When compiling for Linux I actually use the exact versions of clang & libc++ that were downloaded & used in building the static library & I suspect I might need to be doing something similar here - I'm just not entirely sure how given the need to use the Android CMake toolchain.
I've put together a minimal example project on GitHub with Dockerfile that can be used to easily reproduce the above issue.
Does anyone have an idea how I can successfully link the library on Android?
For completeness the source files of interest are:
CMakeLists.txt
cmake_minimum_required(VERSION 3.23)
project(AndroidWebRTC)
set(CMAKE_CXX_STANDARD 17)
add_executable(AndroidWebRTC src/main.cpp)
target_link_libraries(AndroidWebRTC PRIVATE ${WEBRTC_LIBRARY})
add_compile_definitions(WEBRTC_POSIX WEBRTC_ANDROID WEBRTC_LINUX)
include_directories(
${WEBRTC_INCLUDE_DIR}
${WEBRTC_INCLUDE_DIR}/third_party/abseil-cpp
${WEBRTC_INCLUDE_DIR}/third_party/boringssl/src/include
${WEBRTC_INCLUDE_DIR}/third_party/libyuv/include
${WEBRTC_INCLUDE_DIR}/third_party/zlib
)
Dockerfile
# I explicitly specify an amd64 platform as I often build on Apple Silicon
# machines where the default of arm64 breaks things. I believe the alternative
# (and possibly better option) is to use NDK 24 and above, see:
# https://stackoverflow.com/a/69541958
FROM --platform=linux/amd64 ubuntu:20.04 AS build
ENV ANDROID_SDK_ROOT /app/android-sdk-linux
WORKDIR /app
# Install dependencies to build the project
# include apt-get --no-install-recommends
RUN apt-get update && \
apt-get -y upgrade && \
apt-get --no-install-recommends -y install tzdata && \
echo 'Europe/London' > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata
RUN apt-get --no-install-recommends -y install git lsb-release python rsync \
emacs wget build-essential sudo pkg-config clang unzip openjdk-8-jdk ant \
android-sdk-platform-tools-common libncurses5 curl
RUN mkdir ${ANDROID_SDK_ROOT}
# ------------------------------------------------------
# --- Android SDK
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip && \
unzip commandlinetools-linux-7583922_latest.zip && \
mkdir ${ANDROID_SDK_ROOT}/cmdline-tools/ &&\
mv cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \
rm commandlinetools-linux-7583922_latest.zip
ENV PATH ${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin
RUN yes | sdkmanager --licenses
RUN touch /root/.android/repositories.cfg
# Platform tools
RUN yes | sdkmanager "platform-tools"
RUN yes | sdkmanager --update --channel=0
# Keep all sections in descending order!
RUN yes | sdkmanager \
"platforms;android-30" \
"build-tools;31.0.0" \
"ndk;23.1.7779620" \
"extras;android;m2repository" \
"extras;google;m2repository" \
"extras;google;google_play_services" \
"add-ons;addon-google_apis-google-24"
ENV ANDROID_HOME ${ANDROID_SDK_ROOT}
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/ndk/23.1.7779620
ENV PATH ${PATH}:${ANDROID_NDK_HOME}:${ANDROID_HOME}/build-tools/31.0.0/
# Get CMake
COPY scripts/get_cmake.sh scripts/get_cmake.sh
RUN ./scripts/get_cmake.sh "3.25.1" linux /root
ENV PATH "/root/cmake/bin:$PATH"
# Get WebRTC
COPY scripts/get_webrtc.sh scripts/get_webrtc.sh
RUN ./scripts/get_webrtc.sh 108.5359.5.0 android /root /root
## Copy resources
COPY src src
COPY CMakeLists.txt ./
RUN cmake -B build \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_NATIVE_API_LEVEL=16 \
-DBUILD_SHARED_LIBS=OFF \
-DWEBRTC_INCLUDE_DIR=/root/webrtc/include \
-DWEBRTC_LIBRARY=/root/webrtc/lib/armeabi-v7a/libwebrtc.a \
-DCMAKE_BUILD_TYPE=Release
RUN cmake --build build --config Release --parallel $(nproc) --target AndroidWebRTC
src/main.cpp
#include <iostream>
#include <api/create_peerconnection_factory.h>
int main() {
auto googleSessionDescription = webrtc::CreateSessionDescription(
webrtc::SdpType::kOffer, "sdp");
std::cout << "Hello, World!" << std::endl;
return 0;
}
scripts/get_webrtc.sh
#!/bin/bash
if [ $# -lt 4 ]; then
echo "$0 <webrtc_build_version> <package_name> <output_dir> <source_dir>"
exit 1
fi
WEBRTC_BUILD_VERSION=$1
PACKAGE_NAME=$2
OUTPUT_DIR=$3
SOURCE_DIR=$4
set -ex
if [ ! -e $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz ]; then
curl -Lo $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz https://github.com/shiguredo-webrtc-build/webrtc-build/releases/download/m${WEBRTC_BUILD_VERSION}/webrtc.${PACKAGE_NAME}.tar.gz
fi
pushd $OUTPUT_DIR
tar xf $SOURCE_DIR/webrtc.${PACKAGE_NAME}.${WEBRTC_BUILD_VERSION}.tar.gz
popd
scripts/get_cmake.sh
#!/bin/bash
# <platform> には Linux か Darwin を指定する
# <output_dir>/cmake に CMake が配置される
if [ $# -lt 3 ]; then
echo "$0 <cmake_version> <platform> <output_dir>"
exit 1
fi
CMAKE_VERSION=$1
PLATFORM=$2
OUTPUT_DIR=$3
set -ex
pushd $OUTPUT_DIR
curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
tar xf cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
rm cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64.tar.gz
rm -rf cmake
mv cmake-${CMAKE_VERSION}-${PLATFORM}-x86_64 cmake
popd

How to take user input at installation time.... during sudo dpkg -i <package_name>.deb?

My requirement is to install sample binaries as per user's yes/no to question
Do you want to install to sample binaries?
If user give input yes/y then mypackage.deb will install sample binaries to location otherwise won't.
I have created a config file, postinst file and template file but not able to achieve this yet during installation time. It is asking me "Do you want to install to sample binaries?" during deb package creation time.
following are the files.
I have googled some possible thing, some suggest to use debconf set selection but was not able to fit it in my requirement.
Any suggestion to achieve this??
"mypackage.config"
#!/bin/bash
# Source debconf library.
. /usr/share/debconf/confmodule
echo "My package repo path: $1"
echo "Creating My package dir"
mkdir my_package
cd my_package
echo "Copy debian control file"
mkdir DEBIAN
cp $1/debian/control DEBIAN/
cp $1/debian/mypackage.postinst DEBIAN/
cp $1/debian/mypackage.templates DEBIAN/
echo "Copy include files"
mkdir -p usr/include/local
cp $1/MyLib.h usr/include/local/
echo "Copy lib"
mkdir -p usr/local/lib
cp $1/build/src/mylib.so usr/local/lib/
mkdir usr/local/sample
cp $1/build/examples/sample_all usr/local/sample/
#Do you want to install sample binaries?
db_unregister mypackage/sample
db_input high mypackage/sample
# Check their answer.
db_get mypackage/sample
if [ "$RET" = "true" ];
then
echo "Copy Sample Binaries"
mkdir -p home/$USER/My_Package/examples/bin
mv usr/local/sample/sample_all home/$USER/My_Package/examples/bin/
sudo rm -rf /usr/local/sample
db_go
else
echo "Installing deb package without sample binaries"
sudo rm -rf /usr/local/sample
db_go
fi
echo "Create debian package"
cd $1/debian
dpkg-deb --build --root-owner-group mypackage
"my_package.templates"
Template: my_package/sample
Type: boolean
Description: Do you want to install sample binaries as well [true/false] ..?
"my_package.postinst"
#!/bin/sh
# Make sure this script fails if any unexpected errors happen
set -e
# Load debconf library
. /usr/share/debconf/confmodule
db_purge
"control"
Package: my_package
Version: 1.0
Section: custom
Priority: optional
Architecture: all
Pre-Depends: debconf
Essential: no
Installed-Size: 1024
Maintainer: package
Description: My package framework

How to build Opencv code in a docker file

I want to build and run a c++ opencv code using docker. Here is my dockerfile:
FROM nvidia/cuda:11.5.0-cudnn8-runtime-ubuntu20.04
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
g++ git wget cmake sudo
RUN apt-get install -y \
build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev \
python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev \
libcanberra-gtk-module libcanberra-gtk3-module
RUN git clone https://github.com/opencv/opencv.git && \
cd /opencv && mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. && \
make -j"$(nproc)" && \
make install && ldconfig
The above commands makes my opencv libs, but I don't how to use it to run the actual code. I added this two lines at the end of the dockerfile (wav.cpp is the name of my cpp file that I want to run):
COPY . .
RUN g++ -o wav wav.cpp
But at the end I get this error, which obviously says it can't find the opencv headers.
wav.cpp:2:10: fatal error: opencv2/imgproc.hpp: No such file or
directory
2 | #include "opencv2/imgproc.hpp"
| ^~~~~~~~~~~~~~~~~~~~~ compilation terminated.
Now how should I resolve this header (and lib) dependency problem?
Thank you.
You didn't specify the location for the headers and which libraries should be linked by gcc. Please take a look at the manual of gcc/g++ for the flags -I and -L. Should be something like this:
RUN g++ -o wav wav.cpp -I <opencv header location> -L <opencv libs location> -lopencv_core ....
Using #emrhzc's answer I could build my code inside the dockerfile. Now my final working command is:
RUN g++ -o wav wav.cpp `pkg-config --cflags --libs opencv4`

How to reduce build time for a Docker container installing R libraries?

I need to run some code that contains both Python 3.8 and R 4.1.0 in a Docker container. Below is my Dockerfile.
FROM python:3.8-slim-buster AS final-image
# R version to install
ARG R_BASE_VERSION=4.1.0
ARG PREBUILD_DEPS="software-properties-common gnupg2"
ARG BUILD_DEPS="build-essential binutils cmake gfortran libblas-dev liblapack-dev libjpeg-dev libpng-dev libnlopt-dev pkg-config"
ARG RUNTIME_DEPS="r-base=${R_BASE_VERSION}-* libcurl4-openssl-dev libssl-dev libxml2-dev"
# venv path
ENV PATH="/opt/venv/bin:$PATH"
RUN apt-get update \
# Adding this to install latest versions of g++
&& echo 'deb http://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/testing.list \
# Install the below packages to add repo which is then used to install R version 4
&& apt-get install -y --no-install-recommends $PREBUILD_DEPS \
&& add-apt-repository 'deb http://cloud.r-project.org/bin/linux/debian buster-cran40/'\
# This key is required to install r-base version 4
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key FCAE2A0E115C3D8A \
# Update again to use the newly added sources
&& apt-get update \
&& apt-get install -y --no-install-recommends $RUNTIME_DEPS $BUILD_DEPS \
&& python -m venv /opt/venv \
&& /opt/venv/bin/python -m pip install --upgrade pip \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt packages.R /
RUN pip install wheel setuptools \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir --no-binary xgboost xgboost \
&& Rscript packages.R \
&& strip --strip-unneeded usr/local/lib/R/site-library/Boom/lib/libboom.a \
&& strip --strip-debug /usr/local/lib/R/site-library/*/libs/*so \
# Uninstall unnecessary dependencies
&& rm -rf /tmp/* \
&& apt-get purge -y --auto-remove $BUILD_DEPS $PREBUILD_DEPS \
&& apt-get autoremove -y \
&& apt-get autoclean -y \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT XXX
This is packages.R file:
#Setting environment
rm(list = ls())
cat("\014")
print(Sys.time())
# CRAN mirror to use. cran.rstudio.com is a CDN and the recommended mirror.
# Specifying multiple backup CRAN mirrors as Jenkins builds fails
# intermittently due to unavailability of packages in main mirror.
cran_repos = c(MAIN_CRAN_MIRROR = 'https://cran.rstudio.com',
ALT_CRAN_MIRROR = 'http://cran.r-project.org/')
#Loading Libraries
package_ls <- c(
"config",
"crayon",
"aws.s3",
"aws.ec2metadata",
"dplyr",
"data.table",
"imputeTS",
"Metrics",
"StatMeasures",
"tseries",
"purrr",
"log4r",
"lubridate",
"forecast",
"caret",
"MASS",
"stringr",
"tidyr",
"uroot",
"readr",
"Boruta",
"bsts"
)
for (pkg_name in package_ls) {
message("Installing ", pkg_name)
install.packages(pkg_name, repos = cran_repos)
if (!(pkg_name %in% installed.packages()[, 'Package'])) {
stop(pkg_name,
" is a required package and it could not be installed, stopping!")
}
}
The Problem
Building the docker container takes a lot more time than I would like. It is because, some packages (e.g. bsts) needs their dependencies (e.g. the C++ library Boom) to be built from source and this is taking a lot of time.
Is there a way to either:
Speed up the building of R libraries? OR
Build R libraries in local and copy only the binaries to the Docker container. OR
Reduce the build time in any other way for R packages.
Thanks in advance.
Update
Some ideas from the comments:
By #botje
Install R packages in parallel using the Ncpus argument of install.packages R function. (I have 4 CPUs to work with and setting Ncpus = 4 resulted in a 10% speed up.)
install.packages(package_ls, repos = cran_repos, Ncpus = 4)
Create a custom CRAN mirror containing locally-compiled packages for faster installation.
I rewrote the last bit of your packages.R as follows:
install.packages(package_ls, Ncpus=16)
This gave me a 3x speed improvement over a run with Ncpus=1 (189s vs 719s).

mingw-64 - Install package

I am using mingw_64 and CLion in Windows 10 to try to use a library (https://github.com/libtrading/libtrading) in a simple project, but the library requires some packages to be installed prior the use of the library. The thing is that the installing instructions are for Linux environment as follows:
# Debian
$ apt-get install pkg-config libxml2-dev libglib2.0-dev libncurses5-dev \
python-yaml libevent-dev
# Fedora
$ yum install zlib-devel libxml2-devel glib2-devel vim-common ncurses-devel \
python-yaml libevent-devel
# OSX
$ brew install libevent glib pkgconfig
$ pip install pyyaml
So, how do I install these pre-requisites in my mingw_64 and CLion in Windows 10 environment?
If you installed MinGW through MSYS2, you can use the MSYS2 pacman package manager to install additional packages:
The MSYS2 software distribution uses a port of pacman from Arch Linux to manage (install, remove and update) binary packages and also to build those packages in the first place.
Finding package
pacman -Ss <name or part of the name of the package>
Installing a package
pacman -S <name of the package>
Example:
$ pacman -Ss libxml2
mingw64/mingw-w64-x86_64-libxml2 2.9.8-1
XML parsing library, version 2 (mingw-w64)
. . .
$ pacman -S mingw64/mingw-w64-x86_64-libxml2
resolving dependencies...
looking for conflicting packages...
Total Download Size: 1.37 MiB
Total Installed Size: 11.06 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
:: Processing package changes...
(1/1) installing mingw-w64-x86_64-libxml2 [##################################] 100%
A shorter version of pacman is pacboy. For example, you can specify the :x suffix to install a mingw64 package:
$ pacboy -S libxml2:x
MinGW does not have any package management, so installing dependencies usually means building them yourself from source. For those self-built packages I have a Unix-like directory structure (with the usual bin, lib, include, etc. directories) apart from the MinGW installation.
Before I expand on that, please check if libTrading supports Windows at all. A quick glance over the libTrading GitHub shows no mention of Windows anywhere. That may mean that the project does not support Windows at all. But then we’re no more talking about configuring a build environment, but adding support for a whole new operating sytem to that project.
Here is the way I used
$ cat /usr/bin/install
# How to use
# install rsync
cd /
echo $1
# echo $2
URL=http://repo.msys2.org/msys/x86_64
FILE=`wget -O - -o /dev/null $URL | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep -E ^$1 | egrep -v '.sig$' | sort | tail -1f`
echo $FILE
# wget -qO- $URL/$FILE | tar -I zstd -xvf - -C /
# wget -qO- $URL/$FILE | tar xJvf - -C /
if [[ $FILE == *.zst ]] # * is used for pattern matching
then
wget -qO- $URL/$FILE | tar -I zstd -xvf - -C /
elif [[ $FILE == *.xz ]]
then
wget -qO- $URL/$FILE | tar xJvf - -C /
else
echo "$FILE is not extracted"
fi
$ install whois
whois
whois-5.5.9-1-x86_64.pkg.tar.zst
.BUILDINFO
.MTREE
.PKGINFO
etc/
etc/whois.conf
usr/
usr/bin/
usr/bin/whois.exe
usr/share/
usr/share/man/
usr/share/man/man1/
usr/share/man/man1/whois.1.gz
usr/share/man/man5/
usr/share/man/man5/whois.conf.5.gz