Differences

This shows you the differences between two versions of the page.

doc:devel:packages [2014/02/20 11:55]
karlp
doc:devel:packages [2014/07/08 06:05] (current)
theoradicus package/files is sometimes important
Line 5: Line 5:
  * package/Makefile   * package/Makefile
  * package/patches   * package/patches
 +  * package/files
The patches directory is optional and typically contains bug fixes or optimizations to reduce the size of the executable. The patches directory is optional and typically contains bug fixes or optimizations to reduce the size of the executable.
 +The files directory is optional. It typically includes default config or init files.
The package makefile is the important item because it provides the steps actually needed to download and compile the package. The package makefile is the important item because it provides the steps actually needed to download and compile the package.
Line 63: Line 65:
  * PKG_VERSION    - The upstream version number that we're downloading   * PKG_VERSION    - The upstream version number that we're downloading
  * PKG_RELEASE    - The version of this package Makefile   * PKG_RELEASE    - The version of this package Makefile
 +  * PKG_LICENSE    - The license(s) the package is available under, SPDX form.
 +  * PKG_LICENSE_FILE- file containing the license text
  * PKG_BUILD_DIR  - Where to compile the package   * PKG_BUILD_DIR  - Where to compile the package
  * PKG_SOURCE      - The filename of the original sources   * PKG_SOURCE      - The filename of the original sources
Line 95: Line 99:
</code> </code>
 +
 +Packages that are using Autotools should work with autoreconf fixup.
 +However there might be issues with required versions.
 +
 +Instead of patching ./configure one should fix the file from which ./configure is generated in autotools: configure.ac / configure.in.
TODO What are the differences ? TODO What are the differences ?
Line 112: Line 121:
  *  DESCRIPTION - (deprecated) A long description of the package   *  DESCRIPTION - (deprecated) A long description of the package
  *  URL        - Where to find the original software   *  URL        - Where to find the original software
-  *  MAINTAINER  - (optional) Who to contact concerning the package+  *  MAINTAINER  - (required for new packages) Who to contact concerning the package
  *  DEPENDS    - (optional) Which packages must be built/installed before this package. See [[#Dependency.types|below]] for the syntax.   *  DEPENDS    - (optional) Which packages must be built/installed before this package. See [[#Dependency.types|below]] for the syntax.
Line 202: Line 211:
| BROKEN | Package doesn't build or work, and should only be visible if "Show broken targets/packages" is selected. Prevents the package from failing builds by accidentally selecting it. | | BROKEN | Package doesn't build or work, and should only be visible if "Show broken targets/packages" is selected. Prevents the package from failing builds by accidentally selecting it. |
| IPV6 | IPv6 support in packages is selected. | | IPV6 | IPv6 support in packages is selected. |
 +
 +===== Configure a package source =====
 +
 +Example:
 +<code>
 +CONFIGURE_ARGS += \
 +        --disable-native-affinity \
 +        --disable-unicode \
 +        --enable-hwloc
 +
 +CONFIGURE_VARS += \
 +        ac_cv_file__proc_stat=yes \
 +        ac_cv_file__proc_meminfo=yes \
 +        ac_cv_func_malloc_0_nonnull=yes \
 +        ac_cv_func_realloc_0_nonnull=yes
 +
 +</code>
 +To set variables (autoconfig internal ones or CPPFLAGS,CFLAGS, CXXFLAGS, LDFLAGS for example) or configure arguments.
 +Setting configure arguments is common. Setting VARS is needed when the configure.ac autoconf source script does not work well on cross compilation or finding libraries.
==== Host tools required ==== ==== Host tools required ====
Line 318: Line 346:
$(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib
endif endif
 +
 +===== Working on local application source =====
 +If you are still working on the application itself, at the same time as you are working on the packaging, it can be very useful to have OpenWrt build your work in progress code, rather than a specific version+md5sum combination checked out of revision control, or downloaded from your final "release" location.  There are a few ways of doing this.
 +
 +==== CONFIG_SRC_TREE_OVERRIDE ====
 +This is an option in menuconfig. See "Advanced configuration options (for developers)" -> "Enable package source tree override"
 +
 +This allows you to point to a local git tree.  (And only git)  Say your package is defined in my_cool_feed/awesome_app.
 +<code>
 +ln -s /path/to/local/awesome_app_tree/.git feeds/my_cool_feed/awesome_app/git-src
 +make package/awesome_app/{clean,compile} V=s
 +</code>
 +
 +Benefits of this approach are that you don't need any special infrastructure in your package makefiles, they stay completely as they would be for a final build. The downside is that it only builds whatever is currently _committed_ in HEAD of your local tree.  (Not <em>master</em>, this could be a private testing branch, but it must be <em>committed</em> it can't be local changes)
 +This will also use a _separate_ directory for building and checking out the code.  So any built objects in your local git tree (for example, build targeting a different architecture) will be left alone, but whatever _branch_ is checked out in your tree determines where HEAD is.
 +
 +==== USE_SRC_DIR ====
 +
 +As part of deprecating package-version-override.mk (below) a method to point directly to local source was introduced.
 +<code>
 +make package/awesome_app/clean V=s
 +make package/awesome_app/prepare USE_SOURCE_DIR=~/src/awesome_src V=s
 +make package/awesome_app/clean V=s
 +</code>
 +(V=s is optional above)
 +
 +This doesn't require any config change to enable rules, and doesn't require that you have a local git tree, and doesn't require any files to be committed.
 +
 +At least at present however, this has the following problems:
 +  * make clean doesn't clean the source link directory, but still seems to be removing a link
 +  * make prepare needs to be run every time
 +  * make package/awesome_app/{clean,compile} USE_SOURCE_DIR=~blah doesn't work
 +  * Seems to have bad interactions with leaving USE_SOURCE_DIR set for other (dependent?) packages.
 +
 +See http://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg23122.html for the original discussion of this new feature
 +
 +==== (Deprecated) package-version-override.mk ====
 +:!: ** Don't use this anymore **
 +Support for this style of local source building was removed in: https://dev.openwrt.org/changeset/40392.  This style required a permanent modification to your package makefile, and then entering a path via menuconfig to where the source was found.  It was fairly easy to use, and didn't care whether your local source was in git or svn or visual source safe even, but it had the major downside that the "clean" target simply didn't work.  (As it simply removed a symlink for cleaning)
 +
 +If you build a current OpenWrt tree, with packages that still attempt to use this style of local building, you _will_ receive errors like so:
 +ERROR: please fix package/feeds/feed_name/application_name/Makefile - see logs/package/feeds/feed_name/application_name/dump.txt for details
 +
 +If you need/want to keep using this style, where it's available, make sure you include without failing if it was missing:
 +<code>
 +-include $(INCLUDE_DIR)/package-version-override.mk
 +</code>
Line 329: Line 404:
See //**FIX:Customizingthekerneloptions customizing the kernel options**// for including it in the kernel. See //**FIX:Customizingthekerneloptions customizing the kernel options**// for including it in the kernel.
-To include one of these programs as a loadable module, select the corresponding kernel option in the OpenWrt configuration (see [[doc:howto:build#configuration|Build Configuration]]). If your favorite kernel module does not appear in the OpenWrt configuration menus, you must add a stanza to one of the files in the package/kernel/modules directory. Here is an example extracted from package/kernel/modules/block.mk:+To include one of these programs as a loadable module, select the corresponding kernel option in the OpenWrt configuration (see [[doc:howto:build#configuration|Build Configuration]]). If your favorite kernel module does not appear in the OpenWrt configuration menus, you must add a stanza to one of the files in the package/kernel/linux/modules directory. Here is an example extracted from .../modules/block.mk:
<code> <code>
define KernelPackage/loop define KernelPackage/loop
Line 350: Line 425:
Changes to the *.mk files are not automatically picked up by the build system. To force re-reading the meta data either touch the kernel package Makefile using ''touch package/kernel/linux/Makefile'' (on older revisions ''touch package/kernel/Makefile'') or to delete the ''tmp/'' directory of the buildroot. Changes to the *.mk files are not automatically picked up by the build system. To force re-reading the meta data either touch the kernel package Makefile using ''touch package/kernel/linux/Makefile'' (on older revisions ''touch package/kernel/Makefile'') or to delete the ''tmp/'' directory of the buildroot.
-</code> +You can also add kernel modules which are //not// part of the linux source distribution. In this case, a kernel module appears in the package/ directory, just as any other package does. The package/Makefile uses <code>KernelPackage/xxx</code> definitions in place of <code>Package/xxx</code> 
-You can also add kernel modules which are //not// part of the linux source distribution. In this case, a kernel module appears in the package/ directory, just as any other package does. The package/Makefile uses <code>KernelPackage/xxx</code> +For example, here is package/madwifi/Makefile:
- definitions in place of <code>Package/xxx</code> +
-. For example, here is package/madwifi/Makefile:+
<code> <code>
# #
Line 551: Line 624:
:!: **procd** style init is used in some init.d scripts since: https://dev.openwrt.org/changeset/38023 . :!: **procd** style init is used in some init.d scripts since: https://dev.openwrt.org/changeset/38023 .
 +See http://wiki.openwrt.org/inbox/procd-init-scripts for more details on that
<code> <code>
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
 +# "new(er)" style init script
 +# Look at /lib/functions/service.sh on a running system for explanations of what other SERVICE_
 +# options you can use, and when you might want them.
 +
 +START=80
 +APP=mrelay
 +SERVICE_WRITE_PID=1
 +SERVICE_DAEMONIZE=1
 +
 +start() {
 +        service_start /usr/bin/$APP
 +}
 +
 +stop() {
 +        service_stop /usr/bin/$APP
 +}
 +</code>
 +
 +<code>
 +#!/bin/sh /etc/rc.common
 +###########################################
 +# NOTE - this is an old style init script #
 +###########################################
START=80 START=80
Line 570: Line 667:
===== How To Submit Patches to OpenWrt ===== ===== How To Submit Patches to OpenWrt =====
 +Packages are maintained in a separate repository to reduce maintennance overhead.  The general guidelines for OpenWrt still apply, but see the README in the packages repository for latest information.
 +
 +  * https://github.com/openwrt/packages
  * https://dev.openwrt.org/wiki/SubmittingPatches   * https://dev.openwrt.org/wiki/SubmittingPatches
 +
 +See https://lists.openwrt.org/pipermail/openwrt-devel/2014-June/025810.html for the original announcement of this change

Back to top

doc/devel/packages.1392893714.txt.bz2 · Last modified: 2014/02/20 11:55 by karlp