Skip to content

Quickstart FreeBSD

Franco Corbelli edited this page Sep 2, 2023 · 1 revision

Hints for inexperienced users: 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 bit deeper: how to manually compile (without Makefile)

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

g++

We use gcc in C++ mode by default, you can get clang++

-Dunix

Define a constant, we want a Unix zpaqfranz, not a Windows one

-O3

Optimize the code = faster

-march=native

Make a program for myself

zpaqfranz.cpp

Compile zpaqfranz.cpp

-o zpaqfranz

Write (output) zpaqfranz (the executable)

-pthread

Use the pthread library

-static

Make a "monolithic" executable, no need for external libraries

Clone this wiki locally