You can just use the MariaDB ports in the FreeBSD ports tree using the following pattern:
- For MariaDB 5.3: http://www.freshports.org/databases/mariadb-server
- For MariaDB 5.5: http://www.freshports.org/databases/mariadb55-server
- For MariaDB 10.0: http://www.freshports.org/databases/mariadb100-server
- For MariaDB 10.1: http://www.freshports.org/databases/mariadb101-server
You can also use precompiled packages when available.
Alternatively, the following link contains a lot of information about how to build MariaDB "by hand" on FreeBSD:
MariaDB can be compiled with spinlocks instead of mutexes. This option enables MariaDB "fast mutexes". These have disabled by default for a a number of years, and it's generally recommended not to use them.