I've just installed openwrt on a Linksys 54GL. I can't find the package for the mqtt broker in Luci or using opkg.
I also downloaded the source but I'm having a problems since I don't have a build system installed right now.
What is the correct way for adding the mosquitto mqtt to the openwrt ?
A package would be the best way, and can be successfully done with devices that have sufficient resources that are running current releases. Unfortunately, the WRT54GL does not have sufficient resources for even basic use.
Depending on your use cases, a Pi-like SBC or something like a GL.iNet AR300M-Lite (under US$20) may be a suitable choice at a low or moderate price.
Edit: Whatever hardware you end up with, I'd suggest that any persistence be put on a USB stick or similar and not internal flash. The flash memory used for most routers has a lifespan measured in the thousands of cycles, which even a lightly loaded MQTT server could burn through in months.
Yes, the Pi 3B should be good device to test with or deploy, at least for "reasonable" loads such as most home users might experience. I wouldn't trust it as a server for 10,000 devices reporting every ten seconds