How to compile the software ?

The normal way to get some package from git:
Code:
git clone [URL]https://github.com/somepackge.git[/URL]
cd somepackage/
To compile on linux platform
Code:
mkdir build
cd build/
cmake ..
make
ctest
sudo make install

If I want to do the same work, how to compile it on FreeBSD then?
 
Pretty much the same, depending on the source code (some use autoconf and friends).

Obviously you'll need to install cmake and any build and run-time dependancies.

FreeBSD uses clang rather than gcc so that may cause you some issues - or you can install gcc if required.

I think it will really depend on the source code that you are trying to build. Some projects are very tied to the Linux environment so may require more work than others.

Look at the Porters Handbook.

Probably the first thing to do is to make sure someone hasn't already ported the package you want e.g. look at Freshports.
 
There is cmake and supported FreeBSD versions listed: https://www.freshports.org/devel/cmake
ABIlatestquarterly
FreeBSD:11:aarch643.12.23.17.3_1
FreeBSD:11:amd643.20.53.20.4
FreeBSD:11:armv63.5.2_13.17.3_1
FreeBSD:11:i3863.20.53.20.4
FreeBSD:11:mips--
FreeBSD:11:mips643.5.2_2-
FreeBSD:12:aarch643.12.23.20.4
FreeBSD:12:amd643.20.53.20.4
FreeBSD:12:armv63.12.23.18.3
FreeBSD:12:armv73.12.23.18.3
FreeBSD:12:i3863.20.53.20.4
FreeBSD:12:mips--
FreeBSD:12:mips64--
FreeBSD:12: powerpc64-3.19.6
FreeBSD:13:aarch643.19.33.20.4
FreeBSD:13:amd643.20.53.20.4
FreeBSD:13:armv63.19.33.19.6
FreeBSD:13:armv73.19.33.19.6
FreeBSD:13:i3863.20.53.20.4
FreeBSD:13:mips--
FreeBSD:13:mips64--
FreeBSD:13: powerpc643.19.23.20.4
FreeBSD:14:aarch643.20.5-
FreeBSD:14:amd643.20.5-
FreeBSD:14:armv63.19.6-
FreeBSD:14:armv73.19.6-
FreeBSD:14:i3863.20.5-
FreeBSD:14:mips--
FreeBSD:14:mips64--
FreeBSD:14: powerpc643.19.6-

You can install it by using this command:
pkg install cmake
I gave how to install cmake because you were using cmake example. It depends to how you want to setup software.
Rest of work almost same to linux. You can want to be sure sudo installed to your system. Also your user account must be in wheel to access root.
If not here it is (This also requires root permission.)
pw group mod wheel -m !username_here!

And as richardtoohey2 says, you must be sure code not made for only Linux like it can contain only Linux working paths or libraries
 
I prefer to use ports-mgmt/portmaster when I compile ports as it will pull in a list of dependencies for my perusal before I begin the build.

Code:
# cd /usr/ports/ports-mgmt/portmaster && make install clean

Unless it balks at a conflict during the build and I have to step in and see what needs to be done, run it from the login terminal where I can keep an eye on it and sit back and relax till it's done.

If that means going to sleep while something like www/firefox takes hours to build, it will be waiting for me when I wake up. :)
 
FreeBSDs workflow of compiling source does not differ from Linux; But that doesn't mean that the code can be compiled on FreeBSD, too. Also your workflow will often fail even on Linux, because there exists none defined standard…

The "normal way" is to check if there's anywhere a documentation available from the developer itself; That's the only person who can tell you how a software has to be compiled - otherwise you have to examine the source.

Finding out how to compile something can be a lot of work, and often require a good portion of knowledge - and even then you might fail. That's the job port maintainers doing for us. Thanks for that!
 
Back
Top