Обсуждение: [PATCH] Add pg_dump/pg_restore to appbundle + some cleanups.
Hi
Here is a patch to copy pg_dump and pg_restore into
$bundledir/Contents/SharedSupport/helper/. pgAdmin3.app should
find it there, but I didn't test this yet (I just have
access to my build-machine over ssh ATM - I'll need my powerbook
to test this).
The other patches are mostly cleanups
pgadmin3.addhelper.patch: Mentions above.
pgadmin3.debug.patch: pg_debug_build seems to have gotten
renamed to BUILD_DEBUG. Changed that in src/Makefile.am
pgadmin3.nopgagent.patch: Don't install pgadmin into the
bundle - it's useless there, since it needs to be running
on the server, not on the client.
pgadmin3.versions.patch: Use PGADMIN_LONG_VERSION instead
of PGADMIN3_SHORT_VERSION at some places in Info.plist
greetings, Florian Pflug
Index: src/base/appbase.cpp
===================================================================
--- src/base/appbase.cpp (revision 4751)
+++ src/base/appbase.cpp (working copy)
@@ -36,7 +36,6 @@
#define UI_DIR wxT("/ui")
#define I18N_DIR wxT("/i18n")
-#define SCRIPT_DIR wxT("/scripts")
#define HELPER_DIR wxT("/helper")
@@ -104,8 +103,6 @@
if (wxDir::Exists(dataDir + HELPER_DIR))
path.Add(dataDir + HELPER_DIR) ;
- if (wxDir::Exists(dataDir + SCRIPT_DIR))
- path.Add(dataDir + SCRIPT_DIR) ;
#else // other *ixes
Index: pkg/mac/complete-bundle.sh
===================================================================
--- pkg/mac/complete-bundle.sh (revision 4751)
+++ pkg/mac/complete-bundle.sh (working copy)
@@ -11,7 +11,7 @@
echo "Completing bundle: $bundle"
cd "$bundle"
fw_basepath=$(dirname $(pwd))
-todo=$(find ./ | \
+todo=$(find ./ -perm +0111 ! -type d | \
xargs --replace=line file 'line' | \
sed -n 's/^\([^:][^:]*\):[[:space:]]*Mach-O executable ppc$/\1/p' | \
xargs echo -n \
Index: pkg/mac/Makefile.am
===================================================================
--- pkg/mac/Makefile.am (revision 4751)
+++ pkg/mac/Makefile.am (working copy)
@@ -24,5 +24,7 @@
$(install_sh_DATA) "sql.icns" "$(bundledir)/Contents/Resources/sql.icns"
$$($(WX_CONFIG) --rezflags | sed 's/-t[[:space:]]*APPL//') \
"$(bundledir)/Contents/Resources/pgAdmin3.rsrc" -useDF
+ $(install_sh_PROGRAM) "$$($(PG_CONFIG) --bindir)/pg_dump" "$(bundledir)/Contents/SharedSupport/helper/pg_dump"
+ $(install_sh_PROGRAM) "$$($(PG_CONFIG) --bindir)/pg_restore"
"$(bundledir)/Contents/SharedSupport/helper/pg_restore"
./complete-bundle.sh "$(bundledir)"
endif
Index: src/Makefile.am
===================================================================
--- src/Makefile.am (revision 4751)
+++ src/Makefile.am (working copy)
@@ -171,7 +171,7 @@
cd $(bindir) ;\
mv pgadmin3 tmp ;\
mv tmp pgAdmin3 ;\
- if test "$(pg_debug_build)" = "no"; then \
+ if test "$(BUILD_DEBUG)" = "no"; then \
strip pgAdmin3 ;\
fi
Index: xtra/pgagent/Makefile.am
===================================================================
--- xtra/pgagent/Makefile.am (revision 4751)
+++ xtra/pgagent/Makefile.am (working copy)
@@ -37,24 +37,11 @@
AM_CPPFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -Wno-non-virtual-dtor -I$(srcdir)/include
AM_CFLAGS = -DDATA_DIR=\"$(pkgdatadir)/\" -Wall -I$(srcdir)/include
-# Automake trys to execute install-exec-hook if it appears anywhere in the file, so we need a dummy
-# for non-APPBUNDLE cases.
-install-exec-hook:
+install-data-local:
+ $(install_sh) -c -m 644 pgagent.sql $(DESTDIR)/$(pkgdatadir)/pgagent.sql
else
-AM_CXXFLAGS = -Wall -Wno-non-virtual-dtor -I$(srcdir)/include
-AM_CPPFLAGS = -Wall -Wno-non-virtual-dtor -I$(srcdir)/include
-AM_CFLAGS = -Wall -I$(srcdir)/include
-install-exec-hook:
- cd $(bindir) ;\
- mv pgagent tmp ;\
- mv tmp pgagent ;\
- if test "$(pg_debug_build)" = "no"; then \
- strip pgagent ;\
- fi
+install-data-local:
endif
-
-install-data-local:
- $(install_sh) -c -m 644 pgagent.sql $(DESTDIR)/$(pkgdatadir)/pgagent.sql
Index: xtra/Makefile.am
===================================================================
--- xtra/Makefile.am (revision 4751)
+++ xtra/Makefile.am (working copy)
@@ -7,8 +7,12 @@
# Makefile - Makefile for *nix systems
##############################################################################
+if !APPBUNDLE
+
SUBDIRS = pgagent
+endif
+
# Note: We cannot add a Makefile to the admin directory as it already
# contains one to be used as part of the PostreSQL contrib build
# system. Instead, we'll add the files in that directory here.
Index: pkg/mac/Info.plist.in
===================================================================
--- pkg/mac/Info.plist.in (revision 4751)
+++ pkg/mac/Info.plist.in (working copy)
@@ -26,7 +26,7 @@
<key>CFBundleExecutable</key>
<string>pgAdmin3</string>
<key>CFBundleGetInfoString</key>
- <string>pgAdmin3 PGADMIN_SHORT_VERSION</string>
+ <string>pgAdmin3 PGADMIN_LONG_VERSION</string>
<key>CFBundleIconFile</key>
<string>pgAdmin3.icns</string>
<key>CFBundleIdentifier</key>
@@ -40,7 +40,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>PGADMIN_SHORT_VERSION</string>
+ <string>PGADMIN_LONG_VERSION</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>UTExportedTypeDeclarations</key>
Вложения
Florian G. Pflug wrote:
> [snipped my own mail]
Aaarg.. Missed a bug. With the previous patch, pg_dump wouldn't start,
because it can't find libpq. Fixed now - here is a replacement for
pgadmin3.addhelper.patch, calles pgadmin3.addhelper.fixed.patch.
The other patches are ok.
greetings, Florian Pflug
Index: src/base/appbase.cpp
===================================================================
--- src/base/appbase.cpp (revision 4751)
+++ src/base/appbase.cpp (working copy)
@@ -36,7 +36,6 @@
#define UI_DIR wxT("/ui")
#define I18N_DIR wxT("/i18n")
-#define SCRIPT_DIR wxT("/scripts")
#define HELPER_DIR wxT("/helper")
@@ -104,8 +103,6 @@
if (wxDir::Exists(dataDir + HELPER_DIR))
path.Add(dataDir + HELPER_DIR) ;
- if (wxDir::Exists(dataDir + SCRIPT_DIR))
- path.Add(dataDir + SCRIPT_DIR) ;
#else // other *ixes
Index: pkg/mac/complete-bundle.sh
===================================================================
--- pkg/mac/complete-bundle.sh (revision 4751)
+++ pkg/mac/complete-bundle.sh (working copy)
@@ -10,8 +10,7 @@
echo "Completing bundle: $bundle"
cd "$bundle"
-fw_basepath=$(dirname $(pwd))
-todo=$(find ./ | \
+todo=$(find ./ -perm +0111 ! -type d | \
xargs --replace=line file 'line' | \
sed -n 's/^\([^:][^:]*\):[[:space:]]*Mach-O executable ppc$/\1/p' | \
xargs echo -n \
@@ -22,6 +21,13 @@
todo_old=$todo ;
todo="" ;
for todo_obj in $todo_old; do
+ #Figure out the relative path from todo_obj to Contents/Frameworks
+ fw_relpath=$(echo "$todo_obj" |\
+ sed -n 's|^\(\.//*\)\(\([^/][^/]*/\)*\)[^/][^/]*$|\2|gp' | \
+ sed -n 's|[^/][^/]*/|../|gp' \
+ )"Contents/Frameworks"
+
+ #Find all libraries $todo_obj depends on, but skip system libraries
for lib in $(
otool -L $todo_obj | \
sed -n 's|^.*[[:space:]]\([^[:space:]]*\.dylib\).*$|\1|p' | \
@@ -30,22 +36,16 @@
lib_bn="$(basename "$lib")" ;
if ! test -f "Contents/Frameworks/$lib_bn"; then
echo "Adding library: $lib_bn (because of: $todo_obj)"
- case "$lib" in
- /*)
- cp "$lib" "Contents/Frameworks/$lib_bn"
- ;;
- *)
- cp "$fw_basepath/$lib" "Contents/Frameworks/$lib_bn"
- ;;
- esac
+ cp "$lib" "Contents/Frameworks/$lib_bn"
+ chmod 755 "Contents/Frameworks/$lib_bn"
install_name_tool \
- -id "@executable_path/../Frameworks/$lib_bn" \
+ -id "$lib_bn" \
"Contents/Frameworks/$lib_bn" || exit 1
todo="$todo Contents/Frameworks/$lib_bn"
fi
install_name_tool -change \
"$lib" \
- "@executable_path/../Frameworks/$lib_bn" \
+ "@executable_path/$fw_relpath/$lib_bn" \
"$todo_obj" || exit 1
done
done
Вложения
Florian G. Pflug wrote:
> Florian G. Pflug wrote:
>> [snipped my own mail]
> [snipped again]
Aaaaaarrrrgg. Again. Should go to bed, I guess ;-)
The replacement-patch is broken too - This time I messed up
while generating the patch with "svn diff", and of course
only noticed after hitting "send".
Here another version, hopefully ok this time ;-)
BTW, that patch should work for the 1.4 tree too. The others
are just meant for trunk.
greetings, Florian Pflug
Index: pkg/mac/Makefile.am
===================================================================
--- pkg/mac/Makefile.am (revision 4751)
+++ pkg/mac/Makefile.am (working copy)
@@ -24,5 +24,7 @@
$(install_sh_DATA) "sql.icns" "$(bundledir)/Contents/Resources/sql.icns"
$$($(WX_CONFIG) --rezflags | sed 's/-t[[:space:]]*APPL//') \
"$(bundledir)/Contents/Resources/pgAdmin3.rsrc" -useDF
+ $(install_sh_PROGRAM) "$$($(PG_CONFIG) --bindir)/pg_dump" "$(bundledir)/Contents/SharedSupport/helper/pg_dump"
+ $(install_sh_PROGRAM) "$$($(PG_CONFIG) --bindir)/pg_restore"
"$(bundledir)/Contents/SharedSupport/helper/pg_restore"
./complete-bundle.sh "$(bundledir)"
endif
Index: src/base/appbase.cpp
===================================================================
--- src/base/appbase.cpp (revision 4751)
+++ src/base/appbase.cpp (working copy)
@@ -36,7 +36,6 @@
#define UI_DIR wxT("/ui")
#define I18N_DIR wxT("/i18n")
-#define SCRIPT_DIR wxT("/scripts")
#define HELPER_DIR wxT("/helper")
@@ -104,8 +103,6 @@
if (wxDir::Exists(dataDir + HELPER_DIR))
path.Add(dataDir + HELPER_DIR) ;
- if (wxDir::Exists(dataDir + SCRIPT_DIR))
- path.Add(dataDir + SCRIPT_DIR) ;
#else // other *ixes
Index: pkg/mac/complete-bundle.sh
===================================================================
--- pkg/mac/complete-bundle.sh (revision 4751)
+++ pkg/mac/complete-bundle.sh (working copy)
@@ -10,8 +10,7 @@
echo "Completing bundle: $bundle"
cd "$bundle"
-fw_basepath=$(dirname $(pwd))
-todo=$(find ./ | \
+todo=$(find ./ -perm +0111 ! -type d | \
xargs --replace=line file 'line' | \
sed -n 's/^\([^:][^:]*\):[[:space:]]*Mach-O executable ppc$/\1/p' | \
xargs echo -n \
@@ -22,6 +21,13 @@
todo_old=$todo ;
todo="" ;
for todo_obj in $todo_old; do
+ #Figure out the relative path from todo_obj to Contents/Frameworks
+ fw_relpath=$(echo "$todo_obj" |\
+ sed -n 's|^\(\.//*\)\(\([^/][^/]*/\)*\)[^/][^/]*$|\2|gp' | \
+ sed -n 's|[^/][^/]*/|../|gp' \
+ )"Contents/Frameworks"
+
+ #Find all libraries $todo_obj depends on, but skip system libraries
for lib in $(
otool -L $todo_obj | \
sed -n 's|^.*[[:space:]]\([^[:space:]]*\.dylib\).*$|\1|p' | \
@@ -30,22 +36,16 @@
lib_bn="$(basename "$lib")" ;
if ! test -f "Contents/Frameworks/$lib_bn"; then
echo "Adding library: $lib_bn (because of: $todo_obj)"
- case "$lib" in
- /*)
- cp "$lib" "Contents/Frameworks/$lib_bn"
- ;;
- *)
- cp "$fw_basepath/$lib" "Contents/Frameworks/$lib_bn"
- ;;
- esac
+ cp "$lib" "Contents/Frameworks/$lib_bn"
+ chmod 755 "Contents/Frameworks/$lib_bn"
install_name_tool \
- -id "@executable_path/../Frameworks/$lib_bn" \
+ -id "$lib_bn" \
"Contents/Frameworks/$lib_bn" || exit 1
todo="$todo Contents/Frameworks/$lib_bn"
fi
install_name_tool -change \
"$lib" \
- "@executable_path/../Frameworks/$lib_bn" \
+ "@executable_path/$fw_relpath/$lib_bn" \
"$todo_obj" || exit 1
done
done
Вложения
> -----Original Message----- > From: pgadmin-hackers-owner@postgresql.org > [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of > Florian G. Pflug > Sent: 24 November 2005 21:49 > To: pgadmin-hackers > Subject: [pgadmin-hackers] [PATCH] Add pg_dump/pg_restore to > appbundle + some cleanups. > > Hi > > Here is a patch to copy pg_dump and pg_restore into > $bundledir/Contents/SharedSupport/helper/. pgAdmin3.app should > find it there, but I didn't test this yet (I just have > access to my build-machine over ssh ATM - I'll need my powerbook > to test this). > > The other patches are mostly cleanups > pgadmin3.addhelper.patch: Mentions above. > pgadmin3.debug.patch: pg_debug_build seems to have gotten > renamed to BUILD_DEBUG. Changed that in src/Makefile.am > pgadmin3.nopgagent.patch: Don't install pgadmin into the > bundle - it's useless there, since it needs to be running > on the server, not on the client. > pgadmin3.versions.patch: Use PGADMIN_LONG_VERSION instead > of PGADMIN3_SHORT_VERSION at some places in Info.plist Thanks Florian - patches applied (the fixed version of course). Regards, Dave