-
Notifications
You must be signed in to change notification settings - Fork 21
Quickstart FreeBSD
zpaqfranz is an opensource software: you have to download from "somewhere", compile, then install (=copy in /bin or /usr/bin, or /usr/local/bin or wherever).
So let's show, step by step, how to do on a fresh-installed FreeBSD 13 system (almost identical for other versions): you need some tools that can be already installed, or not. In the example I suppose none of them.
- working internet connection to download what is needed
- the compiler. Typically gcc (or clang), in fact g++.
- "something" to download files from internet. Typically wget
- make command (if you optionally want to use the Makefile)
- "something" to make sure that the (downloaded) Makefile is in "Unix" style. Typically dos2unix
Click here for video example on FreeBSD 13
Here the short list of commands to be given
pkg install -y gcc wget unix2dos
mkdir /tmp/zp
cd /tmp/zp
wget https://raw.githubusercontent.com/fcorbelli/zpaqfranz/main/zpaqfranz.cpp
wget https://raw.githubusercontent.com/fcorbelli/zpaqfranz/main/Makefile
dos2unix Makefile
make install clean
Explanation
pkg install -y gcc wget unix2dos
Download and install gcc (the compiler), wget (the downloader), unix2dos (convert in Unix-style text file, in fact we need dos2unix). The -y switch is for "answer YES" by default
mkdir /tmp/zp
Create ("makedir") a temporary directory "zp" into "/tmp"
cd /tmp/zp
Enter in this directory (cd=change dir)
wget https://raw.githubusercontent.com/fcorbelli/zpaqfranz/main/zpaqfranz.cpp
Download the zpaqfranz.cpp source code from github. Of course you can download "by hand"
wget https://raw.githubusercontent.com/fcorbelli/zpaqfranz/main/Makefile
Download the Makefile from github (we are lazy, we'll use make)
dos2unix Makefile
Make sure that the Makefile do NOT carry CR/LF, but only LF, otherwise make will abort (the tool make is very, very picky)
make install clean
Compile zpaqfranz.cpp to zpaqfranz, and copy into /usr/local/bin
A lot of efforts (and tradeoffs) are used to make compiling as straightford as possible
The shortest list is
pkg install -y gcc wget
mkdir /tmp/zp
cd /tmp/zp
wget https://raw.githubusercontent.com/fcorbelli/zpaqfranz/main/zpaqfranz.cpp
Or get "somehow" the zpaqfranz.cpp
g++ -Dunix -O3 -march=native zpaqfranz.cpp -o zpaqfranz -pthread -static
Explanation
We use gcc in C++ mode by default, you can get clang++
Define a constant, we want a Unix zpaqfranz, not a Windows one
Optimize the code = faster
Make a program for myself
Compile zpaqfranz.cpp
Write (output) zpaqfranz (the executable)
Use the pthread library
Make a "monolithic" executable, no need for external libraries