Hi,
I'm about to rebuild mono-2.x with Mike's patch for libgdiplus but would like to know what the following sed line means (it's caused a problem with building for x86_64 mono)
's,@''bindir@,$(bindir),g'
what does the ,g do?
The reason I'm asking is that in order to get things to build with mono easier (and causing fewer upgrade hassles in trying to find *every* use of /usr/lib rather than %{_libdir}), I've started to use a find-all sed script. Unfortunately, on x86_64, this is giving me /usr/lib6464 and I'm wondering if the ,g has anything to do with the replication of the the 64 (I doubt it has).
The script works fine in other mono-based applications, so I'm trying to find why mono would act in such a way.
The script is as follows
find . -name Makefile.in -or -name Makefile.am -or -name *.pc.in \ -or -name *.in -or -name *.make \ | while read f ; do sed -i -e 's!$(prefix)/lib!%{_libdir}!' "$f" sed -i -e 's!@prefix@/lib!%{_libdir}!' "$f" sed -i -e 's!/usr/lib!%{_libdir}!' "$f" sed -i -e 's!${prefix}/lib!%{_libdir}!' "$f" sed -i -e 's!${exec_prefix}/lib!%{_libdir}!' "$f" sed -i -e 's!${prefix}/@reloc_libdir@!%{_libdir}!' "$f"; done
TTFN
Paul
2008/12/2 Paul paul@all-the-johnsons.co.uk:
's,@''bindir@,$(bindir),g'
what does the ,g do?
(each) "," is a delimiter, the "g" means replace every instance of @''bindir@ on each line - without it it would just be the first instance on every line.
Hi,
's,@''bindir@,$(bindir),g'
what does the ,g do?
(each) "," is a delimiter, the "g" means replace every instance of @''bindir@ on each line - without it it would just be the first instance on every line.
Thanks. Doesn't help in why x86_64 has a repeat of the 64...
TTFN
Paul
2008/12/2 Paul paul@all-the-johnsons.co.uk:
Hi,
I'm about to rebuild mono-2.x with Mike's patch for libgdiplus but would like to know what the following sed line means (it's caused a problem with building for x86_64 mono)
's,@''bindir@,$(bindir),g'
what does the ,g do?
The g mean, keep finding every match on a given line. Otherwise, you just get the first match, which may be what you want.
The reason I'm asking is that in order to get things to build with mono easier (and causing fewer upgrade hassles in trying to find *every* use of /usr/lib rather than %{_libdir}), I've started to use a find-all sed script. Unfortunately, on x86_64, this is giving me /usr/lib6464 and I'm wondering if the ,g has anything to do with the replication of the the 64 (I doubt it has).
The script works fine in other mono-based applications, so I'm trying to find why mono would act in such a way.
The script is as follows
find . -name Makefile.in -or -name Makefile.am -or -name *.pc.in \ -or -name *.in -or -name *.make \ | while read f ; do sed -i -e 's!$(prefix)/lib!%{_libdir}!' "$f" sed -i -e 's!@prefix@/lib!%{_libdir}!' "$f" sed -i -e 's!/usr/lib!%{_libdir}!' "$f" sed -i -e 's!${prefix}/lib!%{_libdir}!' "$f" sed -i -e 's!${exec_prefix}/lib!%{_libdir}!' "$f" sed -i -e 's!${prefix}/@reloc_libdir@!%{_libdir}!' "$f"; done
Maybe the g is causing the problem, but you'd have to see more context to know. Two suggestions:
1. sed takes multiple -e patterns, so you don't need to fork it 6 times per file.
2. Giving an argument to -i (on sed > 4.1.2 I think) will make a backup with the argument as suffix. E.g., `sed -i.bak s/foo/bar/ file' will give you file and the original file.bak. Then you can diff them to see what you just did.
-- Dan
Dan Nicholson wrote:
2008/12/2 Paul paul@all-the-johnsons.co.uk:
Hi,
I'm about to rebuild mono-2.x with Mike's patch for libgdiplus but would like to know what the following sed line means (it's caused a problem with building for x86_64 mono)
's,@''bindir@,$(bindir),g'
what does the ,g do?
The g mean, keep finding every match on a given line. Otherwise, you just get the first match, which may be what you want.
The reason I'm asking is that in order to get things to build with mono easier (and causing fewer upgrade hassles in trying to find *every* use of /usr/lib rather than %{_libdir}), I've started to use a find-all sed script. Unfortunately, on x86_64, this is giving me /usr/lib6464 and I'm wondering if the ,g has anything to do with the replication of the the 64 (I doubt it has).
The script works fine in other mono-based applications, so I'm trying to find why mono would act in such a way.
The script is as follows
find . -name Makefile.in -or -name Makefile.am -or -name *.pc.in \ -or -name *.in -or -name *.make \ | while read f ; do sed -i -e 's!$(prefix)/lib!%{_libdir}!' "$f" sed -i -e 's!@prefix@/lib!%{_libdir}!' "$f" sed -i -e 's!/usr/lib!%{_libdir}!' "$f" sed -i -e 's!${prefix}/lib!%{_libdir}!' "$f" sed -i -e 's!${exec_prefix}/lib!%{_libdir}!' "$f" sed -i -e 's!${prefix}/@reloc_libdir@!%{_libdir}!' "$f"; done
Maybe the g is causing the problem, but you'd have to see more context to know. Two suggestions:
- sed takes multiple -e patterns, so you don't need to fork it 6
times per file.
- Giving an argument to -i (on sed > 4.1.2 I think) will make a
backup with the argument as suffix. E.g., `sed -i.bak s/foo/bar/ file' will give you file and the original file.bak. Then you can diff them to see what you just did.
You're substituting some lines multiple times with the given sequence of substitutions. For instance:
start with: LIBDIR=@prefix@/lib This line runs: sed -i -e 's!@prefix@/lib!%{_libdir}!' "$f" And you have: LIBDIR=/usr/lib64 Then this line runs: sed -i -e 's!/usr/lib!%{_libdir}!' "$f" And you have: LIBDIR=/usr/lib6464
Ignacio's message has a solution for this since it checks that the "lib" pattern doesn't have a "6" after it.
-Toshio
On Wed, 2008-12-03 at 00:11 +0000, Paul wrote:
The reason I'm asking is that in order to get things to build with mono easier (and causing fewer upgrade hassles in trying to find *every* use of /usr/lib rather than %{_libdir}), I've started to use a find-all sed script. Unfortunately, on x86_64, this is giving me /usr/lib6464 and I'm wondering if the ,g has anything to do with the replication of the the 64 (I doubt it has).
's,lib([^6]|$),lib64\1,g'