summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Popov <pinkbyte@gentoo.org>2013-07-12 00:15:33 +0000
committerSergey Popov <pinkbyte@gentoo.org>2013-07-12 00:15:33 +0000
commit765320671ea2423169c278aa78096a0efb72095b (patch)
tree154d81819933cd5fc414eb3264c6f416d4235ec5 /dev-util/lafilefixer/files
parentadd threads as an optional use dep (diff)
downloadgentoo-2-765320671ea2423169c278aa78096a0efb72095b.tar.gz
gentoo-2-765320671ea2423169c278aa78096a0efb72095b.tar.bz2
gentoo-2-765320671ea2423169c278aa78096a0efb72095b.zip
Lastrite dev-util/lafilefixer, wrt bug #289899
Diffstat (limited to 'dev-util/lafilefixer/files')
-rw-r--r--dev-util/lafilefixer/files/lafilefixer-0.0.189
-rw-r--r--dev-util/lafilefixer/files/lafilefixer-0.5203
2 files changed, 0 insertions, 292 deletions
diff --git a/dev-util/lafilefixer/files/lafilefixer-0.0.1 b/dev-util/lafilefixer/files/lafilefixer-0.0.1
deleted file mode 100644
index 09a9cb91bd5e..000000000000
--- a/dev-util/lafilefixer/files/lafilefixer-0.0.1
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-
-# Libtool does not support spaces in dependency_libs entries
-# so we won't worry overly about them either.
-
-fix_la_files() {
- if ! grep --help &> /dev/null
- then
- echo "Grep not functional. Aborting."
- return 1
- elif ! sed --help &> /dev/null
- then
- echo "Sed not functional. Aborting."
- return 1
- elif ! uniq --help &> /dev/null
- then
- echo "Uniq not functional. Aborting."
- elif ! sort --help &> /dev/null
- then
- echo "Sort not functional. Aborting."
- fi
- declare lafile
- for lafile in "$@"
- do
- local dependency_libs=""
- local inh_link_flags=""
- local new_dep_libs=""
- local libladir=""
- local librpath=""
- local dep_libs=""
- local lib=""
-
- dep_libs="$(grep '^dependency_libs=' $lafile)"
- dep_libs="${dep_libs#dependency_libs=\'}"
- dep_libs="${dep_libs%\'}"
-
- inh_link_flags="$(grep '^inherited_linker_flags=' $lafile)"
- inh_link_flags="${inh_link_flags#inherited_linker_flags=\'}"
- inh_link_flags="${inh_link_flags%\'}"
-
-
- for entry in $dep_libs
- do
- if [[ "${entry#-L}" != "${entry}" ]]
- then
- [[ ${entry/X11R6\/lib} != ${entry} ]] && entry="${entry/X11R6\/}"
- [[ ${entry/local\/lib} != ${entry} ]] && entry="${entry/local\/}"
- [[ ${entry/usr\/lib*\/pkgconfig\/..\/..} != ${entry} ]] && entry="${entry/\/lib*\/pkgconfig\/..\/..}"
- [[ ${entry/usr\/lib*\/pkgconfig\/..} != ${entry} ]] && entry="${entry/\/pkgconfig\/..}"
- libladir="${libladir} ${entry}"
- elif [[ "${entry#-R}" != "${entry}" ]]
- then
- librpath="${librpath} ${entry}"
- elif [[ "${entry#-l}" != "${entry}" ]]
- then
- new_dep_libs="${new_dep_libs} ${entry}"
- elif [[ "${entry%.la}" != "${entry}" ]]
- then
- libladir="${libladir} -L${entry%/*.la}"
- lib="${entry%.la}"
- lib="${lib##*\/lib}"
- lib="-l${lib}"
- new_dep_libs="${new_dep_libs} ${lib}"
-
- elif [[ "${entry}" == "-pthread" ]]
- then
- if [[ ${inh_link_flags} != *-pthread* ]]
- then
- inh_link_flags="${inh_link_flags} -pthread"
- fi
- else
- echo $lafile
- echo "${entry}"
- echo "Holy Moley, Dorothy, we ain't in Kansas and Luke, I'm not your father"
- return 1
- fi
- done
- libladir=( $(printf '%s' "$(for i in ${libladir}; do printf '%s\n' $i; done)"|sort|uniq) )
- librpath=( $(printf '%s' "$(for i in ${librpath}; do printf '%s\n' $i; done)"|sort|uniq) )
- new_dep_libs=( ${librpath[@]} ${libladir[@]} ${new_dep_libs} )
- new_dep_libs=" ${new_dep_libs[@]}"
- sed -i \
- -e "/^dependency_libs/ c\dependency_libs='${new_dep_libs}'" \
- -e "/^inherited_linker_flags/ c\inherited_linker_flags='${inh_link_flags}'" \
- ${lafile}
- done
-}
-
-fix_la_files "$@"
diff --git a/dev-util/lafilefixer/files/lafilefixer-0.5 b/dev-util/lafilefixer/files/lafilefixer-0.5
deleted file mode 100644
index 6ff808819728..000000000000
--- a/dev-util/lafilefixer/files/lafilefixer-0.5
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/bin/bash
-
-# Libtool does not support spaces in dependency_libs entries so we won't worry
-# overly about them either.
-
-NEWLINE="
-"
-
-has() {
- [[ " ${*:2} " == *" $1 "* ]]
-}
-
-fix_la_files() {
- local lafile
- for lafile in "${@:2}"
- do
- local has_inh_link_flags="no"
- local new_inh_link_flags=""
- local dependency_libs=""
- local inh_link_flags=""
- local has_dep_libs="no"
- local new_dep_libs=""
- local remove_lib=""
- local contents="$(<"${lafile}")"
- local libladir=""
- local librpath=""
- local dep_libs=""
- local line=""
- local lib=""
-
-
- save_IFS="${IFS}"
- IFS="$NEWLINE"
- for line in $contents
- do
- if [[ "${line#dependency_libs=\'}" != "${line}" ]]
- then
- [[ "$has_dep_libs" == "no" ]] || { echo "dependency_libs= assigned more than once in $lafile" && return 1 ; }
- line="${line#dependency_libs=\'}"
- dep_libs="${line%\'}"
- has_dep_libs="yes"
-
- elif [[ "${line#inherited_linker_flags=\'}" != "${line}" ]]
- then
-
- [[ "$has_inh_link_flags" == "no" ]] || { echo "inherited_linker_flags= assigned more than once in $lafile" && return 1 ; }
- line="${line#inherited_linker_flags=\'}"
- inh_link_flags="${line%\'}"
- new_inh_link_flags="${inh_link_flags}"
- has_inh_link_flags="yes"
- fi
- done
- IFS="$save_IFS"
-
- if [[ "$has_dep_libs" == "no" ]]
- then
- printf '%s\n' "$lafile is not a .la file. Skipping."
- continue
- fi
-
- for entry in $dep_libs
- do
- case $entry in
- -l*)
- has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}"
- ;;
- *.la)
-
- if [[ "${entry##*\/lib}" == "${entry}" ]]
- then
- has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}"
- else
- lib="${entry##*\/lib}"
- lib="${lib%.la}"
- lib="-l${lib}"
- has ${lib} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${lib}"
- has -L${entry%/*.la} ${libladir} || libladir="${libladir} -L${entry%/*.la}"
- fi
- ;;
- -L*)
- [[ ${entry/X11R6\/lib} != ${entry} ]] && entry="${entry/X11R6\/}"
- [[ ${entry/local\/lib} != ${entry} ]] && entry="${entry/local\/}"
- [[ ${entry/usr\/lib*\/pkgconfig\/..\/..} != ${entry} ]] && entry="${entry/\/lib*\/pkgconfig\/..\/..}"
- [[ ${entry/usr\/lib*\/pkgconfig\/..} != ${entry} ]] && entry="${entry/\/pkgconfig\/..}"
- has ${entry} ${libladir} || libladir="${libladir} ${entry}"
- ;;
- -R*)
- has ${entry} ${librpath} || librpath="${librpath} ${entry}"
- ;;
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
- if [[ "${has_inh_link_flags}" == "yes" ]]
- then
- has ${entry} ${new_inh_link_flags} || new_inh_link_flags="${new_inh_link_flags} ${entry}"
- else
- has ${entry} ${new_dep_libs} || new_dep_libs="${new_dep_libs} ${entry}"
- fi
- ;;
- *)
- echo "Debug information:"
- echo $lafile
- echo "${entry}"
- echo "Holy Moley, Dorothy, we ain't in Kansas and Luke, I'm not your father"
- return 1
- ;;
- esac
- done
-
- [[ "${dep_libs}" == "${librpath}${libladir}${new_dep_libs}" && "${new_inh_link_flags}" == "${inh_link_flags}" ]] && { echo "$lafile already clean, skipping update."; continue; }
- echo "${lafile}: Updating..."
- contents="${contents/${NEWLINE}dependency_libs=\'${dep_libs}\'${NEWLINE}/${NEWLINE}dependency_libs='${librpath}${libladir}${new_dep_libs}'${NEWLINE}}"
- [[ "${has_inh_link_flags}" == "yes" ]] && \
- contents="${contents/${NEWLINE}inherited_linker_flags=\'${inh_link_flags}\'${NEWLINE}/${NEWLINE}inherited_linker_flags='${new_inh_link_flags}'${NEWLINE}}"
-
- printf '%s' "$contents" > "${lafile}"
- done
-}
-
-case "$1" in
- -h|--help)
- cat <<- EOF
- lafilefixer (C) 2009 Peter Alfredsen <loki_val@gentoo.org>
- Released under the MIT/X11 license.
-
- Usage: lafilefixer [OPTION] [FILE|DIR]...
- Fix .la libtool archives to list libraries, not .la files in dependency_libs and
- do some minor fixups, moving -pthread to inherited_linker_flags if available and
- eliminating duplicate library listings.
-
- By default, lafilefixer is recursive, fixing all .la files in all subdirectories
- so if you want to fix only a single file, it must be specified in full.
-
- Options:
- -h, --help Display this text and exit.
- --justfixit Choose some reasonable dirs, such as /usr/lib*, etc. ,
- find all .la files and fix them to not use .la files
- for linking
- --license Display the license and exit.
- EOF
- ;;
- --justfixit)
- declare dirlist=""
- declare files=()
- for dir in {/usr/lib,/usr/qt/3/lib,/usr/kde/3.5/lib,/opt/lib,/lib}{,32,64}
- do
- [[ -d "${dir}" ]] && dirlist="${dirlist} ${dir}"
- done
-
- while read -r line
- do
- files+=( "$line" )
- done< <( find ${dirlist} -name '*.la' -type f )
-
- fix_la_files --cleanup "${files[@]}"
- ;;
- --license)
- cat <<- EOF
- Copyright (c) 2009 Peter Alfredsen <loki_val@gentoo.org>
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to
- do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- EOF
- ;;
- *)
- declare arglist=()
- declare files=()
- declare arg=""
-
- # Default to $PWD #276447
- [[ $# -eq 0 ]] && set -- "${PWD}"
-
- for arg in "${@}"
- do
- if [[ -d "${arg}" || -f "${arg}" ]]
- then
- arglist+=( "${arg}" )
- else
- printf '%s\n' "${arg} is not a valid directory or file, skipping."
- fi
- done
-
- while read -r line
- do
- files+=( "$line" )
- done< <( find "${arglist[@]}" -name '*.la' -type f )
-
- fix_la_files --cleanup "${files[@]}"
- ;;
-esac
-