Linux package. 4tH 4tH Forth compiler
Reklaam
Reklaam
CHAPTER 3. INSTALLATION GUIDE
• Intel - BeOS
• Intel - Plan9
• RS/6000 - AIX
• NeXT - NS
• Apple - OS/X
• Sun - Solaris
• ARM - RISC/OS
• ARM - Android
• Intel - Linux
• Zaurus - Linux
• Raspberry Pi - Linux
• Ben Nanonote - Linux
• Zipit Z2 - Linux
• Nokia N810 - Linux
• Apple - Linux
31
If your platform is not listed, give it a try anyway. The chances are it will compile flawlessly, since we’ve never had a report of a Unix platform that refused to compile or run 4tH.
Please send us an email with your results, so we can add it (or remove it) from our list.
You have to compile 4tH yourself, which is not difficult if you read the ’Developers Guide’.
Usually this will do the trick: make make install
If you have any special needs, feel free to edit the makefile.
3.1.3.1
Updating
Simply install the package. Unless you’ve used a different location or different options the previous time, it will simply overwrite the previous executables. If you still have 4thd,
4thg
, 4thx or 4thc somewhere on your drive, delete them. That’s ancient stuff!
3.1.4
Linux package
You will find Linux binaries in this package. They will run under most modern Linux distributions for Intel . If the Linux binary doesn’t run, you can easily recompile it. Just enter: make make install
CHAPTER 3. INSTALLATION GUIDE 32
You don’t have to run ’./configure’. If you have any special needs, feel free to edit the makefile, e.g. compiling for the Zaurus means you have to add the ’-DZAURUS’ option.
You’ll also find some icons for KDE or GNOME and a ’man’ page. However, you have to install them manually. If you want to embed 4tH in KDE or GNOME you have to do that manually as well. Please consult your KDE or GNOME documentation.
You can place the 4tH executable any place you want. It doesn’t require any external files.
3.1.4.1
Copying the tarball to your platform
If you’re using an exotic platform like the ones listed here, you may experience some problems getting the tarball onto your device. We will give you some directions on selected platforms.
Ben Nanonote
The easiest way is to copy the tarball onto a micro-SD card and boot your Ben Nanonote.
You’ll find the tarball under /card. Copy it to the location of your choice and proceed as usual.
If not, perform this procedure. First, be sure you have set the password of ”root” under your
Ben Nanonote. Second, you have to connect the Ben Nanonote to the USB port of your host computer. Finally, enter the following commands (as root) on your host computer: ifconfig usb0 192.168.254.100
scp <4tH tarball> [email protected]:~/
The 4tH tarball will end up in the $HOME directory of ”root” on your Ben Nanonote.
Proceed as usual.
3.1.4.2
/etc/magic
If you want Linux to recognize your 4tH files, you have to add the following lines to your
/etc/magic file:
# From [email protected]
# These are the magic numbers for 4tH HX files
0
>9 belong leshort x
0x01020400
\b, version %x
4tH eXecutable
E.g. if you enter: file editor.hx
It will respond: editor.hx: 4tH eXecutable, version 362
CHAPTER 3. INSTALLATION GUIDE 33
3.1.4.3
Using binfmt_misc
There is a module in Linux that will allow you to execute 4tH programs from the prompt without explicitly calling the 4tH interpreter. It is called ’binfmt_misc’. 4tH has built-in support for this module. Just add the following lines to your ’boot.local’
1 file: insmod binfmt_misc cd /proc/sys/fs/binfmt_misc echo ’:HX:M::\x01\x02\x04\x00\xff\xff\xff\x7f\x04\x62\x03\x08:
:/usr/local/bin/4thx:’ >register
If you use a kernel version later than 2.4.13 you have to add these lines: insmod binfmt_misc mount -t binfmt_misc none /proc/sys/fs/binfmt_misc cd /proc/sys/fs/binfmt_misc echo ’:HX:M::\x01\x02\x04\x00\xff\xff\xff\x7f\x04\x62\x03\x08:
:/usr/local/bin/4thx:’ >register
You can find out whether 4tH support has been properly installed by issuing: cd /proc/sys/fs/binfmt_misc cat HX
And Linux should answer: enabled interpreter /usr/local/bin/4thx offset 0 magic 01020400ffffff7f04620308
Finally, you should go to the directory where 4tH has been installed (usually /usr/local/bin) and enter: ln -s 4th 4thx
Now, after you’ve compiled a program you should make it executable and it will run like it is a native executable, e.g.:
4th cs asc2html.4th asc2html chmod 755 asc2html asc2html ascii7.4th ascii7.html
Note you have to be root in order to run some of these commands!
3.1.4.4
DIR4TH environment variable
This variable is used to indicate where 4tHs default directory is. If a sourcefile cannot be found in the current directory, the compiler
2 will try to get it here. You can set this environment variable in your .profile or .bashrc file. Simply login into your default user account and type:
1
On SuSE ’boot.local’ is located in the /sbin/init.d directory.
2
That is: the compiler, not the editor or anything else.
Laadi alla
Reklaam