RetroBSD
http://retrobsd.org/

Writing your own ports for the ports tree
http://retrobsd.org/viewtopic.php?f=15&t=37539
Page 1 of 1

Author:  ibara [ Mon Feb 15, 2016 8:20 am ]
Post subject:  Writing your own ports for the ports tree

I've realized a bit that the ports tree right now is effectively black magic that only I know. That needs to change. Other people need to be able to contribute ports to the ports tree.

So here's a first attempt at making it easy for others to begin writing their own ports that we can put in the ports tree.
Step 1. Find a piece of software you want to port (or use a piece of software you wrote yourself!)

Step 2. Checkout the ports tree if you haven't already.
Code:
$ cd $BSDSRC && git clone https://github.com/ibara/LiteBSD-Ports ports

Step 3. Build LiteBSD if you haven't already.
Code:
$ bmake build

Step 4. Identify which category your port should live in (or create a new category if none fit, but really do try to use an existing category)

Step 5. Create the port directory
Code:
$ mkdir -p ports/<category>/<port name>

Step 6. Enter that directory and put all the code in it.

Step 7. Now, you need to use a Makefile that bmake can understand. There is a template available for you to use: https://github.com/ibara/LiteBSD-Ports/ ... e.template

Step 8. Once everything is set up run "bmake build" to build the software. If you need to tweak the code to get it to compile, that is OK and normal.

Step 9. When everything is built, run "bmake fake" to ensure it installs correctly.

Step 10. Now run "bmake control" to create an opkg control file. This file allows opkg to work with the final package we will make. You will need to edit this file (it appears in the the directory you're working in once you run that command, it is named "control"): edit the Description, Put your name and email address in as the Maintainer (in the format "YourName <email@example.com>", and select the appropriate license for the code.

Step 11. The final step: run "bmake package" and a package named ${PORT}-${V}_mipsel.ar will appear in the work/ directory. Congrats! You have successfully created a package for LiteBSD. You can write this to your LiteBSD machine and install it with "opkg install ${PORT}-${V}_mipsel.ar"

To get your package ready for inclusion in the ports tree:
Step 1. Run "make clean" and "make clean-package" to make sure we're not committing binaries and .o files.

Step 2. Make a pull request on GitHub (or ask me to give you write access so you can commit it yourself).

That's it! Good luck and have fun. And ask lots of questions so this guide can improve.
Writing ports is an easy and effective way of making LiteBSD more useful for yourself and everyone. Plus you can show everyone how you're contributing to LiteBSD!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/