Skip to content

Commit

Permalink
#1253: client-only builds for osx, using CLIENT_ONLY=1 env var
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@15344 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 22, 2017
1 parent 3b95623 commit 6e28c44
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 34 deletions.
22 changes: 16 additions & 6 deletions osx/make-DMG.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/sh

CLIENT_ONLY="${CLIENT_ONLY:=0}"
APP_DIR="./image/Xpra.app"
if [ "${CLIENT_ONLY}" == "1" ]; then
APP_DIR="./image/Xpra-Client.app"
fi

echo
echo
echo "*******************************************************************************"
if [ ! -d "image/Xpra.app" ]; then
echo "image/Xpra.app is missing!"
if [ ! -d "${APP_DIR}" ]; then
echo "${APP_DIR} is missing!"
echo "run make-app.sh first"
exit 1
fi

#get the version and build info from the python build records:
export PYTHONPATH="image/Xpra.app/Contents/Resources/lib/python/"
export PYTHONPATH="${APP_DIR}/Contents/Resources/lib/python/"
VERSION=`python -c "from xpra import __version__;import sys;sys.stdout.write(__version__)"`
REVISION=`python -c "from xpra import src_info;import sys;sys.stdout.write(str(src_info.REVISION))"`
REV_MOD=`python -c "from xpra import src_info;import sys;sys.stdout.write(['','M'][src_info.LOCAL_MODIFICATIONS>0])"`
Expand All @@ -20,6 +27,9 @@ if [ "$BUILD_BIT" != "32bit" ]; then
fi

DMG_NAME="Xpra$BUILD_INFO-$VERSION-r$REVISION$REV_MOD.dmg"
if [ "${CLIENT_ONLY}" == "1" ]; then
DMG_NAME="Xpra-Client$BUILD_INFO-$VERSION-r$REVISION$REV_MOD.dmg"
fi
echo "Creating $DMG_NAME"

rm -fr image/Blank.*
Expand All @@ -31,9 +41,9 @@ cp Blank.dmg.bz2 image/
bunzip2 image/Blank.dmg.bz2
hdiutil mount image/Blank.dmg -mountpoint ./image/Blank

echo "Copying Xpra.app into the DMG"
rsync -rpltgo image/Xpra.app ./image/Blank/
chmod -Rf go-w image/Blank/Xpra.app
echo "Copying app into the DMG"
rsync -rpltgo ${APP_DIR} ./image/Blank/
chmod -Rf go-w image/Blank/*
hdiutil detach image/Blank

echo "Creating compressed DMG"
Expand Down
24 changes: 16 additions & 8 deletions osx/make-PKG.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/bin/bash


CLIENT_ONLY="${CLIENT_ONLY:=0}"
APP_NAME="Xpra"
if [ "${CLIENT_ONLY}" == "1" ]; then
APP_NAME="Xpra-Client"
fi
APP_DIR="./image/${APP_NAME}.app"

echo
echo "*******************************************************************************"
if [ ! -d "./image/Xpra.app" ]; then
echo "./image/Xpra.app is missing - cannot continue"
if [ ! -d "${APP_DIR}" ]; then
echo "${APP_DIR} is missing - cannot continue"
exit 1
fi

#get the version and build info from the python build records:
export PYTHONPATH="image/Xpra.app/Contents/Resources/lib/python/"
export PYTHONPATH="${APP_DIR}/Contents/Resources/lib/python/"
VERSION=`python -c "from xpra import __version__;import sys;sys.stdout.write(__version__)"`
REVISION=`python -c "from xpra import src_info;import sys;sys.stdout.write(str(src_info.REVISION))"`
REV_MOD=`python -c "from xpra import src_info;import sys;sys.stdout.write(['','M'][src_info.LOCAL_MODIFICATIONS>0])"`
Expand All @@ -18,15 +26,15 @@ if [ "$BUILD_BIT" != "32bit" ]; then
BUILD_INFO="-x86_64"
fi

PKG_FILENAME="Xpra$BUILD_INFO-$VERSION-r$REVISION$REV_MOD.pkg"
PKG_FILENAME="$APP_NAME$BUILD_INFO-$VERSION-r$REVISION$REV_MOD.pkg"
rm -f ./image/$PKG_FILENAME >& /dev/null
echo "Making $PKG_FILENAME"

#create directory structure:
rm -fr ./image/flat ./image/root
mkdir -p ./image/flat/base.pkg ./image/flat/Resources/en.lproj
mkdir -p ./image/root/Applications
rsync -rplogt ./image/Xpra.app ./image/root/Applications/
rsync -rplogt ${APP_DIR} ./image/root/Applications/

#man page:
mkdir -p ./image/root/usr/share/man/man1
Expand Down Expand Up @@ -65,8 +73,8 @@ cat > ./image/flat/base.pkg/PackageInfo << EOF
<postinstall file="./postinstall"/>
</scripts>
<bundle-version>
<bundle id="org.xpra.Xpra" CFBundleIdentifier="org.xpra.Xpra" path="./Applications/Xpra.app" CFBundleVersion="$VERSION">
<bundle id="org.xpra.XpraNoDock" CFBundleIdentifier="org.xpra.XpraNoDock" path="./Contents/Xpra_NoDock.app" CFBundleVersion="$VERSION"/>
<bundle id="org.xpra.${APP_NAME}" CFBundleIdentifier="org.xpra.${APP_NAME}" path="./Applications/${APP_NAME}.app" CFBundleVersion="$VERSION">
<bundle id="org.xpra.Xpra_NoDock" CFBundleIdentifier="org.xpra.Xpra_NoDock" path="./Contents/Xpra_NoDock.app" CFBundleVersion="$VERSION"/>
</bundle>
</bundle-version>
</pkg-info>
Expand All @@ -75,7 +83,7 @@ EOF
cat > ./image/flat/Distribution << EOF
<?xml version="1.0" encoding="utf-8"?>
<installer-script minSpecVersion="2">
<title>Xpra $VERSION</title>
<title>${APP_NAME} $VERSION</title>
<allowed-os-versions>
<os-version min="10.5.8" />
</allowed-os-versions>
Expand Down
52 changes: 41 additions & 11 deletions osx/make-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ STRIP_GSTREAMER_PLUGINS="${STRIP_GSTREAMER_PLUGINS:=$STRIP_DEFAULT}"
STRIP_SOURCE="${STRIP_SOURCE:=$STRIP_DEFAULT}"
STRIP_OPENGL="${STRIP_OPENGL:=$STRIP_DEFAULT}"
STRIP_NUMPY="${STRIP_NUMPY:=$STRIP_DEFAULT}"
CLIENT_ONLY="${CLIENT_ONLY:=0}"

DO_TESTS="${DO_TESTS:-1}"

BUILDNO="${BUILDNO:="0"}"
IMAGE_DIR="./image/Xpra.app"
CONTENTS_DIR="${IMAGE_DIR}/Contents"
APP_DIR="./image/Xpra.app"
if [ "${CLIENT_ONLY}" == "1" ]; then
APP_DIR="./image/Xpra-Client.app"
BUILD_ARGS="${BUILD_ARGS} --without-server --without-shadow --without-proxy --without-html5"
fi
CONTENTS_DIR="${APP_DIR}/Contents"
MACOS_DIR="${CONTENTS_DIR}/MacOS"
RSCDIR="${CONTENTS_DIR}/Resources"
HELPERS_DIR="${CONTENTS_DIR}/Helpers"
Expand Down Expand Up @@ -101,6 +106,18 @@ if [ ! -d "${JHBUILD_PREFIX}/etc/pango" ]; then
mkdir "${JHBUILD_PREFIX}/etc/pango"
fi

echo
echo "*******************************************************************************"
echo "adding version \"$VERSION\" and revision \"$REVISION$REV_MOD\" to Info.plist files"
svn revert Info.plist
sed -i '' -e "s+%VERSION%+$VERSION+g" "./Info.plist"
sed -i '' -e "s+%REVISION%+$REVISION$REV_MOD+g" "./Info.plist"
sed -i '' -e "s+%BUILDNO%+$BUILDNO+g" "./Info.plist"
if [ "${CLIENT_ONLY}" == "1" ]; then
sed -i '' -e "s+Xpra+Xpra-Client+g" "./Info.plist"
sed -i '' -e "s+org.xpra.xpra+org.xpra.xpra-client+g" "./Info.plist"
fi

echo
echo "*******************************************************************************"
echo "calling 'gtk-mac-bundler Xpra.bundle' in `pwd`"
Expand Down Expand Up @@ -147,6 +164,10 @@ popd

# launcher needs to be in main ("MacOS" dir) since it is launched from the custom Info.plist:
cp ./Helpers/Launcher ${MACOS_DIR}
if [ "${CLIENT_ONLY}" == "1" ]; then
rm -f "${HELPERS_DIR}/Shadow"
rm -f "${RSCDIR}/bin/Shadow"
fi
# Add the icon:
cp ./*.icns ${RSCDIR}/

Expand All @@ -160,24 +181,32 @@ for x in "*.c" "*.pyx" "*.pxd" "constants.pxi" "constants.txt"; do
echo "removing $x:"
find $LIBDIR/python/xpra/ -name "$x" -print -exec rm "{}" \; | sed "s+$LIBDIR/python/xpra/++g" | xargs -L 1 echo "* "
done
#should be redundant:
if [ "${CLIENT_ONLY}" == "1" ]; then
for x in "server" "x11"; do
rm -fr "$LIBDIR/python/xpra/$x"
done
fi


echo
echo "*******************************************************************************"
echo "Ship default config files"
#the build / install step should have placed them here:
rsync -rplogtv ../src/build/etc/xpra ${RSCDIR}/etc/
#add the launch agent file
mkdir ${RSCDIR}/LaunchAgents
cp ./org.xpra.Agent.plist ${RSCDIR}/LaunchAgents/
if [ "${CLIENT_ONLY}" == "0" ]; then
#add the launch agent file
mkdir ${RSCDIR}/LaunchAgents
cp ./org.xpra.Agent.plist ${RSCDIR}/LaunchAgents/
fi


echo
echo "*******************************************************************************"
echo "Xpra without a tray..."
for app in Xpra_NoDock.app; do
SUB_APP="${IMAGE_DIR}/Contents/${app}"
rsync -rplvtog ${app} ${IMAGE_DIR}/Contents/
SUB_APP="${APP_DIR}/Contents/${app}"
rsync -rplvtog ${app} ${APP_DIR}/Contents/
ln -sf ../../Resources ${SUB_APP}/Contents/Resources
ln -sf ../../MacOS ${SUB_APP}/Contents/MacOS
ln -sf ../../Helpers ${SUB_APP}/Contents/Helpers
Expand Down Expand Up @@ -280,12 +309,13 @@ groff -mandoc -Thtml < ../src/man/xpra_launcher.1 > ${RSCDIR}/share/launcher-man
echo
echo "*******************************************************************************"
echo "adding version \"$VERSION\" and revision \"$REVISION$REV_MOD\" to Info.plist files"
sed -i '' -e "s+%VERSION%+$VERSION+g" "${CONTENTS_DIR}/Info.plist"
sed -i '' -e "s+%REVISION%+$REVISION$REV_MOD+g" "${CONTENTS_DIR}/Info.plist"
sed -i '' -e "s+%BUILDNO%+$BUILDNO+g" "${CONTENTS_DIR}/Info.plist"
sed -i '' -e "s+%VERSION%+$VERSION+g" "${CONTENTS_DIR}/Xpra_NoDock.app/Contents/Info.plist"
sed -i '' -e "s+%REVISION%+$REVISION$REV_MOD+g" "${CONTENTS_DIR}/Xpra_NoDock.app/Contents/Info.plist"
sed -i '' -e "s+%BUILDNO%+$BUILDNO+g" "${CONTENTS_DIR}/Xpra_NoDock.app/Contents/Info.plist"
if [ "${CLIENT_ONLY}" == "1" ]; then
sed -i '' -e "s+Xpra+Xpra-Client+g" "${CONTENTS_DIR}/Xpra_NoDock.app/Contents/Info.plist"
sed -i '' -e "s+org.xpra.xpra+org.xpra.xpra-client+g" "${CONTENTS_DIR}/Xpra_NoDock.app/Contents/Info.plist"
fi

echo
echo "*******************************************************************************"
Expand Down Expand Up @@ -321,7 +351,7 @@ popd
echo
echo "*******************************************************************************"
echo "copying application image to Desktop"
rsync --delete -rplogt "${IMAGE_DIR}" ~/Desktop/
rsync --delete -rplogt "${APP_DIR}" ~/Desktop/
echo "Done"
echo "*******************************************************************************"
echo
18 changes: 11 additions & 7 deletions osx/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ if [ -d "$APP_ROOT" ]; then
mkdir /usr/local/bin
fi

csrutil status 2> /dev/null | grep "enabled"
if [ $? != "0" ]; then
cp $APP_ROOT/Contents/Resources/LaunchAgents/org.xpra.Agent.plist /System/Library/LaunchAgents/
if [ -e "$APP_ROOT/Contents/Resources/LaunchAgents/org.xpra.Agent.plist" ]; then
csrutil status 2> /dev/null | grep "enabled"
if [ $? != "0" ]; then
cp $APP_ROOT/Contents/Resources/LaunchAgents/org.xpra.Agent.plist /System/Library/LaunchAgents/
fi
fi

if [ ! -e "/Library/Application Support/Xpra/ssl-cert.pem" ]; then
Expand All @@ -36,9 +38,11 @@ if [ -d "$APP_ROOT" ]; then
chmod 755 /usr/local/bin/$x
done
for x in Bug_Report Config_info Encoding_info GStreamer_info GTK_info Keyboard_Tool Keymap_info Keyboard_info Launcher Network_info OpenGL_check Path_info PowerMonitor Print Python Shadow Version_info Webcam_Test;do
echo '#!/bin/sh' > /usr/local/bin/Xpra_$x
echo exec $APP_ROOT/Contents/Helpers/$x \"\$@\" >> /usr/local/bin/Xpra_$x
chown root:wheel /usr/local/bin/Xpra_$x
chmod 755 /usr/local/bin/Xpra_$x
if [ -e "$APP_ROOT/Contents/Helpers/$x" ]; then
echo '#!/bin/sh' > /usr/local/bin/Xpra_$x
echo exec $APP_ROOT/Contents/Helpers/$x \"\$@\" >> /usr/local/bin/Xpra_$x
chown root:wheel /usr/local/bin/Xpra_$x
chmod 755 /usr/local/bin/Xpra_$x
fi
done
fi
7 changes: 5 additions & 2 deletions osx/sign-app.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash

IMAGE_DIR="./image/Xpra.app"
APP_DIR="./image/Xpra.app"
if [ "${CLIENT_ONLY}" == "1" ]; then
APP_DIR="./image/Xpra-Client.app"
fi

if [ ! -z "${CODESIGN_KEYNAME}" ]; then
echo "Signing with key '${CODESIGN_KEYNAME}'"
codesign --deep --force --verify --verbose --sign "Developer ID Application: ${CODESIGN_KEYNAME}" ${IMAGE_DIR}
codesign --deep --force --verify --verbose --sign "Developer ID Application: ${CODESIGN_KEYNAME}" ${APP_DIR}
else
echo "Signing skipped (no keyname)"
fi

0 comments on commit 6e28c44

Please sign in to comment.