性功能下降吃什么药好| 衡于虑的衡什么意思| 辩证法是什么意思| 枕头发黄是什么原因| 备孕需要做什么准备| magnesium是什么意思| 东方明珠什么时候亮灯| 表哥的孩子叫我什么| 血糖高是什么原因引起| 米果念什么| 芒果什么人不能吃| 胃气胃胀吃什么药最好| 年轮是什么意思| 材料化学属于什么类| 鱼生是什么鱼| 高血压中医叫什么| 为什么体检前不能喝水| 丙酮是什么| 小孩睡觉磨牙是什么原因引起的| 舌根发黑是什么原因| 溪字五行属什么| 尿结石是什么症状| 男性夜间盗汗是什么原因| 梗米是什么米| 乙丑是什么生肖| 尿素偏高是什么原因| 吃什么最补血而且最快| 重庆以前叫什么| 女排精神是什么| 于谦为什么加入国民党| 法国的国花是什么花| 梅花三弄的三弄指什么| 手机卡顿是什么原因| 生什么什么什么| 11.15是什么星座| 摸胸是什么感觉| 什么都不想做| 牛大力是什么| 梦见狼狗是什么预兆| 尿结石吃什么药| 垂体泌乳素是什么意思| 上当是什么意思| 888是什么意思| 什么是省控线| 梦见被蛇咬了是什么意思| 中气是什么意思| 祭坛是什么意思| 牛肉饺子配什么菜好吃| esd手术是什么意思| 碱性食物对身体有什么好处| 就让我爱你把你捧在手心里是什么歌| 猪儿虫是什么意思| 女人什么时候停经| 白玉菩提是什么材质| 手机暂停服务是什么意思| 噬血细胞综合征是什么病| 手脚心热是什么原因| 孕妇为什么不能吃西瓜| 更年期失眠吃什么药调理效果好| t11椎体在什么位置| 精氨酸是什么| 211和985是什么意思| 情绪高涨是什么意思| 人中长痘痘是什么原因| 胎儿头围偏大什么原因| 梦见和婆婆吵架是什么意思| 莲蓬什么季节成熟| 毛血旺是什么| 杏仁有什么营养| 中国第一个不平等条约是什么| 晚餐吃什么菜谱大全| 盛情难却是什么意思| 韬的意思是什么| 背疼是什么原因引起的女人| 吃南瓜有什么好处和坏处| 脂肪肝吃什么药治疗| 吉人自有天相什么意思| 天肖是什么生肖| 日柱灾煞是什么意思| 原发性和继发性是什么意思| 七月初七是什么生肖| 哑巴是什么原因造成的| 缺镁吃什么食物补充最快| 愈合是什么意思| 四季不安痣是什么意思| 函询是什么意思| 小哥哥是什么意思| 定坤丹适合什么人吃| 鸡拉绿色粪便是什么病| 脱肛是什么样子的| 弓箭是什么时候发明的| 土黄色裤子配什么颜色上衣| 感冒口苦是什么原因| 番薯是什么| 近义词是什么意思| 低烧头疼吃什么药| 吃什么能瘦| 尿酸高有什么反应| 高五行属什么| 引流是什么意思| 手发热是什么原因| 自助是什么意思| 荠菜长什么样子图片| 妹妹的女儿叫什么| 梦见小男孩拉屎是什么意思| 胸膜炎什么症状| 梦见苹果是什么意思| 鼻炎是什么| 谷雨是什么季节| 990金是什么金| 每天喝奶茶有什么危害| 四平八稳是什么意思| 晕车吃什么能缓解| 无名指比中指长代表什么| 诱惑是什么意思| 左顾右盼的顾是什么意思| 银屑病吃什么食物最好| 杭州有什么好玩的地方| 感冒头疼是什么原因| 8月15日什么星座| 10月21日是什么星座| 影射是什么意思| 增强免疫力的针叫什么| 什么的快乐| 什么手机拍照效果最好| 有的没的是什么意思| 茉莉茶叶属于什么茶| 海马是什么动物| 胃有问题挂什么科| 多动症是什么原因造成| 丞相和宰相有什么区别| 坚信的意思是什么| 肾阳虚女性什么症状| 6.15是什么日子| 更年期出虚汗吃什么药| 胚由什么组成| 什么是雾霾| 椰子什么时候成熟| 腮腺炎吃什么食物| 雁过拔毛是什么意思| 血小板计数偏高是什么原因| 叶子发黄是什么原因| 40岁属什么生肖| 脚疼挂什么科| 窦房结是什么意思| 5月22日是什么星座| 眼睛干涩疲劳用什么眼药水| 同仁什么意思| 什么蚊子咬人| 家去掉一点念什么| 这是什么病| 人类免疫缺陷病毒是什么| 血常规异常是什么意思| 烦恼千千是什么生肖| 逆钟向转位是什么意思| 什么样的细雨| 棕色短裤配什么颜色上衣| 眼白发黄是什么原因| 岳飞为什么必须死| 中元节会开什么生肖| 紫萱名字的含义是什么| 舞蹈症是什么病| 什么叫咳嗽变异性哮喘| 12月21是什么星座| 鸡炖什么好吃又有营养| 什么时间运动减肥效果最好| 光是什么颜色| sm是什么意思啊| mlb是什么档次| 红对什么| 什么叫浮小麦| 72年属什么的生肖| 梦到喝酒是什么意思| 荧光黄是什么颜色| 鳄鱼怕什么| 生目念什么| 有伤口吃什么消炎药| 地球为什么叫地球| 不可小觑什么意思| 胃酸恶心想吐什么原因| 牙龈萎缩用什么牙膏好| 早泄是什么意思| 乳房结节是什么原因引起的| 什么猫最好养| 什么是血管瘤| 惯犯是什么意思| 世界上最大的东西是什么| 喝什么牌子的水最健康| 杜仲配什么补肾最好| 肺火旺吃什么药最有效| 桃胶有什么功效与作用| 今年28岁属什么生肖| 手指甲上的月牙代表什么| 藏红花适合什么样的人喝| other什么意思| 尿胆原阴性是什么意思| 伤到骨头吃什么好得快| 涟漪是什么意思| 生理期腰疼是什么原因| 房颤什么意思| 淋巴结稍大是什么意思| 神经内科主要看什么病| 手足口是什么病毒| 大便排不出来是什么原因| 1942年属什么生肖| goldlion是什么牌子| 生日送什么花合适| 椎间盘膨隆是什么意思| 胃间质瘤是什么性质的瘤| 泰勒为什么叫霉霉| 什么叫柏拉图式的爱情| 十一月是什么星座| 包皮龟头炎用什么药| 痛经吃什么水果能缓解疼痛| 日柱灾煞是什么意思| 尿酸高是什么情况| 肿瘤病人不能吃什么| 为什么身上一热就痒| hl什么意思| 吃什么对肺结节好| 现充什么意思| 全品类是什么意思| 备孕前吃什么调理身体| 刻舟求剑的意思是什么| 血糖高可以吃什么蔬菜| 早上打嗝是什么原因呢| 77年的蛇是什么命| 脉搏低是什么原因| 盆腔炎吃什么药有效| 曹操姓什么| 要强是什么意思| 清洁度三度是什么炎症| 骨髓水肿是什么意思| 2011是什么年| 为什么会偏头痛| 膝盖积水是什么原因造成的| 眼睛总有眼屎是什么原因| 橙色五行属什么| 普洱茶什么牌子好| 业力什么意思| oc是什么意思| fpa是什么意思| 狗篮子什么意思| 11五行属什么| 宫外孕有什么症状| 跟腱断裂是什么感觉| 卡鱼刺去医院挂什么科| 蒲公英的种子像什么| 匮乏是什么意思| 阴道感染有什么症状| 什么是姑息治疗| 卒中优先是什么意思| dhc是什么牌子| 宫外孕和宫内孕有什么区别| x是什么品牌| dr是什么意思| 叶字五行属什么| 为什么天天晚上做梦| 气节是什么意思| 内分泌失调吃什么药| 乌纱帽是什么意思| 米线里的麻油是什么油| 什么是负氧离子| 心水是什么意思| 百度
Jump to content

用车最常见的汽车故障都有哪些?看看别“带病

From ArchWiki
百度 1080位传灯志愿者相聚五台山大智路,共同攀登1080级陡峭台阶,点亮心灯,求增智慧;唐山大地震40周年纪念日,河北佛协、唐山佛协发起倡议,不同国家和地区,不同传承和语系的佛教寺院,于7月28日当天均举办一场佛事活动,超度大地震逝去的生命,共同祈愿世界和平、人民安乐。

makepkg is a script to automate the building of packages. The requirements for using the script are a build-capable Unix platform and a PKGBUILD.

makepkg is provided by the pacman package.

Configuration

The system configuration is available in /etc/makepkg.conf, but user-specific changes can be made in $XDG_CONFIG_HOME/pacman/makepkg.conf or ~/.makepkg.conf. Also, system wide changes can be made with a drop-in file /etc/makepkg.conf.d/makepkg.conf. It is recommended to review the configuration prior to building packages.

Tip devtools helper scripts for building packages in a clean chroot use the /usr/share/devtools/makepkg.conf.d/arch.conf configuration file instead.

See makepkg.conf(5) for more information.

Packager information

Each package is tagged with metadata identifying amongst others also the packager. By default, user-compiled packages are marked with Unknown Packager. If multiple users will be compiling packages on a system, or if one is otherwise distributing packages to other users, it is convenient to provide real contact. This can be done by setting the PACKAGER variable in makepkg.conf.

To check this on an installed package:

$ pacman -Qi package
...
Packager       : John Doe <john@doe.com>
...

To automatically produce signed packages, also set the GPGKEY variable in makepkg.conf.

Package output

By default, makepkg creates the package tarballs in the working directory and downloads source data directly to the src/ directory. Custom paths can be configured, for example to keep all built packages in ~/build/packages/ and all sources in ~/build/sources/.

Configure the following makepkg.conf variables if needed:

  • PKGDEST — directory for storing resulting packages
  • SRCDEST — directory for storing source data (symbolic links will be placed to src/ if it points elsewhere)
  • SRCPKGDEST — directory for storing resulting source packages (built with makepkg -S)
Tip The PKGDEST directory can be cleaned up with e.g. paccache -c ~/build/packages/ as described in pacman#Cleaning the package cache.

You can also use relative paths inside each package directory.

Signature checking

Note The signature checking implemented in makepkg does not use pacman's keyring, instead relying on the user's keyring.[1]

If a signature file in the form of .sig or .asc is part of the PKGBUILD source array, makepkg automatically attempts to verify it. In case the user's keyring does not contain the needed public key for signature verification, makepkg will abort the installation with a message that the PGP key could not be verified.

If a needed public key for a package is missing, the PKGBUILD will most likely contain a validpgpkeys entry with the required key IDs. Import it manually, or find it on a keyserver and import it from there. To temporarily disable signature checking, run makepkg with the --skippgpcheck option.

Usage

Before continuing, install the base-devel meta package. Dependencies of this package are not required to be listed as build-time dependencies (makedepends) in PKGBUILD files.

Note
  • Make sure sudo is configured properly for commands passed to pacman. Alternatively a different authorization command can be specified with PACMAN_AUTH in the makepkg.conf(5) configuration file.
  • Running makepkg itself as root is disallowed.[2] Besides how a PKGBUILD may contain arbitrary commands, building as root is generally considered unsafe.[3] Users who have no access to a regular user account should run makepkg as the nobody user, e.g. using the command runuser -u nobody makepkg.

To build a package, one must first create a PKGBUILD, or build script, as described in Creating packages. Existing scripts are available from the Arch build system (ABS) tree or the AUR. Once in possession of a PKGBUILD, change to the directory where it is saved and run the following command to build the package:

$ makepkg

If required dependencies are missing, makepkg will issue a warning before failing. To build the package and install needed dependencies, add the flag -s/--syncdeps:

$ makepkg --syncdeps

Adding the -r/--rmdeps flag causes makepkg to remove the make dependencies later, which are no longer needed. If constantly building packages, consider using Pacman/Tips and tricks#Removing unused packages (orphans) once in a while instead.

Note
  • These dependencies must be available in the configured repositories; see pacman#Repositories and mirrors for details. Alternatively, one can manually install dependencies prior to building (pacman -S --asdeps dep1 dep2).
  • Only global values are used when installing dependencies, i.e any override done in a split package's packaging function will not be used.

Once all dependencies are satisfied and the package builds successfully, a package file (pkgname-pkgver.pkg.tar.zst) will be created in the working directory. To install, use -i/--install (same as pacman -U pkgname-pkgver.pkg.tar.zst):

$ makepkg --install

To clean up leftover files and directories, such as files extracted to the $srcdir, add the option -c/--clean. This is useful for multiple builds of the same package or updating the package version, while using the same build directory. It prevents obsolete and remnant files from carrying over to the new builds:

$ makepkg --clean

For more, see makepkg(8).

Optimization

The default options match the options devtools uses to build packages for the official repositories.[4] As such, end users may realize more or less significant gains by tweaking the following options to match their local environment.

Building optimized binaries

A performance improvement of the packaged software can be achieved by enabling compiler optimizations for the host machine. The downside is that binaries compiled for a specific processor architecture will not run correctly on other machines. On x86_64 machines, there are rarely significant enough real world performance gains that would warrant investing the time to rebuild official packages.

However, it is very easy to reduce performance by using "nonstandard" compiler flags. Many compiler optimizations are only useful in certain situations and should not be indiscriminately applied to every package. Unless benchmark data are available to prove that something is faster, there is a very good chance it is not! The Gentoo GCC optimization and Safe CFLAGS wiki articles provide more in-depth information about compiler optimization.

C and C++

The options passed to a C/C++ compiler (e.g. gcc or clang) are controlled by the CFLAGS, CXXFLAGS, and CPPFLAGS environment variables. For use in the Arch build system, makepkg exposes these environment variables as configuration options in makepkg.conf. The default values are configured to produce generic binaries that can be installed on a wide range of machines.

Note
  • Keep in mind that not all build systems use the variables configured in makepkg.conf. For example, cmake disregards the preprocessor options environment variable, CPPFLAGS. Consequently, many PKGBUILDs contain workarounds with options specific to the build system used by the packaged software.
  • The configuration provided with the source code in the Makefile or a specific argument in the compilation command line takes precedence and can potentially override the one in makepkg.conf.

GCC can automatically detect and enable safe architecture-specific optimizations. To use this feature, first remove any -march and -mtune flags, then add -march=native. For example:

/etc/makepkg.conf
CFLAGS="-march=native -O2 -pipe ..."
CXXFLAGS="${CFLAGS} ..."

To see what flags this enables, run:

$ gcc -march=native -v -Q --help=target
Note Specifying different values instead of -march=native, then -Q --help=target will not work as expected.[5] To find out which options are really enabled, go through a compilation. See Gentoo:Safe CFLAGS#Manual for instructions.

Further optimization of binaries can be achieved by enabling optimizations that are considered expensive in terms of memory usage and compile time. This can be achieved by changing the optimization level flag from -O2 to -O3. Using this flag will in most cases improve the performance of the binary, although this is not guaranteed and depends on the binary. See Gentoo:GCC optimization#-O and GCC optimization options page for details.

Rust

Starting in pacman version 5.2.2, makepkg.conf also includes overrides for the RUSTFLAGS environment variable, for flags given to the Rust compiler. The Rust compiler can also detect and enable architecture-specific optimizations by adding -C target-cpu=native to the given RUSTFLAGS value:

/etc/makepkg.conf.d/rust.conf
RUSTFLAGS="-C force-frame-pointers=yes -C target-cpu=native"

To see which CPU features this will enable, run:

$ rustc -C target-cpu=native --print cfg

Running --print cfg without -C target-cpu=native will print the default configuration.

Additional optimization-related options that may be added to RUSTFLAGS:

  • -C opt-level=3: The value can be changed to 3, s, or z as desired. opt-level=3 is default of release build.
  • -c codegen-units=n: Choosing n less than 16 also optimizes binary, but using n less than number of cores will increase build time.
  • -C link-arg=-z -C link-arg=pack-relative-relocs reduces size of the binary.

See the Rust compiler's documentation for details.

Improving build times

Parallel compilation

The make build system uses the MAKEFLAGS environment variable to specify additional options for make. The variable can also be set in the makepkg.conf file.

Users with multi-core/multi-processor systems can specify the number of jobs to run simultaneously. This can be accomplished with the use of nproc(1) to determine the number of available processors, e.g. MAKEFLAGS="--jobs=$(nproc)".

Some PKGBUILDs specifically override this with -j1, because of race conditions in certain versions or simply because it is not supported in the first place. Packages that fail to build because of this should be reported on the bug tracker (or in the case of AUR packages, to the package maintainer) after making sure that the error is indeed being caused by MAKEFLAGS.

See make(1) for a complete list of available options.

Building from files in memory

As compiling requires many I/O operations and handling of small files, moving the working directory to a tmpfs may bring improvements in build times.

The BUILDDIR variable can be temporarily exported to makepkg to set the build directory to an existing tmpfs. For example:

$ BUILDDIR=/tmp/makepkg makepkg

Persistent configuration can be done in makepkg.conf by uncommenting the BUILDDIR option, which is found at the end of the BUILD ENVIRONMENT section in the default /etc/makepkg.conf file. Setting its value to e.g. BUILDDIR=/tmp/makepkg will make use of the Arch's default /tmp temporary file system.

Note
  • Avoid compiling larger packages in tmpfs to prevent running out of memory.
  • The tmpfs directory must be mounted without the noexec option, otherwise it will prevent built binaries from being executed.
  • Keep in mind that packages compiled in tmpfs will not persist across reboot. Consider setting the PKGDEST option appropriately to move the built package automatically to a persistent directory.

Using a compilation cache

The use of ccache can improve build times by caching the results of compilations for successive use.

Using mold linker

mold is a drop-in replacement for ld/lld linkers, which claims to be significantly faster.

To use mold, append -fuse-ld=mold to LDFLAGS. For example:

/etc/makepkg.conf
LDFLAGS="... -fuse-ld=mold"

To pass extra options to mold, additionally add those to LDFLAGS. For example:

/etc/makepkg.conf
LDFLAGS="... -fuse-ld=mold -Wl,--separate-debug-file"

To use mold for Rust packages, append -C link-arg=-fuse-ld=mold to RUSTFLAGS. For example:

/etc/makepkg.conf.d/rust.conf
RUSTFLAGS="... -C link-arg=-fuse-ld=mold"

Disable debug packages and LTO

Commit 90bf367e included in pacman 6.0.2-9 from February 2024 enabled the debug and lto options by default.

Building debug packages enables the official repositories to provide more tools to troubleshoot issues for users (archlinux/packaging/packages/pacman#23#note_173528), but it is not required when building packages on your own and slows down the build process. See archlinux/packaging/packages/pacman#23#note_173782.

Link-time optimization produces more optimized binaries but greatly lengthens the build process (archlinux/packaging/packages/pacman#23#note_173678), which might not be a desired tradeoff.

To disable those options, add a ! character directly in front of them in the OPTIONS=() array, e.g. OPTIONS=(...!debug !lto...).

Compression

Use other compression algorithms

To speed up both packaging and installation, with the tradeoff of having larger package archives, change PKGEXT.

For example, the following skips compression of the package file, which will in turn have no need to be decompressed on install:

$ PKGEXT='.pkg.tar' makepkg

As another example, the following uses the LZ4 algorithm, which is focused on speed:

$ PKGEXT='.pkg.tar.lz4' makepkg

To make one of these settings permanent, set PKGEXT in /etc/makepkg.conf.

Utilizing multiple cores on compression

zstd supports symmetric multiprocessing (SMP) via the -T/--threads flag to speed up compression. The -T0 flag is included by default in the COMPRESSZST array in /etc/makepkg.conf, which lets zstd use as many threads as there are physical CPU cores to compress packages. The number of used threads can be further increased by instructing zstd to base it on the logical CPU count using the --auto-threads=logical flag:

COMPRESSZST=(zstd -c -T0 --auto-threads=logical -)

lz4 and xz are multithreaded by default, so nothing needs to be changed in /etc/makepkg.conf.

pigz is a drop-in, parallel implementation for gzip which by default uses all available CPU cores (the -p/--processes flag can be used to employ less cores):

COMPRESSGZ=(pigz -c -f -n)

pbzip2 is a drop-in, parallel implementation for bzip2 which also uses all available CPU cores by default. The -p# flag can be used to employ less cores (note: no space between the -p and number of cores).

COMPRESSBZ2=(pbzip2 -c -f)

lbzip2 is another drop-in, parallel implementation for bzip2 which also uses all available CPU cores by default. The -n flag can be used to employ less cores.

COMPRESSBZ2=(lbzip2 -c -f)

plzipAUR is a multithreaded implementation for lzip which also uses all available CPU cores by default. The -n/--threads flag can be used to employ less cores.

COMPRESSLZ=(plzip -c -f)

Changing compression level

Several compression algorithms (including zstd and xz) support setting a compression level which defines a tradeoff between speed, memory and compression efficiency.

Tips and tricks

Reduce source download and extraction times

Defining the sources location

Make use of SRCDEST, especially when building VCS packages, to save time acquiring and unpacking sources in subsequent rebuilds.

Generate new checksums

Install pacman-contrib and run the following command in the same directory as the PKGBUILD file to generate new checksums:

$ updpkgsums

updpkgsums uses makepkg --geninteg to generate the checksums. See this forum discussion for more details.

The checksums can also be obtained with e.g sha256sum and added to the sha256sums array by hand.

Build from local source files

If you want to make changes to the source code you can download the source code without building the package by using the -o, --nobuild Download and extract files only option.

$ makepkg -o

You can now make changes to the sources and then build the package by using the -e, --noextract Do not extract source files (use existing $srcdir/ dir) option. Use the -f option to overwrite already built and existing packages.

$ makepkg -ef

Show packages with specific packager

expac is a pacman database extraction utility. This command shows all packages installed on the system with the packager named packagername:

$ expac "%n %p" | grep "packagername" | column -t

This shows all packages installed on the system with the packager set in the /etc/makepkg variable PACKAGER. This shows only packages that are in a repository defined in /etc/pacman.conf.

$ . /etc/makepkg.conf; grep -xvFf <(pacman -Qqm) <(expac "%n\t%p" | grep "$PACKAGER$" | cut -f1)

Build 32-bit packages on a 64-bit system

See 32-bit package guidelines.

Unattended package signing

This article or section is a candidate for merging with GnuPG#Unattended_passphrase.

Notes: This is not specific to makepkg. (Discuss in Talk:Makepkg)

This article or section needs expansion.

Reason: Another option is gpg-preset-passphrase(1) (Discuss in Talk:Makepkg)

A person may not be available to provide the passphrase for the gpg private key used to sign with in automated build environments such as Jenkins. It is ill-advised to store a private gpg key on a system without a passphrase.

A resulting zst package made with makepkg can still be signed after creation:

$ gpg --detach-sign --pinentry-mode loopback --passphrase --passphrase-fd 0 --output NewlyBuilt.pkg.tar.zst.sig --sign NewlyBuilt.pkg.tar.zst 

where the GPG passphrase is securely provided and obscured by your automation suite of choice.

The resulting zst and sig file can be referenced by pacman clients expecting a valid signature and repositories created with repo-add --sign when hosting your own repo.

Magnet URIs

Support for magnet URIs resources (with magnet:// prefix) in the source field can be added using the transmission-dlagentAUR download agent.

Running makepkg in a systemd control group

If the package you are building takes too many resources to build with your default make flags, which are otherwise set properly for most packages, you can try running it in its own control group. makepkg-cgAUR is a wrapper for makepkg that achieved this via systemd control groups (see systemd.resource-control(5)).

Running with idle scheduling policy

Package build process can lead to high CPU utilization, especially in case of #Parallel compilation. Under heavy CPU load, the system can issue a significant slowdown up to becoming unusable, even with the highest nice(1) value. User interface and foreground applications may stutter or even became unresponsive.

This can be worked around by changing the scheduling policy to SCHED_IDLE before running makepkg. It ensures that package building process does not interfere with regular tasks and only utilizes remaining unused CPU time.

From sched(7) § SCHED_IDLE: Scheduling very low priority jobs:

This policy is intended for running jobs at extremely low priority (lower even than a +19 nice value with the SCHED_OTHER or SCHED_BATCH policies).

The SCHED_IDLE policy can be set by running chrt(1) command with the -i flag, specifying priority 0 (the only valid option for SCHED_IDLE) and specifying the PID of the current shell.

For most shells:

$ chrt -iap 0 $$
Tip You can apply this command for every build by placing it into makepkg.conf.

For the fish shell, where $$ is not set:

$ chrt -iap 0 %self

Relative paths inside each package directory

Instead of using absolute paths for the package output options, you can also configure relative paths inside each package directory.

Note The following options might cause problems with some AUR helpers, as they might use makepkg.conf in a context where $startdir is not defined. So be careful.

For example, you can define target paths in your makepkg.conf file as follows. The $startdir variable refers to the directory where a PKGBUILD is located when you build a package.

PKGDEST="$startdir/build/packages/"
SRCDEST="$startdir/build/sources/"
SRCPKGDEST="$startdir/build/srcpackages/"
LOGDEST="$startdir/logs/"

This will result in:

  • Built packages will be stored in: "package directory"/build/packages/
  • All downloaded source files will be stored in: "package directory"/build/sources/
  • Built source packages will be stored in: "package directory"/build/srcpackages/
  • All logs will be stored in: "package directory"/logs/

makepkg will still create src/ and pkg/ directories as usual, so this is expected behaviour.

Troubleshooting

Specifying install directory for QMAKE based packages

The makefile generated by qmake uses the environment variable INSTALL_ROOT to specify where the program should be installed. Thus this package function should work:

PKGBUILD
...
package() {
	cd "$srcdir/${pkgname%-git}"
	make INSTALL_ROOT="$pkgdir" install
}
...

Note, that qmake also has to be configured appropriately. For example put this in the corresponding .pro file:

YourProject.pro
...
target.path = /usr/local/bin
INSTALLS += target
...

WARNING: Package contains reference to $srcdir

Somehow, the literal strings contained in the variables $srcdir or $pkgdir ended up in one of the installed files in the package. [6]

To identify which files, run the following from the makepkg build directory:

$ grep -R "$PWD/src" pkg/

One possible cause would be from the usage of __FILE__ macro in C/C++ code with full path passed to compiler.

Dotnet binaries also sometimes contain full paths to the .pdb files in the default config.

Makepkg fails to download dependencies when behind proxy

When makepkg calls dependencies, it calls pacman to install the packages, which requires administrative privileges via sudo. However, sudo does not pass any environment variables to the privileged environment, and includes the proxy-related variables ftp_proxy, http_proxy, http_proxy, and no_proxy.

In order to have makepkg working behind a proxy, invoke one of the following methods.

Enable proxy by setting its URL in XferCommand

The XferCommand can be set to use the desired proxy URL in /etc/pacman.conf. Add or uncomment the following line in pacman.conf:

/etc/pacman.conf
...
XferCommand = /usr/bin/curl --proxy http://username:password@proxy.proxyhost.com:80 --location --continue-at - --fail --output %o %u
...

Enable proxy via sudoer's env_keep

Alternatively, one may want to use sudoer's env_keep option, which enables preserving given variables the privileged environment. See Pacman#Pacman does not honor proxy settings for more details.

Makepkg fails, but make succeeds

If something successfully compiles using make, but fails through makepkg, it is almost certainly because /etc/makepkg.conf sets an incompatible compilation variable. Try adding these flags to the PKGBUILD options array:

!buildflags, to prevent its default CPPFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS.

!makeflags, to prevent its default MAKEFLAGS.

!debug, to prevent its default DEBUG_CFLAGS, and DEBUG_CXXFLAGS, in case the PKGBUILD is a debug build.

If any of these fix the problem, this could warrant an upstream bug report assuming the offending flag has been identified.

See also

粒细胞低是什么原因 女性下体长什么样 脾胃不好吃什么药 什么叫牙冠 根管治疗是什么意思
血脂高吃什么食物最好 甲状腺一般吃什么药 雪莲果什么季节成熟 不可小觑什么意思 耳洞为什么会发臭
圣诞节的礼物什么时候送 蹦蹦跳跳的动物是什么生肖 全可以加什么偏旁 为什么手脚老是出汗 红艳煞是什么意思
高血脂看什么科 心脏什么情况下需要支架 什么是生活 心电图低电压什么意思 扎是什么意思
血脂稠是什么原因造成的hcv8jop2ns8r.cn 蚊子是什么动物inbungee.com 夏天吹什么风hcv8jop2ns4r.cn 喝酒前吃什么不容易醉又不伤胃jiuxinfghf.com 深耕是什么意思hcv8jop9ns5r.cn
什么是信仰hcv9jop2ns4r.cn 肠胃炎能吃什么水果hcv8jop7ns2r.cn 走路腰疼是什么原因hcv9jop1ns7r.cn 萝卜干炒什么好吃hcv7jop9ns6r.cn 牛奶有什么营养hcv7jop5ns5r.cn
美女胸部长什么样hcv9jop4ns0r.cn 遗精什么意思mmeoe.com 尿路感染喝什么药gangsutong.com 属马的本命佛是什么佛hcv7jop5ns1r.cn 尿检红细胞高是什么原因hcv8jop2ns1r.cn
胃泌素17是什么检查hcv9jop6ns0r.cn 小肠疝气挂什么科hcv9jop4ns3r.cn 盘核桃有什么好处hcv8jop5ns1r.cn 痛风能喝什么饮料hcv9jop7ns5r.cn 干咳吃什么药效果好hcv9jop5ns7r.cn
百度