# Traccar port



## metacreo (Mar 10, 2021)

Look at this --FreeBSD port and package-- forum post.
There may be some committers who can made it official.

[_Mod: Split off from https://forums.freebsd.org/threads/custom-rc-d-script-trouble.67196/ _]


----------



## SirDice (Mar 10, 2021)

Your MASTER_SITES is not good. The port should download the original sources. The original sources are hosted on Github here: https://github.com/traccar/traccar. The way it's set up now it will never be accepted. You can submit your port here: https://bugs.freebsd.org/bugzilla/
Packages don't need to be created, they will be created from the port (if it's been accepted). 



			5.4. The Distribution Files
		



```
RUN_DEPENDS=		${LOCALBASE}/openjdk11-jre/bin/java:java/openjdk11-jre
```
This is not how you add a dependency on Java.


			6.15. Using Java
		



```
USES=			mysql:server, mysql:client
```
Why is it pulling in mysql:server?


```
: ${traccar_java:="/usr/local/openjdk11-jre/bin/java"} # path to your JRE
```
Doesn't take into account the default Java might change. See "Using Java" in the porter's handbook.


----------



## metacreo (Mar 10, 2021)

This port not need original sources. Because they are not adapted for freebsd at all. Compilation from original sources will not work on freebsd.
Traccar devs not plan support freebsd.
USE_JAVA is not good in this case, because port must be located in java. Easy way its run as www.
dist files contains just original extracted compiled servlet.
About mysql... yes, I think needs remove this.

PS: I reworked port.
MASTER_SITES=        https://github.com/traccar/traccar/releases/download/v4.12/
USES=            zip


----------



## SirDice (Mar 11, 2021)

metacreo said:


> This port not need original sources.


Then this port will never be accepted.


----------



## zirias@ (Mar 11, 2021)

Maybe there's something "lost in translation"? The port Makefile here looks like it IS using an officially released tarball, at least at the moment: https://freebsd.newestvision.com/ports/www/traccar/Makefile

There's probably a few things to improve. For starters, don't set `MASTER_SITES` manually with github, instead something like

```
DISTVERSIONPREFIX=     v
[...]
USE_GITHUB=    yes
```


----------



## SirDice (Mar 11, 2021)

Zirias said:


> The port Makefile here looks like it IS using an officially released tarball, at least at the moment


It wasn't yesterday.


----------



## SirDice (Mar 11, 2021)

metacreo said:


> Because they are not adapted for FreeBSD at all. Compilation from original sources will not work on FreeBSD.


That's exactly what a port is supposed to do. Make it work on FreeBSD. 


metacreo said:


> Traccar devs not plan support FreeBSD.


That's fine, a large portion of our ports aren't supported by the upstream developers. 


metacreo said:


> USE_JAVA is not good in this case, because port must be located in java.


I doubt this. It's usually just a case of setting the various class paths correctly. 


metacreo said:


> Easy way its run as www.


It would be preferable to have its own 'traccar' uid for this.


----------



## metacreo (Mar 12, 2021)

SirDice said:


> It would be preferable to have its own 'traccar' uid for this.


at first I did so. but it's not very clear how to add a user to GIDs and UIDs. maybe patch from port?


----------



## SirDice (Mar 12, 2021)

Chapter 6. Special Considerations
					

Special considerations when creating a new FreeBSD Port




					docs.freebsd.org
				






metacreo said:


> but it's not very clear how to add a user to GIDs and UIDs. maybe patch from port?


Add an additional patch for the ports/UIDs and ports/GIDs files. Do not patch these files from within the port. This patch just has to be applied by the committer. So you add two patches when submitting the port, one is for the port itself, the other for patching the UIDs and GIDs files.


----------



## scf@ (Sep 13, 2021)

I tried to improve the port for my own needs although it needs a bit more such as for the `pkg-message`.  The updated port and a patch can be found here:  https://people.freebsd.org/~scf/traccar/

Some of the changes I made to it:

Use UID and GID specific to traccar.
Use the provided `default.xml` yet comment out all the listeners by default.  Otherwise, the server opens all of those ports.  Already, the `traccar.xml.in` with the port opens the port for the Android client.
`default.xml` and `traccar.xml` are installed as .sample files.
Improve utilization of variables passed for substitution in the port files.
Switched to a little newer Java version 12, but this could be 11 to match what upstream uses.
Removed the requirement on MySQL from the rc script.  Two reasons for this:
It is hard-coded against MySQL yet other database engines could be used.  I tested with PostgreSQL.
There is no guarantee the database server will be on the same host as traccar.

For the last point, I am not sure if there is a better way to guarantee that the database server is running before traccar.  For what I have been testing, the database server is running before other services, but I do not know how to make that work with the port.  Possibly, traccar can handle database issues better if it does not already?

It still uses the compiled release from the GitHub server repo. While it would be great for someone to convert the port to actually compile everything, I lack the time to do that. 

Thank you for the hard work to get it to this point, metacreo!


----------

