You are not logged in.

#1 2006-08-03 01:48:38

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

xmlcopyeditor PKGBUILD for review

I would appreciate feedback on this PKGBUILD before I submit it to the AUR. It builds on my system, but there are several issues in there that I do not understand nearly so well as some others who follow this forum.

XML Copy Editor is an XML editor with DTD/XML Schema/RELAX NG validation, XSLT, XPath, pretty-printing, syntax highlighting, folding, tag completion/locking, and a spelling and style check. The GUI is based on Scintilla. (xmlcopyeditor also runs under MS Windows).

The author distributes a Linux tarball and an RPM for Fedora Core 5, but I did not find any other Linux packages out there. This appears to me to be a well-thought-out and mature application, so I don't know why the other distributions haven't picked it up yet. There are two KDE XML editors and a GNOME XML editor in Arch already, but not everyone wants to run GNOME or KDE, and besides, the four xml editors all have different features and user interfaces. Perhaps other Arch users will find xmlcopyeditor useful, as I do. The tarball is somewhat Fedora-centric, as that is what the author runs. He doesn't want to maintain multiple Linux packages, but he would like to make his Linux tarball as flexible and widely applicable as he can. For that reason, feedback from our work on the PKGBUILD should be helpful to him. In fact, there are some improvements he could make in that area, and perhaps that is one factor that contributes to the lack of Linux packages

# Contributor: David Scholl <djscholl>
pkgname=xmlcopyeditor
pkgver=1.0.6.5
pkgrel=1
pkgdesc="XML editor based on Scintilla."
url="http://xml-copy-editor.sourceforge.net"
license="custom"
depends=(gcc gtk2 libxxf86vm libgnome)
makedepends=(pkgconfig boost wxgtk)
source=("http://dl.sourceforge.net/sourceforge/xml-copy-editor/$pkgname-$pkgver.tar.gz"  "http://dl.sourceforge.net/sourceforge/wxwindows/wxGTK-2.6.3.tar.gz")
md5sums=('11bee785eba8ebf4724b0d3d594b78e6' '3041cad0bbca3bfd6b845d3d63b6e7aa')

build() {
  cd $startdir/src/wxGTK-2.6.3
  mkdir buildstatic
  cd buildstatic
  ../configure --enable-unicode --disable-shared --prefix=/usr 
  make || return 1
  make DESTDIR=$startdir/pkg install
  cd contrib/src/stc
  make || return 1
  make DESTDIR=$startdir/pkg install
  install -d $startdir/pkg/libstatic
  install $startdir/pkg/usr/lib/libwx*.a $startdir/pkg/libstatic
  rm -Rf $startdir/pkg/usr

  cd $startdir/src/$pkgname-$pkgver
  sed -i "s//usr/local/lib/libwx/${startdir////\/}/pkg/libstatic/libwx/g" ./src/Makefile.in
  ./configure
  make || return 1
  make DESTDIR=$startdir/pkg install
  
  rm -Rf $startdir/pkg/libstatic
  install -D $startdir/pkg/usr/local/bin/xmlcopyeditor $startdir/pkg/usr/bin/xmlcopyeditor
  mv $startdir/pkg/usr/local/share $startdir/pkg/usr
  rm -Rf $startdir/pkg/usr/local
  install -d $startdir/pkg/usr/share/licenses/$pkgname
  cp -R $startdir/pkg/usr/share/$pkgname/copying/* $startdir/pkg/usr/share/licenses/$pkgname
}

One intriguing aspect of this PKGBUILD is that xmlcopyeditor needs the wxgtk libraries built with the unicode option enabled. Arch follows most other distributions in supplying wxgtk built without unicode. The PKGBUILD downloads the wxgtk tarball and builds it without shared libraries. The eight static libraries to be linked later are set aside, and wxgtk is then deleted from the pkg tree. The system wxgtk is listed with the makedepends because the xmlcopyeditor configure script won't finish unless it finds wx-config. It seems to me that perhaps this could be eliminated, since we just built an entire wxgtk, and we are not going to use the system wxgtk, but I don't know enough to be sure. The location of the static libraries is hardwired to /usr/local/lib/, which is unworkable for makepkg, where everything hangs off of $startdir. I work around this by hacking the correct absolute path of the eight static libraries into the Makefile.in with a sed command. There is also a bash parameter expansion in there to insert a backslash before every slash in $startdir, as required by sed. The author is considering ways to make this path more easily configureable.

In the current Linux tarball, the xmlcopyeditor makefile has the prefix path hardwired to /usr/local. The author originally did this so he could make sure the application could find its resources, which by default are stored in /usr/local/share/xmlcopyeditor, when it was first run. In order to make the tarball more flexible, he has arranged for the binary to look for resources in /usr/share/xmlcopyeditor as well, which is where we want them in Arch Linux. Unfortunately, the xmlcopyeditor configure prefix option is still hardwired to /usr/local, so I have to move the binary to /usr/bin and resource directory to /usr/share/xmlcopyeditor while they are still in the pkg tree. The author plans to make the prefix configurable in the near future.

The author has gone to the trouble to collect copies of all relevant licenses in one location in the tarball, which makes it easy to install them in the Arch-specified directory.

The integration with GNOME is currently under development. I didn't describe this as a GNOME editor, because this is a minor feature (though a nice one), which might eventually be handled in another way. There is a View => Browser menu item (and a keyboard shortcut) which is intended to open a viewer for XML-based file types that have native viewers (e.g., XHTML, HTML, or SVG). The gnome-open command along with the GNOME MIME database are used to open the file being edited, using whichever viewer has registered itself with that particular MIME type. On my system, this only works with inkscape and SVG files. (I found it fun to edit an SVG file as XML and then pop open a window to see what the results looked like.) This same technique is also apparently used in the Help menu to access online help, the home page, or to download the source code. I had to add /opt/gnome/bin to my path, maybe because I don't have the full GNOME package installed. Unless someone has a better idea, I plan to add an xmlcopyeditor.install script to warn about finding /opt/gnome/bin/gnome-open. I specified libgnome as a dependency to get gnome-open installed, but actual gnome experts may suggest additional packages to help this functionality. I must have something missing, since the HTML browser doesn't open on my system. The author has the entire GNOME desktop installed by default with Fedora, so it's not easy for him to determine which GNOME components are actually needed for this task. I hesitate to add these helper applications as dependencies, but perhaps they should be mentioned by the install script. I suppose galeon would be used for HTML... The author is currently looking for a more generic way to accomplish this task. In the long term, the OSDL's Portland Project seems to me to be the way to go. (http://portland.freedesktop.org/wiki/)

If a future version drops the gnome-open command, then the build no longer depends on libgnome. The build requires headers and static libraries from libxml2, libxslt, and pcre, which will need to be added as makedepends if libgnome is delisted. I listed gcc with the dependencies, even though gcc is part of the base installation, because namcap said it was missing.

Offline

#2 2006-08-03 18:42:27

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: xmlcopyeditor PKGBUILD for review

I beleive that Arch's wxgtk has unicode:

$ cat /usr/bin/wx-config 
#!/bin/bash
if [ "$WANT_WXGTK" = "gtk" ] ; then
  /usr/lib/wx/config/gtk-ansi-release-2.6 $@
elif [ "$WANT_WXGTK" = "gtk2" ] ; then
  /usr/lib/wx/config/gtk2-ansi-release-2.6 $@
else 
  /usr/lib/wx/config/gtk2-unicode-release-2.6 $@
fi

Perhaps you could define the WANT_WXGTK in the PKGBUILD like so:

WANT_WXGTK=unicode

and it will use the Arch's unicode wxgtk to build so you won't have to build wxgtk. I haven't tried it so I don't know how well it will work.

Offline

#3 2006-08-04 02:46:13

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

Re: xmlcopyeditor PKGBUILD for review

And you are correct, the Arch wxgtk does indeed have unicode. I looked at the wxgtk PKGBUILD in CVS when I first started on this, and I saw what I expected to see, instead of what is really there. Maybe I read the lines for gtk and gdk and didn't bother to read the line for wxgtk. My apologies. In fact, it appears that if unicode is there, wx-config will find it by default, so I didn't need to use WANT_WXGTK.

Here is the revised PKGBUILD, much smaller and much, much, faster. The two sed commands convert the old static libraries with absolute paths to the  standard shared library syntax, e.g., -lwx_gtk2u_stc-2.6 and so forth.

# Contributor: David Scholl <djscholl>
pkgname=xmlcopyeditor
pkgver=1.0.6.5
pkgrel=1
pkgdesc="XML editor based on Scintilla."
url="http://xml-copy-editor.sourceforge.net"
license="custom"
depends=(gcc gtk2 libxxf86vm wxgtk)
makedepends=(pkgconfig boost libxml2 libxslt pcre)
source=("http://dl.sourceforge.net/sourceforge/xml-copy-editor/$pkgname-$pkgver.tar.gz")
md5sums=('11bee785eba8ebf4724b0d3d594b78e6')

build() {
  cd $startdir/src/$pkgname-$pkgver
  sed -i "s;/usr/local/lib/libwx_;-lwx_;g" ./src/Makefile.in
  sed -i "/-lwx_/s/.a//g" ./src/Makefile.in
  ./configure
  make || return 1
  make DESTDIR=$startdir/pkg install
  
  install -D $startdir/pkg/usr/local/bin/xmlcopyeditor $startdir/pkg/usr/bin/xmlcopyeditor
  mv $startdir/pkg/usr/local/share $startdir/pkg/usr
  rm -Rf $startdir/pkg/usr/local
  install -d $startdir/pkg/usr/share/licenses/$pkgname
  cp -R $startdir/pkg/usr/share/$pkgname/copying/* $startdir/pkg/usr/share/licenses/$pkgname
}

After thinking about it some more, I decided to remove libgnome from the dependencies, and write the install script to say that for the Browser command and some of the Help commands to work, the GNOME desktop is required. Libgnome by itself brings a lot of dependencies, and it still doesn't work right (i.e., no HTML browser).

Offline

#4 2006-08-04 03:05:28

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: xmlcopyeditor PKGBUILD for review

One more thing:
Try using
./configure --prefix=/usr
instead of
./configure
It'll probably install the files directly in /usr instead of /usr/local.
To get /opt/gnome/bin in the paths, install  gnome-common (you'll need to logout/relogin to update the paths).
For the html browser problem, try installing yelp. Some gnome apps use it to display xml help files. Or you can install control-center to change the default browser if you don't want to manually edit the config file.

Offline

#5 2006-08-04 10:43:10

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

Re: xmlcopyeditor PKGBUILD for review

Thanks for the additional comments.

In the current version, the --prefix=/usr has no effect, so I removed it. The Makefile is hardwired to use /usr/local. My understanding is that the author of the package will correct this in the near future.

I'm puzzled by what you say about GNOME, because I already had gnome-common installed, and I still didn't have /opt/gnome/bin in my path. I already had yelp installed, to get the help in scribes working, so I tried removing it. I found out that xmlcopyeditor doesn't use yelp, because the top Help pick "XML Copy Editor Help" still worked as before. The next three picks, "Online Help", "Home", and "Download Source" still didn't work, as before. For me, installing control-center is 17 packages for 24 MB, which seems pretty close to installing the rest of GNOME. I'll try it and see if it gets things working.

Offline

#6 2006-08-04 22:40:17

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: xmlcopyeditor PKGBUILD for review

djscholl wrote:

I'm puzzled by what you say about GNOME, because I already had gnome-common installed, and I still didn't have /opt/gnome/bin in my path.

Try reinstalling gnome-common and relogin. It should work. gnome-common provides /etc/profile.d/gnome.sh which sets the path.
Is /etc/profile sourced when you login? I have to put:

[ -f /etc/profile ] && . /etc/profile

in my .xinitrc

djscholl wrote:

I already had yelp installed, to get the help in scribes working, so I tried removing it. I found out that xmlcopyeditor doesn't use yelp, because the top Help pick "XML Copy Editor Help" still worked as before. The next three picks, "Online Help", "Home", and "Download Source" still didn't work, as before. For me, installing control-center is 17 packages for 24 MB, which seems pretty close to installing the rest of GNOME. I'll try it and see if it gets things working.

I don't think you need control-center. "Home" and "Download Source" works here. They start a new tab in firefox. "Online Help" doesn't work. Probably I don't have the correct email client. It prints an

Error showing url: There was an error launching the default action command associated with this location.

I have "export BROWSER=firefox" in my .bashrc but it doesn't seem to be used by  xmlcopyeditor.

Offline

#7 2006-08-05 02:34:12

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

Re: xmlcopyeditor PKGBUILD for review

I don't have /etc/profile sourced at all. I always wondered where those gnome paths were set, but I had never come across it.

I added the profile command you posted in $HOME/.bash_profile and logged out and back in. /opt/gnome/bin is now in my path. I didn't put it in .xinitrc because I want the application to work even if I am displaying it on a remote machine, tunneling X over ssh. If my understanding is not correct on this please let me know.

Shouldn't /etc/skel/.bash_profile or /etc/shel/.xinitrc have the

[ -f /etc/profile ] && . /etc/profile

line in it? When does that get set for normal users? Does some part of the typical window managers take care of it? I am using vtwm, which has exactly 1 vote in the AUR, and I voted for it, so I'm pretty confident no one else is running it. If I'm getting odd symptoms, this is a prime suspect.

Just out of curiosity, I notice that /usr/X11R6/bin is also in my PATH now. /etc/profile sets both PATH and MANPATH to include X11R6 directories. Are these still required for legacy applications that have not been updated to the new path, or older installations?

When I edit file foo in xmlcopyeditor, it opens up bar and displays error dialog:

foo=temp.txt (created in vi)                 bar=scribes
foo=temp.svg (created in Inkscape)                  bar=Inkscape           
foo=/usr/share/xmlcopyeditor/html/about.html        bar=scribes
foo=/usr/share/xmlcopyeditor/rulesets/American.xml bar=scribes    dialog="File: /usr/share/xmlcopyeditor/rulesets/American.xml The MIME type of the file you are trying to open is not for a text file. MIME type: application/xml." When I click on close, scribes starts up with an empty window.
foo=/usr/share/gettext/projects/TP/teams.html      bar=firefox (opens new tab)

When I click on Help => Online Support, I get an error message back to the xterm saying:
Error showing url: There was an error launching the default action command associated with this location.
The same thing happens for Home and Download Source

So, part of it is working for me now. I can view html in my browser, but it has to be plain html, not xml with an html doctype. However, Home and Download Source still don't work for me.

I'm going to ask the author of xmlcopyeditor to look in on this thread. He might be interested to see where we are with this, and he may have some suggestions.

Offline

#8 2006-08-05 03:58:12

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: xmlcopyeditor PKGBUILD for review

djscholl wrote:

I don't have /etc/profile sourced at all. I always wondered where those gnome paths were set, but I had never come across it.

I added the profile command you posted in $HOME/.bash_profile and logged out and back in. /opt/gnome/bin is now in my path. I didn't put it in .xinitrc because I want the application to work even if I am displaying it on a remote machine, tunneling X over ssh. If my understanding is not correct on this please let me know.

My .bash_profile just source my .bashrc so it doesn't make any difference. I'm using the default .bash_profile

djscholl wrote:

Shouldn't /etc/skel/.bash_profile or /etc/shel/.xinitrc have the

[ -f /etc/profile ] && . /etc/profile

line in it? When does that get set for normal users? Does some part of the typical window managers take care of it? I am using vtwm, which has exactly 1 vote in the AUR, and I voted for it, so I'm pretty confident no one else is running it. If I'm getting odd symptoms, this is a prime suspect.

Display managers like xdm, gdm, kdm source that file. For users using startx or using the console then I guess that line should be in /etc/skel/.bash_profile. File a bug report.

djscholl wrote:

Just out of curiosity, I notice that /usr/X11R6/bin is also in my PATH now. /etc/profile sets both PATH and MANPATH to include X11R6 directories. Are these still required for legacy applications that have not been updated to the new path, or older installations?

Probably the dev forgot to remove it when we switch to xorg7. Mention it in the bug report.

Offline

#9 2006-08-06 01:38:48

djscholl
Member
From: Michigan, USA
Registered: 2006-05-24
Posts: 56

Re: xmlcopyeditor PKGBUILD for review

I find the following six graphical web browsers (that start up in their own window) in the Arch repositories. These are the absolute paths to the binaries in Arch.

/usr/bin/dillo
/opt/gnome/bin/epiphany
/opt/mozilla/bin/firefox
/opt/gnome/bin/galeon
/opt/kde/bin/konqueror
/usr/bin/opera

Offline

Board footer

Powered by FluxBB