Ticket #46702: adapt-to-osx.patch
File adapt-to-osx.patch, 3.3 KB (added by RJVB (René Bertin), 10 years ago) |
---|
-
logger.cc
old new 131 131 for (uint i(0); i < Opt::args().size(); ++i) 132 132 command += Opt::args()[i] + " "; 133 133 134 #ifdef __APPLE__ 135 set_env("DYLD_FORCE_FLAT_NAMESPACE", "1"); 136 set_env("DYLD_INSERT_LIBRARIES", libporg); 137 #else 134 138 set_env("LD_PRELOAD", libporg); 139 #endif 135 140 set_env("PORG_TMPFILE", tmpfile); 136 141 if (Out::debug()) 137 142 set_env("PORG_DEBUG", "yes"); 138 143 139 144 Out::dbg_title("settings"); 145 #ifdef __APPLE__ 146 Out::dbg("DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=" + libporg); 147 #else 140 148 Out::dbg("LD_PRELOAD: " + libporg); 149 #endif 141 150 Out::dbg("INCLUDE: " + Opt::include()); 142 151 Out::dbg("EXCLUDE: " + Opt::exclude()); 143 152 Out::dbg("command: " + command); … … 195 204 // 196 205 static string search_libporg() 197 206 { 207 #ifdef __APPLE__ 208 string libpath(LIBDIR "/libporg-log.dylib"); 209 #else 198 210 string libpath(LIBDIR "/libporg-log.so"); 211 #endif 199 212 struct stat s; 200 213 201 214 if (!stat(libpath.c_str(), &s)) … … 204 217 glob_t g; 205 218 memset(&g, 0, sizeof(g)); 206 219 220 #ifdef __APPLE__ 221 if (!glob(LIBDIR "/libporg-log.[0-9]*.dylib", 0, 0, &g) && g.gl_pathc) 222 #else 207 223 if (!glob(LIBDIR "/libporg-log.so.[0-9]*", 0, 0, &g) && g.gl_pathc) 224 #endif 208 225 libpath = g.gl_pathv[0]; 209 226 210 227 globfree(&g); -
paco2porg
old new 49 49 logdir= 50 50 for dir in /etc /usr/local/etc /usr/etc /opt/etc; do 51 51 if [ -f $dir/${p}rc ]; then 52 logdir=$(s ed -n '/^LOGDIR=/ s///p' $dir/${p}rc 2>/dev/null)52 logdir=$(ssed -n '/^LOGDIR=/ s///p' $dir/${p}rc 2>/dev/null) 53 53 break; 54 54 fi 55 55 done … … 62 62 case $1 in 63 63 -v|--verbose) opt_verb=-v;; 64 64 -f|--force) opt_force=-f;; 65 -V|--version) porg --version | s ed "s/^porg/$me/"; exit 0;;65 -V|--version) porg --version | ssed "s/^porg/$me/"; exit 0;; 66 66 --paco-logdir=*) 67 67 paco_dir=${1#*=} 68 68 [ "$paco_dir" ] || die "Option '${1%=*}' requires an argument" … … 117 117 118 118 echo '#!'$porg_version'' > $porg_log 119 119 120 s ed -n 's/^#d:/#t:/p' $paco_log >> $porg_log120 ssed -n 's/^#d:/#t:/p' $paco_log >> $porg_log 121 121 122 echo "#a:$(s ed -n '/^#:Author: */ s///p' $paco_log)" >> $porg_log123 echo "#S:$(s ed -n '/^#:Summary: */ s///p' $paco_log)" >> $porg_log124 echo "#u:$(s ed -n '/^#:URL: */ s///p' $paco_log)" >> $porg_log125 echo "#l:$(s ed -n '/^#:License: */ s///p' $paco_log)" >> $porg_log122 echo "#a:$(ssed -n '/^#:Author: */ s///p' $paco_log)" >> $porg_log 123 echo "#S:$(ssed -n '/^#:Summary: */ s///p' $paco_log)" >> $porg_log 124 echo "#u:$(ssed -n '/^#:URL: */ s///p' $paco_log)" >> $porg_log 125 echo "#l:$(ssed -n '/^#:License: */ s///p' $paco_log)" >> $porg_log 126 126 127 127 (grep '^#c:' $paco_log || echo '#c:') >> $porg_log 128 128 (grep '^#i:' $paco_log || echo '#i:') >> $porg_log 129 129 130 130 desc='^#:Description$' 131 s ed -n "/^#:/ { /$desc/,\$ { /$desc/! s/#:/#d:/p } }" $paco_log \132 | s ed '1 { /^#d:$/d }; $ { /^#d:$/d }' >> $porg_log131 ssed -n "/^#:/ { /$desc/,\$ { /$desc/! s/#:/#d:/p } }" $paco_log \ 132 | ssed '1 { /^#d:$/d }; $ { /^#d:$/d }' >> $porg_log 133 133 echo '#d:' >> $porg_log 134 134 135 135 # 2) Logged files 136 136 137 for buf in $(s ed -n '/^-\?\// s//\//p' $paco_log); do137 for buf in $(ssed -n '/^-\?\// s//\//p' $paco_log); do 138 138 139 139 path=${buf%%|*} 140 140 size=0