Differences

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

doc:devel:packages [2013/07/03 17:28]
woglinde add addtional steps for editing mk-files
doc:devel:packages [2014/03/29 14:42] (current)
tmomas cleanup of leftover </code> tag
Line 65: Line 65:
  * 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
-  * PKG_SOURCE_URL  - Where to download the sources from+  * PKG_SOURCE_URL  - Where to download the sources from (directory)
  * PKG_MD5SUM      - A checksum to validate the download   * PKG_MD5SUM      - A checksum to validate the download
  * PKG_CAT        - How to decompress the sources (zcat, bzcat, unzip)   * PKG_CAT        - How to decompress the sources (zcat, bzcat, unzip)
Line 71: Line 71:
  * PKG_INSTALL    - Setting it to "1" will call the package's original "make install" with prefix set to PKG_INSTALL_DIR   * PKG_INSTALL    - Setting it to "1" will call the package's original "make install" with prefix set to PKG_INSTALL_DIR
  * PKG_INSTALL_DIR - Where "make install" copies the compiled files   * PKG_INSTALL_DIR - Where "make install" copies the compiled files
 +  * PKG_FIXUP      - ???
The PKG_* variables define where to download the package from; @SF is a special keyword for downloading packages from sourceforge. The md5sum is used to verify the package was downloaded correctly and PKG_BUILD_DIR defines where to find the package after the sources are uncompressed into $(BUILD_DIR). PKG_INSTALL_DIR defines where the files will be copied after calling "make install" (set with the PKG_INSTALL variable), and after that you can package them in the install section. The PKG_* variables define where to download the package from; @SF is a special keyword for downloading packages from sourceforge. The md5sum is used to verify the package was downloaded correctly and PKG_BUILD_DIR defines where to find the package after the sources are uncompressed into $(BUILD_DIR). PKG_INSTALL_DIR defines where the files will be copied after calling "make install" (set with the PKG_INSTALL variable), and after that you can package them in the install section.
At the bottom of the file is where the real magic happens, "BuildPackage" is a macro setup by the earlier include statements. BuildPackage only takes one argument directly -- the name of the package to be built, in this case "bridge". All other information is taken from the define blocks. This is a way of providing a level of verbosity, it's inherently clear what the DESCRIPTION variable in Package/bridge is, which wouldn't be the case if we passed this information directly as the Nth argument to BuildPackage. At the bottom of the file is where the real magic happens, "BuildPackage" is a macro setup by the earlier include statements. BuildPackage only takes one argument directly -- the name of the package to be built, in this case "bridge". All other information is taken from the define blocks. This is a way of providing a level of verbosity, it's inherently clear what the DESCRIPTION variable in Package/bridge is, which wouldn't be the case if we passed this information directly as the Nth argument to BuildPackage.
 +
 +===== PKG_FIXUP =====
 +
 +FIXME
 +
 +Some makefiles need fixup (because of crosscompile bugs ?)
 +
 +
 +<code make>
 +
 +PKG_FIXUP:=autoreconf
 +PKG_FIXUP:=autoreconf -fi
 +PKG_FIXUP:=libtool
 +PKG_FIXUP:=libtool autoreconf
 +PKG_FIXUP:=libtool no-autoreconf
 +PKG_FIXUP:=libtool-ucxx
 +PKG_FIXUP:=patch-libtool
 +
 +</code>
 +
 +TODO What are the differences ?
 +
 +FIXME
===== BuildPackage defines ===== ===== BuildPackage defines =====
Line 113: Line 137:
== Build/Compile (optional) == == Build/Compile (optional) ==
-How to compile the source; in most cases you should leave this undefined.+How to compile the source; in most cases you should leave this undefined, because 
 +then the default is used, which calls make. If you want to pass special arguments 
 +to make, use e.g. "$(call Build/Compile/Default,FOO=bar) 
 + 
 +== Build/Install (optional) == 
 + 
 +How to install the compiled source. The default is to call make install. Again, to 
 +pass special arguments or targets, use $(call Build/Install/Default,install install-foo) 
 +Note that you need put all the needed make arguments here. If you just need to add 
 +something to the "install" argument, don't forget the 'install' itself. 
 + 
 +== Build/InstallDev (optional) == 
 + 
 +For things needed to compile packages against it (static libs, header files), but that are of no use on the target device.
== Package/install == == Package/install ==
-A set of commands to copy files out of the compiled source and into the ipkg +A set of commands to copy files into the ipkg which is represented by the $(1) directory
-which is represented by the $(1) directory.+As source you can use relative paths which will install from the unpacked and compiled 
 +source, or $(PKG_INSTALL_DIR) which is where the files in the Build/Install step above end up.
== Package/preinst == == Package/preinst ==
Line 164: Line 202:
| 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. |
 +
 +==== Host tools required ====
 +If your package needs some private tools built on the host, you can use the following snippet as a pointer of where to look for more info
 +
 +<code make>
 +HOST_BUILD_DEPENDS:=<packagename>/host
 +PKG_BUILD_DEPENDS:=<packagename>/host
 +include $(INCLUDE_DIR)/host-build.mk
 +
 +define Host/Compile
 +define Host/Install
 +
 +$(eval $(call HostBuild))
 +</code>
 +TODO Expand on how to use this, and include examples
 +
 +FIXME
 +
 +Extracted from this thead on the devel mailing list: https://lists.openwrt.org/pipermail/openwrt-devel/2014-February/023970.html
== NOTES == == NOTES ==
Line 291: Line 348:
</code> </code>
-With latest svn/trunk version changes to .mk-files are not seen immediately. Known workaround is to call +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> + 
- rm package/kernel/Makefile; touch package/kernel/linux/Makefile +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> 
-</code> +For example, here is package/madwifi/Makefile:
-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> +
-. For example, here is package/madwifi/Makefile:+
<code> <code>
# #
Line 493: Line 547:
Very basic example of a suitable init.d script Very basic example of a suitable init.d script
 +
 +:!: **procd** style init is used in some init.d scripts since: https://dev.openwrt.org/changeset/38023 .
 +
<code> <code>
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common

Back to top

doc/devel/packages.1372865320.txt.bz2 · Last modified: 2013/07/03 17:28 by woglinde