You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 4.8KB

  1. Each recipe consists of 3 main parts: defining identifiers, setting build
  2. variables, and defining build commands.
  3. The package "mylib" will be used here as an example
  4. General tips:
  5. - mylib_foo is written as $(package)_foo in order to make recipes more similar.
  6. ## Identifiers
  7. Each package is required to define at least these variables:
  8. $(package)_version:
  9. Version of the upstream library or program. If there is no version, a
  10. placeholder such as 1.0 can be used.
  11. $(package)_download_path:
  12. Location of the upstream source, without the file-name. Usually http or
  13. ftp.
  14. $(package)_file_name:
  15. The upstream source filename available at the download path.
  16. $(package)_sha256_hash:
  17. The sha256 hash of the upstream file
  18. These variables are optional:
  19. $(package)_build_subdir:
  20. cd to this dir before running configure/build/stage commands.
  21. $(package)_download_file:
  22. The file-name of the upstream source if it differs from how it should be
  23. stored locally. This can be used to avoid storing file-names with strange
  24. characters.
  25. $(package)_dependencies:
  26. Names of any other packages that this one depends on.
  27. $(package)_patches:
  28. Filenames of any patches needed to build the package
  29. $(package)_extra_sources:
  30. Any extra files that will be fetched via $(package)_fetch_cmds. These are
  31. specified so that they can be fetched and verified via 'make download'.
  32. ## Build Variables:
  33. After defining the main identifiers, build variables may be added or customized
  34. before running the build commands. They should be added to a function called
  35. $(package)_set_vars. For example:
  36. define $(package)_set_vars
  37. ...
  38. endef
  39. Most variables can be prefixed with the host, architecture, or both, to make
  40. the modifications specific to that case. For example:
  41. Universal: $(package)_cc=gcc
  42. Linux only: $(package)_linux_cc=gcc
  43. x86_64 only: $(package)_x86_64_cc = gcc
  44. x86_64 linux only: $(package)_x86_64_linux_cc = gcc
  45. These variables may be set to override or append their default values.
  46. $(package)_cc
  47. $(package)_cxx
  48. $(package)_objc
  49. $(package)_objcxx
  50. $(package)_ar
  51. $(package)_ranlib
  52. $(package)_libtool
  53. $(package)_nm
  54. $(package)_cflags
  55. $(package)_cxxflags
  56. $(package)_ldflags
  57. $(package)_cppflags
  58. $(package)_config_env
  59. $(package)_build_env
  60. $(package)_stage_env
  61. $(package)_build_opts
  62. $(package)_config_opts
  63. The *_env variables are used to add environment variables to the respective
  64. commands.
  65. Many variables respect a debug/release suffix as well, in order to use them for
  66. only the appropriate build config. For example:
  67. $(package)_cflags_release = -O3
  68. $(package)_cflags_i686_debug = -g
  69. $(package)_config_opts_release = --disable-debug
  70. These will be used in addition to the options that do not specify
  71. debug/release. All builds are considered to be release unless DEBUG=1 is set by
  72. the user. Other variables may be defined as needed.
  73. ## Build commands:
  74. For each build, a unique build dir and staging dir are created. For example,
  75. `work/build/mylib/1.0-1adac830f6e` and `work/staging/mylib/1.0-1adac830f6e`.
  76. The following build commands are available for each recipe:
  77. $(package)_fetch_cmds:
  78. Runs from: build dir
  79. Fetch the source file. If undefined, it will be fetched and verified
  80. against its hash.
  81. $(package)_extract_cmds:
  82. Runs from: build dir
  83. Verify the source file against its hash and extract it. If undefined, the
  84. source is assumed to be a tarball.
  85. $(package)_preprocess_cmds:
  86. Runs from: build dir/$(package)_build_subdir
  87. Preprocess the source as necessary. If undefined, does nothing.
  88. $(package)_config_cmds:
  89. Runs from: build dir/$(package)_build_subdir
  90. Configure the source. If undefined, does nothing.
  91. $(package)_build_cmds:
  92. Runs from: build dir/$(package)_build_subdir
  93. Build the source. If undefined, does nothing.
  94. $(package)_stage_cmds:
  95. Runs from: build dir/$(package)_build_subdir
  96. Stage the build results. If undefined, does nothing.
  97. The following variables are available for each recipe:
  98. $(1)_staging_dir: package's destination sysroot path
  99. $(1)_staging_prefix_dir: prefix path inside of the package's staging dir
  100. $(1)_extract_dir: path to the package's extracted sources
  101. $(1)_build_dir: path where configure/build/stage commands will be run
  102. $(1)_patch_dir: path where the package's patches (if any) are found
  103. Notes on build commands:
  104. For packages built with autotools, $($(package)_autoconf) can be used in the
  105. configure step to (usually) correctly configure automatically. Any
  106. $($(package)_config_opts) will be appended.
  107. Most autotools projects can be properly staged using:
  108. $(MAKE) DESTDIR=$($(package)_staging_dir) install