Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto: Install and run Maple 9.5 under ppc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
-anusaya-
n00b
n00b


Joined: 14 Dec 2004
Posts: 28
Location: New Zealand

PostPosted: Wed Dec 15, 2004 8:56 am    Post subject: Howto: Install and run Maple 9.5 under ppc Reply with quote

If you are fortunate enough to have an academic license for Maple, or rich enough to have purchased a standard license for Maple, then you may be pleased to know that it is possible to install and run Maple under ppc.


Install maple

Our first task is to install maple. You may already have Maple installed on an x86 machine, in which case you can copy the installed files to your ppc machine.


If however, you do not have access to an x86 box, then you can use the following ebuild to install maple:

1. copy the following ebuild into your portage overlay
Code:
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils

DESCRIPTION="Maple is a symbolic algebra maths package"
HOMEPAGE="http://www.maplesoft.com/"
SRC_URI="maple-resource1-${PV}.zip"
LICENSE="Maple"

SLOT="0"
KEYWORDS="ppc"
IUSE="X tetex"

DEPEND="app-arch/unzip"
RDEPEND="X? ( virtual/x11 )
 virtual/jre"

RESTRICT="fetch nostrip"

S=${WORKDIR}

src_install() {

 JAR="manifest_zg_ia_sf.jar"
 MANIFESTS="${S}/\$IA_PROJECT_DIR\$/manifests"

 mkdir -p ${S}/${P}
 mkdir -p ${S}/${PN}

 mkdir ${S}/${P}/bin
 cd ${S}/${P}/bin
 unzip ${MANIFESTS}/bin.${JAR}
 sed -i -e "s:\${MAPLE_JRE_BIN}:\${JAVA_HOME}/bin/:" maple
 sed -i -e "s:/usr/local/maple:/opt/${P}:" maple
 sed -i -e "s:/usr/local/maple:/opt/${P}:" xmaple
 sed -i -e "s:/usr/local/maple:/opt/${P}:" mint
 chmod 755 ./*

 mkdir ${S}/${P}/bin.IBM_INTEL_LINUX
 cd ${S}/${P}/bin.IBM_INTEL_LINUX
 unzip ${MANIFESTS}/bin.ibm_intel_linux.${JAR}
 chmod -R 755 ./*
 ln -s libgmp.so.3.3.0 libgmp.so
 ln -s libgmp.so.3.3.0 libgmp.so.3
 echo [user-settings] > maplesys.ini
 echo MultiUserProfile=1 >> maplesys.ini
 echo Network=0 >> maplesys.ini

 mkdir ${S}/${P}/data
 cd ${S}/${P}/data
 unzip ${MANIFESTS}/data.${JAR}

 if use tetex; then
  mkdir ${S}/${PN}/latex
  cd ${S}/${PN}/latex
  unzip ${MANIFESTS}/etc.${JAR}
 fi

 mkdir ${S}/${PN}/examples
 cd ${S}/${PN}/examples
 unzip ${MANIFESTS}/examples.${JAR}

 mkdir ${S}/${PN}/extern
 cd ${S}/${PN}/extern
 unzip ${MANIFESTS}/extern.${JAR}

 mkdir ${S}/${P}/lib
 cd ${S}/${P}/lib
 unzip ${MANIFESTS}/lib.${JAR}

 cd ${S}
 unzip ${MANIFESTS}/man.${JAR}
 doman man1/*.1

 mkdir ${S}/readmes
 cd ${S}/readmes
 unzip ${MANIFESTS}/readmes.${JAR}
 dodoc ./*

 mkdir ${S}/${PN}/samples
 cd ${S}/${PN}/samples
 unzip ${MANIFESTS}/samples.${JAR}

 if use X; then
  mkdir ${S}/${P}/afm
  cd ${S}/${P}/afm
  unzip ${MANIFESTS}/afm_unix.${JAR}

  mkdir ${S}/${P}/X11_defaults
  cd ${S}/${P}/X11_defaults
  unzip ${MANIFESTS}/X11_defaults.${JAR}
 fi

 mkdir ${S}/${P}/java
 cd ${S}/${P}/java
 unzip ${MANIFESTS}/java.${JAR}

 mkdir ${D}/opt
 mv ${S}/${P} ${D}/opt
 mkdir -p ${D}/usr/share
 mv ${S}/${PN} ${D}/usr/share

 exeinto /opt/${P}/bin.IBM_INTEL_LINUX
 doexe ${S}/\$DAY\$/internal/bin.IBM_INTEL_LINUX/dectool
 insinto /opt/${P}/license
 doins ${S}/\$DAY\$/license/Network/license.dat

}

pkg_postinst() {

 einfo "In order to use Maple you will need to register your copy."
 einfo "As root run:"
 einfo "  cd /opt/${P}"
 einfo "  ./bin.IBM_INTEL_LINUX/dectool SERIALNUM ./license.license.dat"
 einfo "Note: you will need a valid Maple9.5 serial number"

}



2. copy the maple install zipfile into your distfiles directory
Code:

mount -t iso9660 /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/Linux/Disk1/InstData/Resource1.zip /usr/portage/distfiles/maple-resource1-9.5.zip


3. install maple
Code:

ebuild /path/to/maple-9.5.ebuild digest
emerge maple



Install qemu

Maple's installed, but we can't run it without qemu. Maple uses a client-server architecture, and both the client and server need to be run with qemu in user-mode. Unfortunately the Maple server does not play nice with qemu; it segfaults when trying to accept a socket connection. This can be overcome with a little qemu patching. Install qemu with the following patch.


Code:
--- qemu-0.6.1-orig/linux-user/syscall.c 2004-11-15 09:51:33.000000000 +1300
+++ qemu-0.6.1/linux-user/syscall.c 2004-12-13 22:46:47.835009536 +1300
@@ -692,16 +692,10 @@
     case SOCKOP_accept:
         {
             int sockfd = tswap32(vptr[0]);
-            void *target_addr = (void *)tswap32(vptr[1]);
-            uint32_t *target_addrlen = (void *)tswap32(vptr[2]);
-            socklen_t addrlen = tswap32(*target_addrlen);
-            void *addr = alloca(addrlen);
+            struct sockaddr *addr = (void *)tswap32(vptr[1]);
+            socklen_t *addrlen = (void *)tswap32(vptr[2]);
 
-            ret = get_errno(accept(sockfd, addr, &addrlen));
-            if (!is_error(ret)) {
-                host_to_target_sockaddr(target_addr, addr, addrlen);
-                *target_addrlen = tswap32(addrlen);
-            }
+            ret = get_errno(accept(sockfd, addr, addrlen));
         }
         break;
     case SOCKOP_getsockname:



Now we need access to a set of x86 libraries. You can either mount an x86 system, or install a set of precompiled x86 libraries. Note: qemu does not yet work with libraries compiled with USE="nptl". If you do not have a set of x86 libraries compiled without nptl, then a set can be found [url=dev.gentoo.org/~avenj/bins]here[/url].


binfmt_misc

When the Maple client is run, it in turn runs an instance of the Maple server. We need to ensure that the server is run using qemu-i386. We accomplish this by using binfmt_misc.


1. ensure binfmt_misc is compiled into the kernel (either built-in or as a module)
Code:
Platform options --->
  [*] Kernel support for MISC binaries



2. mount binfmt_misc
Code:
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc



3. register all x86 binaries to be run using our qemu-i386 wrapper.
Code:
echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:
\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386-wrapper:' > /proc/sys/fs/binfmt_misc/register

echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:
\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386-wrapper:' > /proc/sys/fs/binfmt_misc/register

Note: the above code contains two commands in the format of "echo 'foo' > /proc/bar"; Each command should be entered as one long line - you'll need to take out the newline just before the string of '\xff' tokens.


4. Put the following qemu-i386-wrapper in /usr/bin
Code:
#!/bin/sh
/usr/bin/qemu-i386 -L /usr/lib/qemu/x86 "$@"

Note: make sure that the above wrapper points to the correct location of the x86 libraries.


Register and Run Maple

1. register you licensed copy of Maple:
Code:
cd /opt/maple-9.5
./bin.IBM_INTEL_LINUX/dectool SERIALNUM license/license.dat

Of course, SERIALNUM should be replaced with your valid serial number; contact www.maplesoft.com if you need to buy a license.


2. run maple. The qemu wrapper and binfmt_misc will make sure all x86 binaries are run correctly.
Code:
/opt/maple-9.5/bin/maple (for console mode)
/opt/maple-9.5/bin/xmaple (for java windowed mode)



Disclaimer

This "works for me" on a 12" iBook 1.2. I can't guarantee what success you have; certainly a lot more testing is needed. Known issues include:

- some of the later implementations of glibc include syscalls that qemu does not implement. Warnings about these syscalls can safely be ignored.
- on some systems backspace doesn't work
- signal handlers are not initialized correctly when maple is run in console mode. No negative effects of this have been encountered.
- if you want to run Maple in 'classic worksheet' mode (i.e. ugly-as-a-bagful-of-arseholes Motif interface), then you'll need x86 X11 libraries.
Back to top
View user's profile Send private message
atom
Tux's lil' helper
Tux's lil' helper


Joined: 25 Nov 2002
Posts: 122
Location: Columbus, Ohio, USA

PostPosted: Thu Dec 16, 2004 10:09 pm    Post subject: Reply with quote

you should consider putting this in the wiki:

http://gentoo-wiki.com
_________________
ubuntu.
Back to top
View user's profile Send private message
iTux
Guru
Guru


Joined: 07 Sep 2004
Posts: 586
Location: Toronto

PostPosted: Thu Dec 16, 2004 11:16 pm    Post subject: Reply with quote

Quote:

Now we need access to a set of x86 libraries. You can either mount an x86 system, or install a set of precompiled x86 libraries. Note: qemu does not yet work with libraries compiled with USE="nptl". If you do not have a set of x86 libraries compiled without nptl, then a set can be found


The other day I thought it would be really cool to do it the Gentoo way... and to cross-compile all the x86 binaries required for the x86 application.

With cross-compilation support making its way into portage... that would could be an interesting goal :)


iTux
Back to top
View user's profile Send private message
smerrima
n00b
n00b


Joined: 16 Mar 2004
Posts: 47
Location: Boise, ID

PostPosted: Thu Jan 13, 2005 10:49 pm    Post subject: Reply with quote

Is there an existing ebuild for x86? Would the one above work?
_________________
-Seth
Back to top
View user's profile Send private message
-anusaya-
n00b
n00b


Joined: 14 Dec 2004
Posts: 28
Location: New Zealand

PostPosted: Sat Jan 15, 2005 1:27 am    Post subject: Reply with quote

smerrima wrote:
Is there an existing ebuild for x86? Would the one above work?

The above ebuild should work fine for x86; of course you'll need to add x86 in KEYWORDS. The ebuild just unzips a bunch of jar files, instead of running Maple's installer.
Back to top
View user's profile Send private message
Patchoulol
n00b
n00b


Joined: 12 Mar 2004
Posts: 17

PostPosted: Sun Jan 16, 2005 11:52 am    Post subject: Reply with quote

Do you know how to make the 9.0 version working?
Back to top
View user's profile Send private message
-anusaya-
n00b
n00b


Joined: 14 Dec 2004
Posts: 28
Location: New Zealand

PostPosted: Mon Jan 17, 2005 11:50 pm    Post subject: Reply with quote

Patchoulol wrote:
Do you know how to make the 9.0 version working?

I don't have Maple-9.0 so I really can't say. If Maple-9.0 contains similarly named jar files as Maple-9.5 then the above ebuild should work. Feel free to post any errors if that is not the case.
Back to top
View user's profile Send private message
resolute
n00b
n00b


Joined: 23 Jan 2005
Posts: 29
Location: Texas, USA

PostPosted: Sun Jan 23, 2005 11:32 am    Post subject: Reply with quote

Nice howto!

Is there any restriction on the version of the jdk?
_________________
"Our Nation - this generation - will lift a dark threat of violence from our people and our future. We will rally the world to this cause by our efforts, by our courage. We will not tire, we will not falter, and we will not fail."
Back to top
View user's profile Send private message
-anusaya-
n00b
n00b


Joined: 14 Dec 2004
Posts: 28
Location: New Zealand

PostPosted: Sun Jan 23, 2005 9:37 pm    Post subject: Reply with quote

There is no problem with using a jdk instead of a jre. On x86 I've used:
Code:
blackdown-jdk-1.3.1
blackdown-jdk-1.4.*
sun-j2sdk-1.4.*
sun-jdk-1.3.1.13
sun-jdk-1.4.2.*

On ppc I've used:
Code:
blackdown-jdk-1.3.1
ibm-jdk-bin-1.4.*
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum