This is an old revision of the document!


(apologies for docuwiki's odd rendering of HTML lists)

After initial inquiry here, and some trial-and-error, I was able to build the standalone client (aka sa, Zotero Everywhere) from source using a bash scriptlet (below). The main things I needed to learn were:

  1. Location of source: shown here to be https://www.zotero.org/svn/standalone/trunk/.
  2. Location of build script: build_sa is a bash script included with the source, in the root directory.
  3. Build prerequisites:
    1. Tools: Required tools appear to be only {bash, perl, subversion}. Given the source location, svn is obvious; fortunately it is provided by ubuntu package(s) by default (IIRC). The build script itself is bash, definitely default ubuntu. The only tool called by the build script that might not (ICBW) be included with a *x-ish environment is perl, but it's easily acquired (even for cygwin).
    2. Non-source inputs: Only required input appears to be xulrunner, with constraints:
      1. Version: build_sa states clearly that # Requires XULRunner runtime 2.0.*. This was a problem:
        1. Ubuntu does not package a 2.x xulrunner before Natty, which is currently pre-release.
        2. The xulrunner-2.x runtimes are also currently pre-release, and Mozilla does not (IMHO) make those builds easy to find.
        Fortunately one can get prerelease xulrunners from http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/: see scriptlet below.
      2. Location: build_sa states implicitly that it requires separate runtimes for each target architecture, and expects to find each such runtime in a directory with a conventional name (see scriptlet below).
  4. Build control: nothing to do but edit the bash script build_sa. It has no config file, takes no arguments, and is non-interactive. build_sa will build one or more of the target OSs {linux, mac, win32}, but it decides which architectures are built for each.
  5. Running the built sa (as opposed to running the build): after building, and some perusal of (e.g.) the output of ls -alt ${BUILD_PATH} $(find -executable -type f) | grep -ve '.so$', I found ${BUILD_PATH}/Zotero_${BUILD_ARCH}/zotero.

I automated a build on 64-bit linux with the following bash scriptlet. (On my humble laptop, on wireless, wall-clock ≅ 3.5 min start-to-finish; the build step proper ≅ 2.5 min.) This should be fairly easy to adapt for other OS/arch tuples (famous last words):

START="$(date)"
# edit following vars as desired for your build
DOWNLOAD_ROOT="/tmp/xulrunner"
BUILD_ARCH="linux-x86_64"
BUILD_ROOT="${HOME}/bin/zotero/standalone"
BUILD_DIR="20101228"
BUILD_PATH="${BUILD_ROOT}/${BUILD_DIR}"
BUILD_SCRIPT="build_sa"
BUILD_SCRIPT_BAK="${BUILD_SCRIPT}.0"
XULR_SOURCE_ROOT="http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk"
XULR_TARGET_PATH="${BUILD_PATH}/xulrunner_${BUILD_ARCH}"
XULR_VERSION="2.0b9pre.en-US"
XULR_CHECKSUMS_NAME="xulrunner-${XULR_VERSION}.${BUILD_ARCH}.checksums"
XULR_CHECKSUMS_SOURCE="${XULR_SOURCE_ROOT}/${XULR_CHECKSUMS_NAME}"
XULR_CHECKSUMS_TARGET="${DOWNLOAD_ROOT}/${XULR_CHECKSUMS_NAME}"
XULR_ARCHIVE_NAME="xulrunner-${XULR_VERSION}.${BUILD_ARCH}.tar.bz2"
XULR_ARCHIVE_SOURCE="${XULR_SOURCE_ROOT}/${XULR_ARCHIVE_NAME}"
XULR_ARCHIVE_TARGET="${DOWNLOAD_ROOT}/${XULR_ARCHIVE_NAME}"
ZOTERO_SOURCE_ROOT="https://www.zotero.org/svn/standalone/trunk/"
ZOTERO_TARGET_EXEC="${BUILD_PATH}/Zotero_${BUILD_ARCH}/zotero"

# setup xulrunner
# download xulrunner
mkdir -p ${DOWNLOAD_ROOT}
wget -O ${XULR_CHECKSUMS_TARGET} ${XULR_CHECKSUMS_SOURCE}
wget -O ${XULR_ARCHIVE_TARGET} ${XULR_ARCHIVE_SOURCE}
# verify xulrunner
pushd ${DOWNLOAD_ROOT}
# sha512sum -c < ${XULR_CHECKSUMS_TARGET}
# fails with
# > sha512sum: standard input: no properly formatted SHA512 checksum lines found
# I tried (offline) some other invocations, which similarly all failed
# $ sha512sum -c < /tmp/xulrunner/xulrunner-2.0b9pre.en-US.linux-x86_64.checksums 
# sha512sum: standard input: no properly formatted SHA512 checksum lines found
# $ pushd ${DOWNLOAD_ROOT}
# $ sha512sum -c < ${XULR_CHECKSUMS_NAME}
# sha512sum: standard input: no properly formatted SHA512 checksum lines found
# $ sha512sum -c < xulrunner-2.0b9pre.en-US.linux-x86_64.checksums 
# sha512sum: standard input: no properly formatted SHA512 checksum lines found
# $ sha512sum -c xulrunner-2.0b9pre.en-US.linux-x86_64.checksums 
# sha512sum: xulrunner-2.0b9pre.en-US.linux-x86_64.checksums: no properly formatted SHA512 checksum lines found
# unpack xulrunner
tar xjf ${XULR_ARCHIVE_NAME}
mkdir -p ${BUILD_PATH}
# ASSERT: archives expand to ./xulrunner
mv ./xulrunner ${XULR_TARGET_PATH}
popd

# setup sources, including script
# checkout sources
pushd ${BUILD_ROOT}
svn co ${ZOTERO_SOURCE_ROOT} ${BUILD_DIR}
popd
pushd ${BUILD_PATH}
# backup unhacked build script
cp ${BUILD_SCRIPT} ${BUILD_SCRIPT_BAK}
chmod 444 ${BUILD_SCRIPT_BAK}
# hack build script to build only linux
chmod 755 ${BUILD_SCRIPT}
sed -si 's/BUILD_MAC=1/BUILD_MAC=0/g' ${BUILD_SCRIPT}
sed -si 's/BUILD_WIN32=1/BUILD_WIN32=0/g' ${BUILD_SCRIPT}
sed -si 's/BUILD_LINUX=0/BUILD_LINUX=1/g' ${BUILD_SCRIPT}
diff -u ${BUILD_SCRIPT_BAK} ${BUILD_SCRIPT}

# CHECK: you should see stdout like
# --- build_sa.0  2010-12-28 16:45:21.000000000 -0500
# +++ build_sa    2010-12-28 16:45:21.000000000 -0500
# @@ -1,7 +1,7 @@
#  #!/bin/bash
# -BUILD_MAC=1
# +BUILD_MAC=0
#  BUILD_WIN32=0
# -BUILD_LINUX=0
# +BUILD_LINUX=1

# build
BUILD_START="$(date)"
./${BUILD_SCRIPT}
echo -e "build   end=$(date)"
echo -e "build start=${BUILD_START}"

# run the built sa
${ZOTERO_TARGET_EXEC} &
echo -e "  end=$(date)"
echo -e "start=${START}"

The (penultimate) build step produced the output

Getting latest Zotero revision
Got Zotero r7528
Building translators.zip
Building styles.zip
Retrieving Zotero OpenOffice.org Integration
Building Zotero_linux-i686
# several errors here, as I did not have the xulrunner for this arch
Building Zotero_linux-x86_64

The run step puts up a zotero window similar to that normally seen in Firefox. When initially run separately from the terminal, it produced the output

$ ./Zotero_linux-x86_64/zotero &
ERROR: There is no such extension deployed: org.Zotero.integration.openoffice
unopkg failed.

but I have not observed that subsequently.

Unfortunately I don't currently know how to test the built sa (much less from Chrome) aside from the following smoketest: if I

  1. Run the executable (e.g., ${ZOTERO_TARGET_EXEC}, ./Zotero_linux-x86_64/zotero).
  2. Wait for the zotero window, then select "Zotero Quick Start" in its middle pane.
  3. Hit button=View in the rightmost pane.

a browser launches and and opens the quick start guide. That's comforting, but I'd prefer to know

  1. Is there a more extensive test suite? E.g., what do youse do pre-commit?
  2. How to load up my own (backed up) Zotero data (from my Firefox profile, or wherever else it might be) and do actual work?

dev/building_the_standalone_client.1293594227.txt.gz ยท Last modified: 2010/12/28 22:43 by tomrochewiki