Adding a package to Optware ng - Optware/Optware-ng GitHub Wiki
The best way to learn Optware-ng build system is by studying examples. This page doesn't aim to fully describe all possible issues you may encounter, but will try to give you some guidelines for what to begin with.
Refer to Contributing to Optware ng to setup a development environment.
$ make make/<package>.mk
This will create make/<package>.mk
, the Makefile that will be used to fetch source, configure, build, stage (if needed) and package your <package> (no pun intended). This template Makefile you created follows the following schema:
- Source is fetched using
wget
- Configure stage uses
./configure
script. This template also assumes the use of libtool (see$(PATCH_LIBTOOL) $(@D)/libtool
line) - Package is built and installed using
make
Here we'll describe main fields you have to fill in in the newly created Makefile
This points to full URL address of the sourcecode archive
This is the sourcecode version
The name that will be used to save the sourcecode archive in the downloads
dir
The top-level dir name of the sourcecode tarball
-
zcat
for gunzipped tarballs -
bzcat
for bzipped tarballs -
xzcat
for .tar.xz archives
If the sourcecode is not a tarball, you have to modify $(<FOO>_BUILD_DIR)/.configured
stage accordingly, e.g., see make/cherokee.mk
This field is slightly outdated, but you can still list yourself as a maintainer if you want to
Package description
You usually want to leave it to optional
Runtime package dependencies
Runtime suggestions
Runtime conflicts
This should be incremented on every ipk change
Space separated user-editable configuration files
This lists the patches in the order in which they should be applied to the sourcecode. template Makefile uses $(PATCH) -d $(BUILD_DIR)/$(<FOO>_DIR) -p0
to apply the pattches. $(PATCH)
is patch
binary wrapper that replaces all %OPTWARE_TARGET_PREFIX%
occurrences with $(TARGET_PREFIX)
before passing patches to patch
.
Additional compilation and linking flags
This rule unpacks, patches and configures the sourcecode.
Edit this line to stage the buildtime dependencies before running configure script.
Check and set configure switches and/or environment variables here:
(cd $(@D); \
$(TARGET_CONFIGURE_OPTS) \
CPPFLAGS="$(STAGING_CPPFLAGS) $(<FOO>_CPPFLAGS)" \
LDFLAGS="$(STAGING_LDFLAGS) $(<FOO>_LDFLAGS)" \
./configure \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_TARGET_NAME) \
--target=$(GNU_TARGET_NAME) \
--prefix=$(TARGET_PREFIX) \
--disable-nls \
--disable-static \
)
Comment this line out if you package doesn't use libtool
This rule builds the configured package using make
This rule is used to install the compiled package to staging dir. This is usually useful if you're building a library. You may also want to add a line to delete the staged .la
file(s) if the package uses libtool:
rm -f $(STAGING_LIB_DIR)/<lib>.la
This creates the control file used to build ipk, based on the info fields you filled in earlier. You don't usually have to edit this
This creates the ipk file. If install-strip
make target isn't supported, or doesn't work properly, change it to install
, and then add a line like this one to strip the binaries after you install them:
$(STRIP_COMMAND) $(<FOO>_IPK_DIR)$(TARGET_PREFIX)/{<binary1>,<binary2>,..}
Also, if package uses libtool:
find $(<FOO>_IPK_DIR)$(TARGET_PREFIX) -type f -name '*.la' -exec rm -f {} \;
When you try to build you package for the first time, if using wget, you have to call make
with CREATE_CHECKSUM=1
argument, which will create checksums/<packagesource>.sha512
:
make <package> CREATE_CHECKSUM=1
Later on, don't forget to push this checksum to your fork before creating a pull request. Also, please test that your package builds and installs with -j10
make switch.
Here're some useful examples to look at. The list is to be appended in the future.
-
py-jinja2.mk
— pure python library -
py-django.mk
— pure python library that also installs binary/ies. This package also uses a different (older) version to build python25 package -
py-cryptography.mk
— python wrapper around C(++) library. This package also has a host build.
-
perl-uri.mk
— pure perl module -
perl-dbd-mysql.mk
— perl module that links with C(++) library
-
transmission.mk
— can fetch certain sourcecode revision using subversion -
gitosis.mk
— usesgit clone --bare
andgit archive
to fetch certain commit based on date -
vlc.mk
— uses git to clone and checkout specific commit based on date, then executes certain package-specific code that can be executed from git worktree onlygit describe
, and finally archives excluding '.git' dir to save space -
template-cvs.mk
— fetches code using cvs. cvs is almost never used nowadays -
inferno.mk
— fetches code using mercurial host build
-
template.mk
— classic autoconf'ed configure script configuration -
talloc.mk
— samba project homebrew waf -
6relayd.mk
— using cmake