1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-03-01 01:41:52 -05:00

makepkg: provide MAN_DIRS configuration variable

Provides a MAN_DIRS variable in makepkg.conf which can be used
to specify folders to look for manual (man and info) pages to be
compressed.  Useful for packages that install to /opt.  Also
clarifies that "zipman" means "zip manuals" and covers both man
and info pages.

Original work by: Tiago Pierezan Camargo <tcamargo at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2008-11-23 21:17:15 +10:00 committed by Dan McGee
parent b55f478042
commit bb9b19a6c4
3 changed files with 15 additions and 7 deletions

View File

@ -123,13 +123,20 @@ Options
Leave empty directories in packages. Leave empty directories in packages.
*zipman*;; *zipman*;;
Compress man and info pages with gzip. Compress manual (man and info) pages with gzip.
**INTEGRITY_CHECK=(**check1 ...**)**:: **INTEGRITY_CHECK=(**check1 ...**)**::
File integrity checks to use. Multiple checks may be specified; this File integrity checks to use. Multiple checks may be specified; this
affects both generation and checking. The current valid options are: affects both generation and checking. The current valid options are:
`md5`, `sha1`, `sha256`, `sha384`, and `sha512`. `md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
If "zipman" is specified in the OPTIONS array, this variable will
instruct makepkg where to look to compress manual (man and info)
pages. If you build packages that are located in opt/, you may need
to add the directory to this array. *NOTE:* Do not add the leading
slash to the directory name.
**DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**:: **DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**::
If "!docs" is specified in the OPTIONS array, this variable will If "!docs" is specified in the OPTIONS array, this variable will
instruct makepkg where to look to remove docs. If you build packages instruct makepkg where to look to remove docs. If you build packages

View File

@ -65,12 +65,14 @@ BUILDENV=(fakeroot !distcc color !ccache !xdelta)
#-- docs: Save doc and info directories #-- docs: Save doc and info directories
#-- libtool: Leave libtool (.la) files in packages #-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages #-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manpages with gzip #-- zipman: Compress manual (man and info) pages with gzip
# #
OPTIONS=(strip !docs libtool emptydirs zipman) OPTIONS=(strip !docs libtool emptydirs zipman)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5) INTEGRITY_CHECK=(md5)
#-- Manual (man and info) directories to compress (if option set correctly above)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if option set correctly above) #-- Doc directories to remove (if option set correctly above)
DOC_DIRS=(usr/{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) DOC_DIRS=(usr/{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Directories to be searched for the strip option (if option set correctly above) #-- Directories to be searched for the strip option (if option set correctly above)

View File

@ -718,9 +718,8 @@ tidy_install() {
if [ "$(check_option zipman)" = "y" ]; then if [ "$(check_option zipman)" = "y" ]; then
msg2 "$(gettext "Compressing man and info pages...")" msg2 "$(gettext "Compressing man and info pages...")"
local manpage mandirs ext file link hardlinks hl local manpage ext file link hardlinks hl
mandirs=({usr{,/local}{,/share},opt/*}/{man,info}) find ${MAN_DIRS[@]} -type f 2>/dev/null |
find ${mandirs[@]} -type f 2>/dev/null |
while read manpage ; do while read manpage ; do
# check file still exists (potentially compressed with hard link) # check file still exists (potentially compressed with hard link)
if [ -f ${manpage} ]; then if [ -f ${manpage} ]; then
@ -728,7 +727,7 @@ tidy_install() {
file="${manpage##*/}" file="${manpage##*/}"
if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
# update symlinks to this manpage # update symlinks to this manpage
find ${mandirs[@]} -lname "$file" 2>/dev/null | find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null |
while read link ; do while read link ; do
rm -f "$link" rm -f "$link"
ln -sf "${file}.gz" "${link}.gz" ln -sf "${file}.gz" "${link}.gz"
@ -736,7 +735,7 @@ tidy_install() {
# find hard links and remove them # find hard links and remove them
# the '|| true' part keeps the script from bailing if find returned an # the '|| true' part keeps the script from bailing if find returned an
# error, such as when one of the man directories doesn't exist # error, such as when one of the man directories doesn't exist
hardlinks="$(find ${mandirs[@]} \! -name "$file" -samefile "$manpage" 2>/dev/null)" || true hardlinks="$(find ${MAN_DIRS[@]} \! -name "$file" -samefile "$manpage" 2>/dev/null)" || true
for hl in ${hardlinks}; do for hl in ${hardlinks}; do
rm -f "${hl}"; rm -f "${hl}";
done done