├── .gitignore ├── .travis.yml ├── README.rst ├── binutils ├── HARBOUR └── pex-helenos.c ├── build_all.sh ├── config.guess ├── config.sub ├── facade ├── ar ├── as ├── cc ├── cpp ├── cxx ├── nm ├── objcopy ├── objdump ├── ranlib └── strip ├── fdlibm └── HARBOUR ├── gcc ├── HARBOUR ├── gcc.specs ├── includes.patch ├── libiberty.patch └── pex-helenos.c ├── gzx └── HARBOUR ├── hsct.sh ├── jainja ├── HARBOUR ├── Makefile.patch ├── headers.patch └── jainja.batch ├── libgmp ├── HARBOUR └── gmp-h.patch ├── libiconv └── HARBOUR ├── libisl └── HARBOUR ├── libmpc └── HARBOUR ├── libmpfr └── HARBOUR ├── libpng └── HARBOUR ├── lua ├── HARBOUR ├── conf.patch └── log2.patch ├── msim ├── HARBOUR ├── Makefile ├── config.h ├── helenos.h ├── input.c └── misc.c ├── pcc ├── HARBOUR ├── ccconfig.h └── pcc-helenos.patch ├── python2 ├── HARBOUR ├── configure ├── configure.ac ├── cross-tools.patch ├── modules.patch ├── posixmodule.patch └── posixpath.patch ├── sycek └── HARBOUR ├── travis.sh └── zlib └── HARBOUR /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | dist: xenial 3 | sudo: required 4 | env: 5 | global: 6 | - CROSS_PREFIX=/usr/local/cross/ 7 | matrix: 8 | - H_HARBOUR=fdlibm H_ARCH=amd64 9 | - H_HARBOUR=fdlibm H_ARCH=arm32/beagleboardxm 10 | - H_HARBOUR=fdlibm H_ARCH=arm32/beaglebone 11 | - H_HARBOUR=fdlibm H_ARCH=arm32/gta02 12 | - H_HARBOUR=fdlibm H_ARCH=arm32/integratorcp 13 | - H_HARBOUR=fdlibm H_ARCH=arm32/raspberrypi 14 | - H_HARBOUR=fdlibm H_ARCH=ia32 15 | - H_HARBOUR=fdlibm H_ARCH=ia64/i460GX 16 | - H_HARBOUR=fdlibm H_ARCH=ia64/ski 17 | - H_HARBOUR=fdlibm H_ARCH=mips32/malta-be 18 | - H_HARBOUR=fdlibm H_ARCH=mips32/malta-le 19 | - H_HARBOUR=fdlibm H_ARCH=mips32/msim 20 | - H_HARBOUR=fdlibm H_ARCH=ppc32 21 | - H_HARBOUR=fdlibm H_ARCH=sparc64/niagara 22 | - H_HARBOUR=fdlibm H_ARCH=sparc64/ultra 23 | - H_HARBOUR=zlib H_ARCH=amd64 24 | - H_HARBOUR=zlib H_ARCH=arm32/beagleboardxm 25 | - H_HARBOUR=zlib H_ARCH=arm32/beaglebone 26 | - H_HARBOUR=zlib H_ARCH=arm32/gta02 27 | - H_HARBOUR=zlib H_ARCH=arm32/integratorcp 28 | - H_HARBOUR=zlib H_ARCH=arm32/raspberrypi 29 | - H_HARBOUR=zlib H_ARCH=ia32 30 | - H_HARBOUR=zlib H_ARCH=ia64/i460GX 31 | - H_HARBOUR=zlib H_ARCH=ia64/ski 32 | - H_HARBOUR=zlib H_ARCH=mips32/malta-be 33 | - H_HARBOUR=zlib H_ARCH=mips32/malta-le 34 | - H_HARBOUR=zlib H_ARCH=mips32/msim 35 | - H_HARBOUR=zlib H_ARCH=ppc32 36 | - H_HARBOUR=zlib H_ARCH=sparc64/niagara 37 | - H_HARBOUR=zlib H_ARCH=sparc64/ultra 38 | - H_HARBOUR=msim H_ARCH=amd64 39 | - H_HARBOUR=msim H_ARCH=arm32/beagleboardxm 40 | - H_HARBOUR=msim H_ARCH=arm32/beaglebone 41 | - H_HARBOUR=msim H_ARCH=arm32/gta02 42 | - H_HARBOUR=msim H_ARCH=arm32/integratorcp 43 | - H_HARBOUR=msim H_ARCH=arm32/raspberrypi 44 | - H_HARBOUR=msim H_ARCH=ia32 45 | - H_HARBOUR=msim H_ARCH=ia64/i460GX 46 | - H_HARBOUR=msim H_ARCH=ia64/ski 47 | - H_HARBOUR=msim H_ARCH=mips32/malta-be 48 | - H_HARBOUR=msim H_ARCH=mips32/malta-le 49 | - H_HARBOUR=msim H_ARCH=mips32/msim 50 | - H_HARBOUR=msim H_ARCH=ppc32 51 | - H_HARBOUR=msim H_ARCH=sparc64/niagara 52 | - H_HARBOUR=msim H_ARCH=sparc64/ultra 53 | - H_HARBOUR=binutils H_ARCH=ia32 54 | - H_HARBOUR=gcc H_ARCH=ia32 55 | - H_HARBOUR=gzx H_ARCH=ia32 56 | - H_HARBOUR=jainja H_ARCH=ia32 57 | - H_HARBOUR=libgmp H_ARCH=ia32 58 | - H_HARBOUR=libiconv H_ARCH=ia32 59 | - H_HARBOUR=libisl H_ARCH=ia32 60 | - H_HARBOUR=libmpc H_ARCH=ia32 61 | - H_HARBOUR=libmpfr H_ARCH=ia32 62 | - H_HARBOUR=libpng H_ARCH=ia32 63 | - H_HARBOUR=pcc H_ARCH=ia32 64 | - H_HARBOUR=python2 H_ARCH=ia32 65 | - H_HARBOUR=sycek H_ARCH=ia32 66 | - H_HARBOUR=lua H_ARCH=amd64 67 | - H_HARBOUR=lua H_ARCH=arm32/beagleboardxm 68 | - H_HARBOUR=lua H_ARCH=arm32/beaglebone 69 | - H_HARBOUR=lua H_ARCH=arm32/gta02 70 | - H_HARBOUR=lua H_ARCH=arm32/integratorcp 71 | - H_HARBOUR=lua H_ARCH=arm32/raspberrypi 72 | - H_HARBOUR=lua H_ARCH=ia32 73 | - H_HARBOUR=lua H_ARCH=ia64/i460GX 74 | - H_HARBOUR=lua H_ARCH=ia64/ski 75 | - H_HARBOUR=lua H_ARCH=mips32/malta-be 76 | - H_HARBOUR=lua H_ARCH=mips32/malta-le 77 | - H_HARBOUR=lua H_ARCH=mips32/msim 78 | - H_HARBOUR=lua H_ARCH=ppc32 79 | - H_HARBOUR=lua H_ARCH=sparc64/niagara 80 | - H_HARBOUR=lua H_ARCH=sparc64/ultra 81 | before_install: 82 | - sudo apt-get update -qq 83 | - sudo apt-get install -qq genisoimage 84 | - sudo apt-get install -qq python3-pip 85 | - sudo apt-get install -qq python3-setuptools 86 | - pip3 install ninja 87 | - pip3 install meson 88 | - ./travis.sh install 89 | script: 90 | - ./travis.sh run 91 | os: 92 | - linux 93 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | HelenOS coastline: build POSIX applications for HelenOS 2 | ======================================================= 3 | 4 | This repository contains scripts that should simplify porting POSIX 5 | applications to run in `HelenOS `_. 6 | The motivation for this mini-project is that porting GNU/POSIX applications 7 | to HelenOS is mostly about setting correctly the CFLAGS when running 8 | ``./configure`` and then copying the generated executables somewhere to 9 | ``uspace/dist``. 10 | The idea is that this procedure would be recorded in a form of a simple shell 11 | script, called harbour (because it is a port). 12 | The wrapper script ``hsct.sh`` then takes care of downloading the necessary 13 | sources and running the user-defined commands from respective ``HARBOUR`` file. 14 | 15 | The whole idea is highly inspired by 16 | `makepkg `_. 17 | 18 | 19 | **WARNING**: some information here is obsoleted. 20 | I will try to update it as soon as possible. 21 | 22 | Using the coastline 23 | ------------------- 24 | First, clone this repository somewhere on your disk. 25 | The examples below would assume ``~/helenos/coast``. 26 | 27 | Next, prepare the directory where the actual building of the POSIX 28 | applications would happen. 29 | It is recommended to do this outside HelenOS source tree and outside of the 30 | coast-line sources. 31 | ``~/helenos/coast-builds/ia32`` is a good choice if you plan to build for 32 | ``ia32`` configuration. 33 | 34 | Next, you obviously need check-out of HelenOS sources. 35 | In the following examples, I would assume ``~/helenos/mainline``. 36 | 37 | To use the coastline, go into the ``~/helenos/coast-builds/ia32`` and 38 | issue the following command:: 39 | 40 | ~/helenos/coast/hsct.sh init ~/helenos/mainline ia32 build 41 | 42 | This command would initialize the build directory and forcefully rebuild 43 | HelenOS to the defaults of ``ia32`` configuration. 44 | Once this command finishes, you can freely play inside ``~/helenos/mainline`` 45 | as all the necessary files are already cached in the build directory. 46 | 47 | Now you can build some software. 48 | Just choose one (for example, ``msim``) and run:: 49 | 50 | ~/helenos/coast/hsct.sh build msim 51 | 52 | It may take a while but it shall eventually produce the simulator binary. 53 | If you want to copy it to your HelenOS source tree, run:: 54 | 55 | ~/helenos/coast/hsct.sh install msim 56 | 57 | If you want to transfer the built files to another machine etc, you may 58 | want to run:: 59 | 60 | ~/helenos/coast/hsct.sh archive msim 61 | 62 | that produces a TAR.XZ file in ``archives`` that you can directly unpack 63 | into the ``uspace/overlay`` directory. 64 | 65 | If you have a multicore machine, you may try setting the variable 66 | ``parallel`` in ``hsct.conf`` inside your build directory to a higher 67 | value to allow parallel builds. 68 | 69 | 70 | 71 | 72 | Writing your own HARBOUR files 73 | ------------------------------ 74 | The ``HARBOUR`` file is actually a shell script fragment. 75 | The coastline script ``hsct.sh`` expects to find some variables and functions 76 | declared in it. 77 | These variables declare URLs of the source tarballs or versions while the 78 | functions actually build (or install) the application/library/whatever. 79 | 80 | Each ``HARBOUR`` is supposed to be in a separate directory. 81 | This directory is placed together with the ``hsct.sh`` script. 82 | 83 | The commands in individual functions are expected to use special 84 | variables prepared by the wrapper script that would contain information 85 | about selected compiler (i.e. full path to GCC) or flags for the compiler 86 | to use. 87 | These variables are prefixed with ``HSCT_`` followed by the name commonly 88 | used in ``Makefile``\s or in ``configure`` scripts 89 | (e.g. ``HSCT_CC`` contains path to the C compiler). 90 | 91 | However, usually it is not possible to write the ``HARBOUR`` file directly: 92 | for example various arguments to ``./configure`` scripts have to be tried 93 | or extra ``CFLAGS`` might be necessary. 94 | 95 | For testing, you can use the ``helenos/env.sh`` script and source it. 96 | This script sets all the variables that you can use in the HARBOUR script. 97 | 98 | Follows a shortened list of variables available. 99 | 100 | - ``$HSCT_CC``: C compiler to use. 101 | - ``$HSCT_CFLAGS``: C flags to use. 102 | - ``$HSCT_LD``: linker to use. 103 | - ``$HSCT_LDFLAGS``: linker flags 104 | - ``$HSCT_LDFLAGS_FOR_CC``: linker flags preceded by ``-Wl,``. 105 | This is extremely useful when linker is not called explicitly and compiler 106 | is used for linking as well. 107 | Some of the flags would be recognized during the compilation phase so 108 | marking them as linker-specific effectively hides them. 109 | - ``$HSCT_GNU_TARGET``: Target for which the application is being built. 110 | Typically this is the value for the ``--target`` option of the ``configure`` 111 | script. 112 | - ``$HSCT_INCLUDE_DIR``: Points to directory for header files. 113 | This directory is shared by all packages. 114 | - ``$HSCT_LIB_DIR``: Points to directory for libraries. 115 | - ``$HSCT_MY_DIR``: Points to installation directory. 116 | All files that shall appear in HelenOS must be copied here. 117 | The structure of this directory shall mirror the HelenOS one 118 | (i.e. the ``app/`` and ``inc/`` directories). 119 | 120 | For example, the ``./configure`` script for `libgmp `_ 121 | uses the following variables:: 122 | 123 | run ./configure \ 124 | --disable-shared \ 125 | --host="$HSCT_GNU_TARGET" \ 126 | CC="$HSCT_CC" \ 127 | CFLAGS="$HSCT_CFLAGS $HSCT_LDFLAGS_FOR_CC " \ 128 | LD="$HSCT_LD" 129 | 130 | Once you know the command sequence that leads to a successful built you 131 | should record this sequence into the ``HARBOUR`` file. 132 | The easiest way is to take an existing one and just change it for the 133 | particular application. 134 | 135 | The variable ``shipname`` declares the package (application or library) 136 | name and shall be the same as the directory the ``HARBOUR`` is part of. 137 | 138 | The variable ``shipsources`` contains space separated list of tarballs 139 | or other files that needs to be downloaded. 140 | Obviously, you can use ``$shipname`` inside as shell does the expansion. 141 | To simplify updating of the packages, it is a good practice to have 142 | variable ``$shipversion`` containing the application version and use this 143 | variable inside ``$shipsources``. 144 | If you need to reference a local file (a patch for example), 145 | just write a bare name there. 146 | The files are downloaded with ``wget`` so make sure the protocol used 147 | and the path format is supported by this tool. 148 | Git repositories to clone can be specified with the syntax 149 | ``git:localdir:[revision]:url`` where ``localdir`` is the name of the 150 | local directory to which the repository is cloned. ``revision`` is the 151 | revision to check out and ``url`` is the URL of the git repository. 152 | 153 | The variable ``shiptugs`` declares packages this one depends on 154 | (the twisted fun is here that tugs are required for the ship to actually 155 | leave the harbour). 156 | That is a string with space separated list of other ships. 157 | 158 | For building is used a ``build()`` function. 159 | The function is expected to complete the following tasks: 160 | 161 | - unpack the tarballs 162 | - configure the application or somehow prepare it for building 163 | - actually build it 164 | 165 | If you want to print an informative message to the screen, it is recommended 166 | to use ``msg()`` function as it would make the message more visible. 167 | 168 | To simplify debugging it is recommended to run commands prefixed with 169 | function named ``run``. 170 | That way the actual command is first printed to the screen and then 171 | executed. 172 | 173 | Below is an example from ``libgmp`` that illustrates a typical 174 | ``build()`` function:: 175 | 176 | # Manually extract the files 177 | run tar xjf "${shipname_}-${shipversion}.tar.bz2" 178 | 179 | # HelenOS-specific patches are needed 180 | msg "Patching gmp.h..." 181 | patch -p0 helenos.log 2>&1 54 | 55 | if [ $? -eq 0 ]; then 56 | echo "OK" 57 | cd .. 58 | else 59 | echo "FAILED" 60 | cd .. 61 | rm -rf $pdir 62 | fi 63 | done 64 | 65 | for p in $profiles; do 66 | pdir=`echo $p | sed 's/\//_/g'` 67 | 68 | cd $pdir || continue 69 | 70 | for h in $harbours; do 71 | printf "%-32s " "$p:$h" 72 | 73 | echo "$excludes" | grep "$p:$h" > /dev/null 74 | if [ $? -eq 0 ]; then 75 | echo "ign" 76 | continue 77 | fi 78 | 79 | ../../hsct.sh archive --no-deps $h >$h.log 2>&1 80 | rc=$? 81 | case $rc in 82 | "0") 83 | echo "OK" 84 | ;; 85 | "62" | "63") 86 | echo "FAILED FETCH" 87 | ;; 88 | "64") 89 | echo "dep" 90 | ;; 91 | "66") 92 | echo "FAILED BUILD" 93 | ;; 94 | *) 95 | echo "FAILED $rc" 96 | ;; 97 | esac 98 | done 99 | 100 | cd .. 101 | done 102 | -------------------------------------------------------------------------------- /config.sub: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Configuration validation subroutine script. 3 | # Copyright 1992-2018 Free Software Foundation, Inc. 4 | 5 | timestamp='2018-02-22' 6 | 7 | # This file is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, see . 19 | # 20 | # As a special exception to the GNU General Public License, if you 21 | # distribute this file as part of a program that contains a 22 | # configuration script generated by Autoconf, you may include it under 23 | # the same distribution terms that you use for the rest of that 24 | # program. This Exception is an additional permission under section 7 25 | # of the GNU General Public License, version 3 ("GPLv3"). 26 | 27 | 28 | # Please send patches to . 29 | # 30 | # Configuration subroutine to validate and canonicalize a configuration type. 31 | # Supply the specified configuration type as an argument. 32 | # If it is invalid, we print an error message on stderr and exit with code 1. 33 | # Otherwise, we print the canonical config type on stdout and succeed. 34 | 35 | # You can get the latest version of this script from: 36 | # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub 37 | 38 | # This file is supposed to be the same for all GNU packages 39 | # and recognize all the CPU types, system types and aliases 40 | # that are meaningful with *any* GNU software. 41 | # Each package is responsible for reporting which valid configurations 42 | # it does not support. The user should be able to distinguish 43 | # a failure to support a valid configuration from a meaningless 44 | # configuration. 45 | 46 | # The goal of this file is to map all the various variations of a given 47 | # machine specification into a single specification in the form: 48 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 49 | # or in some cases, the newer four-part form: 50 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 51 | # It is wrong to echo any other type of specification. 52 | 53 | me=`echo "$0" | sed -e 's,.*/,,'` 54 | 55 | usage="\ 56 | Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 57 | 58 | Canonicalize a configuration name. 59 | 60 | Options: 61 | -h, --help print this help, then exit 62 | -t, --time-stamp print date of last modification, then exit 63 | -v, --version print version number, then exit 64 | 65 | Report bugs and patches to ." 66 | 67 | version="\ 68 | GNU config.sub ($timestamp) 69 | 70 | Copyright 1992-2018 Free Software Foundation, Inc. 71 | 72 | This is free software; see the source for copying conditions. There is NO 73 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 74 | 75 | help=" 76 | Try \`$me --help' for more information." 77 | 78 | # Parse command line 79 | while test $# -gt 0 ; do 80 | case $1 in 81 | --time-stamp | --time* | -t ) 82 | echo "$timestamp" ; exit ;; 83 | --version | -v ) 84 | echo "$version" ; exit ;; 85 | --help | --h* | -h ) 86 | echo "$usage"; exit ;; 87 | -- ) # Stop option processing 88 | shift; break ;; 89 | - ) # Use stdin as input. 90 | break ;; 91 | -* ) 92 | echo "$me: invalid option $1$help" 93 | exit 1 ;; 94 | 95 | *local*) 96 | # First pass through any local machine types. 97 | echo "$1" 98 | exit ;; 99 | 100 | * ) 101 | break ;; 102 | esac 103 | done 104 | 105 | case $# in 106 | 0) echo "$me: missing argument$help" >&2 107 | exit 1;; 108 | 1) ;; 109 | *) echo "$me: too many arguments$help" >&2 110 | exit 1;; 111 | esac 112 | 113 | # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). 114 | # Here we must recognize all the valid KERNEL-OS combinations. 115 | maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` 116 | case $maybe_os in 117 | nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ 118 | linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ 119 | knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ 120 | kopensolaris*-gnu* | cloudabi*-eabi* | \ 121 | storm-chaos* | os2-emx* | rtmk-nova*) 122 | os=-$maybe_os 123 | basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` 124 | ;; 125 | android-linux) 126 | os=-linux-android 127 | basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown 128 | ;; 129 | *) 130 | basic_machine=`echo "$1" | sed 's/-[^-]*$//'` 131 | if [ "$basic_machine" != "$1" ] 132 | then os=`echo "$1" | sed 's/.*-/-/'` 133 | else os=; fi 134 | ;; 135 | esac 136 | 137 | ### Let's recognize common machines as not being operating systems so 138 | ### that things like config.sub decstation-3100 work. We also 139 | ### recognize some manufacturers as not being operating systems, so we 140 | ### can provide default operating systems below. 141 | case $os in 142 | -sun*os*) 143 | # Prevent following clause from handling this invalid input. 144 | ;; 145 | -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ 146 | -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ 147 | -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ 148 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ 149 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 150 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ 151 | -apple | -axis | -knuth | -cray | -microblaze*) 152 | os= 153 | basic_machine=$1 154 | ;; 155 | -bluegene*) 156 | os=-cnk 157 | ;; 158 | -sim | -cisco | -oki | -wec | -winbond) 159 | os= 160 | basic_machine=$1 161 | ;; 162 | -scout) 163 | ;; 164 | -wrs) 165 | os=-vxworks 166 | basic_machine=$1 167 | ;; 168 | -chorusos*) 169 | os=-chorusos 170 | basic_machine=$1 171 | ;; 172 | -chorusrdb) 173 | os=-chorusrdb 174 | basic_machine=$1 175 | ;; 176 | -hiux*) 177 | os=-hiuxwe2 178 | ;; 179 | -sco6) 180 | os=-sco5v6 181 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 182 | ;; 183 | -sco5) 184 | os=-sco3.2v5 185 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 186 | ;; 187 | -sco4) 188 | os=-sco3.2v4 189 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 190 | ;; 191 | -sco3.2.[4-9]*) 192 | os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` 193 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 194 | ;; 195 | -sco3.2v[4-9]*) 196 | # Don't forget version if it is 3.2v4 or newer. 197 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 198 | ;; 199 | -sco5v6*) 200 | # Don't forget version if it is 3.2v4 or newer. 201 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 202 | ;; 203 | -sco*) 204 | os=-sco3.2v2 205 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 206 | ;; 207 | -udk*) 208 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 209 | ;; 210 | -isc) 211 | os=-isc2.2 212 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 213 | ;; 214 | -clix*) 215 | basic_machine=clipper-intergraph 216 | ;; 217 | -isc*) 218 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` 219 | ;; 220 | -lynx*178) 221 | os=-lynxos178 222 | ;; 223 | -lynx*5) 224 | os=-lynxos5 225 | ;; 226 | -lynx*) 227 | os=-lynxos 228 | ;; 229 | -ptx*) 230 | basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` 231 | ;; 232 | -psos*) 233 | os=-psos 234 | ;; 235 | -mint | -mint[0-9]*) 236 | basic_machine=m68k-atari 237 | os=-mint 238 | ;; 239 | esac 240 | 241 | # Decode aliases for certain CPU-COMPANY combinations. 242 | case $basic_machine in 243 | # Recognize the basic CPU types without company name. 244 | # Some are omitted here because they have special meanings below. 245 | 1750a | 580 \ 246 | | a29k \ 247 | | aarch64 | aarch64_be \ 248 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ 249 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ 250 | | am33_2.0 \ 251 | | arc | arceb \ 252 | | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ 253 | | avr | avr32 \ 254 | | ba \ 255 | | be32 | be64 \ 256 | | bfin \ 257 | | c4x | c8051 | clipper \ 258 | | d10v | d30v | dlx | dsp16xx \ 259 | | e2k | epiphany \ 260 | | fido | fr30 | frv | ft32 \ 261 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 262 | | hexagon \ 263 | | i370 | i860 | i960 | ia16 | ia64 \ 264 | | ip2k | iq2000 \ 265 | | k1om \ 266 | | le32 | le64 \ 267 | | lm32 \ 268 | | m32c | m32r | m32rle | m68000 | m68k | m88k \ 269 | | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ 270 | | mips | mipsbe | mipseb | mipsel | mipsle \ 271 | | mips16 \ 272 | | mips64 | mips64el \ 273 | | mips64octeon | mips64octeonel \ 274 | | mips64orion | mips64orionel \ 275 | | mips64r5900 | mips64r5900el \ 276 | | mips64vr | mips64vrel \ 277 | | mips64vr4100 | mips64vr4100el \ 278 | | mips64vr4300 | mips64vr4300el \ 279 | | mips64vr5000 | mips64vr5000el \ 280 | | mips64vr5900 | mips64vr5900el \ 281 | | mipsisa32 | mipsisa32el \ 282 | | mipsisa32r2 | mipsisa32r2el \ 283 | | mipsisa32r6 | mipsisa32r6el \ 284 | | mipsisa64 | mipsisa64el \ 285 | | mipsisa64r2 | mipsisa64r2el \ 286 | | mipsisa64r6 | mipsisa64r6el \ 287 | | mipsisa64sb1 | mipsisa64sb1el \ 288 | | mipsisa64sr71k | mipsisa64sr71kel \ 289 | | mipsr5900 | mipsr5900el \ 290 | | mipstx39 | mipstx39el \ 291 | | mn10200 | mn10300 \ 292 | | moxie \ 293 | | mt \ 294 | | msp430 \ 295 | | nds32 | nds32le | nds32be \ 296 | | nios | nios2 | nios2eb | nios2el \ 297 | | ns16k | ns32k \ 298 | | open8 | or1k | or1knd | or32 \ 299 | | pdp10 | pj | pjl \ 300 | | powerpc | powerpc64 | powerpc64le | powerpcle \ 301 | | pru \ 302 | | pyramid \ 303 | | riscv32 | riscv64 \ 304 | | rl78 | rx \ 305 | | score \ 306 | | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ 307 | | sh64 | sh64le \ 308 | | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ 309 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ 310 | | spu \ 311 | | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ 312 | | ubicom32 \ 313 | | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ 314 | | visium \ 315 | | wasm32 \ 316 | | x86 | xc16x | xstormy16 | xtensa \ 317 | | z8k | z80) 318 | basic_machine=$basic_machine-unknown 319 | ;; 320 | c54x) 321 | basic_machine=tic54x-unknown 322 | ;; 323 | c55x) 324 | basic_machine=tic55x-unknown 325 | ;; 326 | c6x) 327 | basic_machine=tic6x-unknown 328 | ;; 329 | leon|leon[3-9]) 330 | basic_machine=sparc-$basic_machine 331 | ;; 332 | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) 333 | basic_machine=$basic_machine-unknown 334 | os=-none 335 | ;; 336 | m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) 337 | ;; 338 | ms1) 339 | basic_machine=mt-unknown 340 | ;; 341 | 342 | strongarm | thumb | xscale) 343 | basic_machine=arm-unknown 344 | ;; 345 | xgate) 346 | basic_machine=$basic_machine-unknown 347 | os=-none 348 | ;; 349 | xscaleeb) 350 | basic_machine=armeb-unknown 351 | ;; 352 | 353 | xscaleel) 354 | basic_machine=armel-unknown 355 | ;; 356 | 357 | # We use `pc' rather than `unknown' 358 | # because (1) that's what they normally are, and 359 | # (2) the word "unknown" tends to confuse beginning users. 360 | i*86 | x86_64) 361 | basic_machine=$basic_machine-pc 362 | ;; 363 | # Object if more than one company name word. 364 | *-*-*) 365 | echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 366 | exit 1 367 | ;; 368 | # Recognize the basic CPU types with company name. 369 | 580-* \ 370 | | a29k-* \ 371 | | aarch64-* | aarch64_be-* \ 372 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ 373 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ 374 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ 375 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ 376 | | avr-* | avr32-* \ 377 | | ba-* \ 378 | | be32-* | be64-* \ 379 | | bfin-* | bs2000-* \ 380 | | c[123]* | c30-* | [cjt]90-* | c4x-* \ 381 | | c8051-* | clipper-* | craynv-* | cydra-* \ 382 | | d10v-* | d30v-* | dlx-* \ 383 | | e2k-* | elxsi-* \ 384 | | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ 385 | | h8300-* | h8500-* \ 386 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ 387 | | hexagon-* \ 388 | | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ 389 | | ip2k-* | iq2000-* \ 390 | | k1om-* \ 391 | | le32-* | le64-* \ 392 | | lm32-* \ 393 | | m32c-* | m32r-* | m32rle-* \ 394 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ 395 | | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ 396 | | microblaze-* | microblazeel-* \ 397 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ 398 | | mips16-* \ 399 | | mips64-* | mips64el-* \ 400 | | mips64octeon-* | mips64octeonel-* \ 401 | | mips64orion-* | mips64orionel-* \ 402 | | mips64r5900-* | mips64r5900el-* \ 403 | | mips64vr-* | mips64vrel-* \ 404 | | mips64vr4100-* | mips64vr4100el-* \ 405 | | mips64vr4300-* | mips64vr4300el-* \ 406 | | mips64vr5000-* | mips64vr5000el-* \ 407 | | mips64vr5900-* | mips64vr5900el-* \ 408 | | mipsisa32-* | mipsisa32el-* \ 409 | | mipsisa32r2-* | mipsisa32r2el-* \ 410 | | mipsisa32r6-* | mipsisa32r6el-* \ 411 | | mipsisa64-* | mipsisa64el-* \ 412 | | mipsisa64r2-* | mipsisa64r2el-* \ 413 | | mipsisa64r6-* | mipsisa64r6el-* \ 414 | | mipsisa64sb1-* | mipsisa64sb1el-* \ 415 | | mipsisa64sr71k-* | mipsisa64sr71kel-* \ 416 | | mipsr5900-* | mipsr5900el-* \ 417 | | mipstx39-* | mipstx39el-* \ 418 | | mmix-* \ 419 | | mt-* \ 420 | | msp430-* \ 421 | | nds32-* | nds32le-* | nds32be-* \ 422 | | nios-* | nios2-* | nios2eb-* | nios2el-* \ 423 | | none-* | np1-* | ns16k-* | ns32k-* \ 424 | | open8-* \ 425 | | or1k*-* \ 426 | | orion-* \ 427 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ 428 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ 429 | | pru-* \ 430 | | pyramid-* \ 431 | | riscv32-* | riscv64-* \ 432 | | rl78-* | romp-* | rs6000-* | rx-* \ 433 | | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ 434 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ 435 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ 436 | | sparclite-* \ 437 | | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ 438 | | tahoe-* \ 439 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ 440 | | tile*-* \ 441 | | tron-* \ 442 | | ubicom32-* \ 443 | | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ 444 | | vax-* \ 445 | | visium-* \ 446 | | wasm32-* \ 447 | | we32k-* \ 448 | | x86-* | x86_64-* | xc16x-* | xps100-* \ 449 | | xstormy16-* | xtensa*-* \ 450 | | ymp-* \ 451 | | z8k-* | z80-*) 452 | ;; 453 | # Recognize the basic CPU types without company name, with glob match. 454 | xtensa*) 455 | basic_machine=$basic_machine-unknown 456 | ;; 457 | # Recognize the various machine names and aliases which stand 458 | # for a CPU type and a company and sometimes even an OS. 459 | 386bsd) 460 | basic_machine=i386-pc 461 | os=-bsd 462 | ;; 463 | 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 464 | basic_machine=m68000-att 465 | ;; 466 | 3b*) 467 | basic_machine=we32k-att 468 | ;; 469 | a29khif) 470 | basic_machine=a29k-amd 471 | os=-udi 472 | ;; 473 | abacus) 474 | basic_machine=abacus-unknown 475 | ;; 476 | adobe68k) 477 | basic_machine=m68010-adobe 478 | os=-scout 479 | ;; 480 | alliant | fx80) 481 | basic_machine=fx80-alliant 482 | ;; 483 | altos | altos3068) 484 | basic_machine=m68k-altos 485 | ;; 486 | am29k) 487 | basic_machine=a29k-none 488 | os=-bsd 489 | ;; 490 | amd64) 491 | basic_machine=x86_64-pc 492 | ;; 493 | amd64-*) 494 | basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` 495 | ;; 496 | amdahl) 497 | basic_machine=580-amdahl 498 | os=-sysv 499 | ;; 500 | amiga | amiga-*) 501 | basic_machine=m68k-unknown 502 | ;; 503 | amigaos | amigados) 504 | basic_machine=m68k-unknown 505 | os=-amigaos 506 | ;; 507 | amigaunix | amix) 508 | basic_machine=m68k-unknown 509 | os=-sysv4 510 | ;; 511 | apollo68) 512 | basic_machine=m68k-apollo 513 | os=-sysv 514 | ;; 515 | apollo68bsd) 516 | basic_machine=m68k-apollo 517 | os=-bsd 518 | ;; 519 | aros) 520 | basic_machine=i386-pc 521 | os=-aros 522 | ;; 523 | asmjs) 524 | basic_machine=asmjs-unknown 525 | ;; 526 | aux) 527 | basic_machine=m68k-apple 528 | os=-aux 529 | ;; 530 | balance) 531 | basic_machine=ns32k-sequent 532 | os=-dynix 533 | ;; 534 | blackfin) 535 | basic_machine=bfin-unknown 536 | os=-linux 537 | ;; 538 | blackfin-*) 539 | basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` 540 | os=-linux 541 | ;; 542 | bluegene*) 543 | basic_machine=powerpc-ibm 544 | os=-cnk 545 | ;; 546 | c54x-*) 547 | basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` 548 | ;; 549 | c55x-*) 550 | basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` 551 | ;; 552 | c6x-*) 553 | basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` 554 | ;; 555 | c90) 556 | basic_machine=c90-cray 557 | os=-unicos 558 | ;; 559 | cegcc) 560 | basic_machine=arm-unknown 561 | os=-cegcc 562 | ;; 563 | convex-c1) 564 | basic_machine=c1-convex 565 | os=-bsd 566 | ;; 567 | convex-c2) 568 | basic_machine=c2-convex 569 | os=-bsd 570 | ;; 571 | convex-c32) 572 | basic_machine=c32-convex 573 | os=-bsd 574 | ;; 575 | convex-c34) 576 | basic_machine=c34-convex 577 | os=-bsd 578 | ;; 579 | convex-c38) 580 | basic_machine=c38-convex 581 | os=-bsd 582 | ;; 583 | cray | j90) 584 | basic_machine=j90-cray 585 | os=-unicos 586 | ;; 587 | craynv) 588 | basic_machine=craynv-cray 589 | os=-unicosmp 590 | ;; 591 | cr16 | cr16-*) 592 | basic_machine=cr16-unknown 593 | os=-elf 594 | ;; 595 | crds | unos) 596 | basic_machine=m68k-crds 597 | ;; 598 | crisv32 | crisv32-* | etraxfs*) 599 | basic_machine=crisv32-axis 600 | ;; 601 | cris | cris-* | etrax*) 602 | basic_machine=cris-axis 603 | ;; 604 | crx) 605 | basic_machine=crx-unknown 606 | os=-elf 607 | ;; 608 | da30 | da30-*) 609 | basic_machine=m68k-da30 610 | ;; 611 | decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) 612 | basic_machine=mips-dec 613 | ;; 614 | decsystem10* | dec10*) 615 | basic_machine=pdp10-dec 616 | os=-tops10 617 | ;; 618 | decsystem20* | dec20*) 619 | basic_machine=pdp10-dec 620 | os=-tops20 621 | ;; 622 | delta | 3300 | motorola-3300 | motorola-delta \ 623 | | 3300-motorola | delta-motorola) 624 | basic_machine=m68k-motorola 625 | ;; 626 | delta88) 627 | basic_machine=m88k-motorola 628 | os=-sysv3 629 | ;; 630 | dicos) 631 | basic_machine=i686-pc 632 | os=-dicos 633 | ;; 634 | djgpp) 635 | basic_machine=i586-pc 636 | os=-msdosdjgpp 637 | ;; 638 | dpx20 | dpx20-*) 639 | basic_machine=rs6000-bull 640 | os=-bosx 641 | ;; 642 | dpx2*) 643 | basic_machine=m68k-bull 644 | os=-sysv3 645 | ;; 646 | e500v[12]) 647 | basic_machine=powerpc-unknown 648 | os=$os"spe" 649 | ;; 650 | e500v[12]-*) 651 | basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` 652 | os=$os"spe" 653 | ;; 654 | ebmon29k) 655 | basic_machine=a29k-amd 656 | os=-ebmon 657 | ;; 658 | elxsi) 659 | basic_machine=elxsi-elxsi 660 | os=-bsd 661 | ;; 662 | encore | umax | mmax) 663 | basic_machine=ns32k-encore 664 | ;; 665 | es1800 | OSE68k | ose68k | ose | OSE) 666 | basic_machine=m68k-ericsson 667 | os=-ose 668 | ;; 669 | fx2800) 670 | basic_machine=i860-alliant 671 | ;; 672 | genix) 673 | basic_machine=ns32k-ns 674 | ;; 675 | gmicro) 676 | basic_machine=tron-gmicro 677 | os=-sysv 678 | ;; 679 | go32) 680 | basic_machine=i386-pc 681 | os=-go32 682 | ;; 683 | h3050r* | hiux*) 684 | basic_machine=hppa1.1-hitachi 685 | os=-hiuxwe2 686 | ;; 687 | h8300hms) 688 | basic_machine=h8300-hitachi 689 | os=-hms 690 | ;; 691 | h8300xray) 692 | basic_machine=h8300-hitachi 693 | os=-xray 694 | ;; 695 | h8500hms) 696 | basic_machine=h8500-hitachi 697 | os=-hms 698 | ;; 699 | harris) 700 | basic_machine=m88k-harris 701 | os=-sysv3 702 | ;; 703 | hp300-*) 704 | basic_machine=m68k-hp 705 | ;; 706 | hp300bsd) 707 | basic_machine=m68k-hp 708 | os=-bsd 709 | ;; 710 | hp300hpux) 711 | basic_machine=m68k-hp 712 | os=-hpux 713 | ;; 714 | hp3k9[0-9][0-9] | hp9[0-9][0-9]) 715 | basic_machine=hppa1.0-hp 716 | ;; 717 | hp9k2[0-9][0-9] | hp9k31[0-9]) 718 | basic_machine=m68000-hp 719 | ;; 720 | hp9k3[2-9][0-9]) 721 | basic_machine=m68k-hp 722 | ;; 723 | hp9k6[0-9][0-9] | hp6[0-9][0-9]) 724 | basic_machine=hppa1.0-hp 725 | ;; 726 | hp9k7[0-79][0-9] | hp7[0-79][0-9]) 727 | basic_machine=hppa1.1-hp 728 | ;; 729 | hp9k78[0-9] | hp78[0-9]) 730 | # FIXME: really hppa2.0-hp 731 | basic_machine=hppa1.1-hp 732 | ;; 733 | hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 734 | # FIXME: really hppa2.0-hp 735 | basic_machine=hppa1.1-hp 736 | ;; 737 | hp9k8[0-9][13679] | hp8[0-9][13679]) 738 | basic_machine=hppa1.1-hp 739 | ;; 740 | hp9k8[0-9][0-9] | hp8[0-9][0-9]) 741 | basic_machine=hppa1.0-hp 742 | ;; 743 | hppaosf) 744 | basic_machine=hppa1.1-hp 745 | os=-osf 746 | ;; 747 | hppro) 748 | basic_machine=hppa1.1-hp 749 | os=-proelf 750 | ;; 751 | i370-ibm* | ibm*) 752 | basic_machine=i370-ibm 753 | ;; 754 | i*86v32) 755 | basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` 756 | os=-sysv32 757 | ;; 758 | i*86v4*) 759 | basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` 760 | os=-sysv4 761 | ;; 762 | i*86v) 763 | basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` 764 | os=-sysv 765 | ;; 766 | i*86sol2) 767 | basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` 768 | os=-solaris2 769 | ;; 770 | i386mach) 771 | basic_machine=i386-mach 772 | os=-mach 773 | ;; 774 | vsta) 775 | basic_machine=i386-unknown 776 | os=-vsta 777 | ;; 778 | iris | iris4d) 779 | basic_machine=mips-sgi 780 | case $os in 781 | -irix*) 782 | ;; 783 | *) 784 | os=-irix4 785 | ;; 786 | esac 787 | ;; 788 | isi68 | isi) 789 | basic_machine=m68k-isi 790 | os=-sysv 791 | ;; 792 | leon-*|leon[3-9]-*) 793 | basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` 794 | ;; 795 | m68knommu) 796 | basic_machine=m68k-unknown 797 | os=-linux 798 | ;; 799 | m68knommu-*) 800 | basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` 801 | os=-linux 802 | ;; 803 | magnum | m3230) 804 | basic_machine=mips-mips 805 | os=-sysv 806 | ;; 807 | merlin) 808 | basic_machine=ns32k-utek 809 | os=-sysv 810 | ;; 811 | microblaze*) 812 | basic_machine=microblaze-xilinx 813 | ;; 814 | mingw64) 815 | basic_machine=x86_64-pc 816 | os=-mingw64 817 | ;; 818 | mingw32) 819 | basic_machine=i686-pc 820 | os=-mingw32 821 | ;; 822 | mingw32ce) 823 | basic_machine=arm-unknown 824 | os=-mingw32ce 825 | ;; 826 | miniframe) 827 | basic_machine=m68000-convergent 828 | ;; 829 | *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) 830 | basic_machine=m68k-atari 831 | os=-mint 832 | ;; 833 | mips3*-*) 834 | basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` 835 | ;; 836 | mips3*) 837 | basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown 838 | ;; 839 | monitor) 840 | basic_machine=m68k-rom68k 841 | os=-coff 842 | ;; 843 | morphos) 844 | basic_machine=powerpc-unknown 845 | os=-morphos 846 | ;; 847 | moxiebox) 848 | basic_machine=moxie-unknown 849 | os=-moxiebox 850 | ;; 851 | msdos) 852 | basic_machine=i386-pc 853 | os=-msdos 854 | ;; 855 | ms1-*) 856 | basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` 857 | ;; 858 | msys) 859 | basic_machine=i686-pc 860 | os=-msys 861 | ;; 862 | mvs) 863 | basic_machine=i370-ibm 864 | os=-mvs 865 | ;; 866 | nacl) 867 | basic_machine=le32-unknown 868 | os=-nacl 869 | ;; 870 | ncr3000) 871 | basic_machine=i486-ncr 872 | os=-sysv4 873 | ;; 874 | netbsd386) 875 | basic_machine=i386-unknown 876 | os=-netbsd 877 | ;; 878 | netwinder) 879 | basic_machine=armv4l-rebel 880 | os=-linux 881 | ;; 882 | news | news700 | news800 | news900) 883 | basic_machine=m68k-sony 884 | os=-newsos 885 | ;; 886 | news1000) 887 | basic_machine=m68030-sony 888 | os=-newsos 889 | ;; 890 | news-3600 | risc-news) 891 | basic_machine=mips-sony 892 | os=-newsos 893 | ;; 894 | necv70) 895 | basic_machine=v70-nec 896 | os=-sysv 897 | ;; 898 | next | m*-next) 899 | basic_machine=m68k-next 900 | case $os in 901 | -nextstep* ) 902 | ;; 903 | -ns2*) 904 | os=-nextstep2 905 | ;; 906 | *) 907 | os=-nextstep3 908 | ;; 909 | esac 910 | ;; 911 | nh3000) 912 | basic_machine=m68k-harris 913 | os=-cxux 914 | ;; 915 | nh[45]000) 916 | basic_machine=m88k-harris 917 | os=-cxux 918 | ;; 919 | nindy960) 920 | basic_machine=i960-intel 921 | os=-nindy 922 | ;; 923 | mon960) 924 | basic_machine=i960-intel 925 | os=-mon960 926 | ;; 927 | nonstopux) 928 | basic_machine=mips-compaq 929 | os=-nonstopux 930 | ;; 931 | np1) 932 | basic_machine=np1-gould 933 | ;; 934 | neo-tandem) 935 | basic_machine=neo-tandem 936 | ;; 937 | nse-tandem) 938 | basic_machine=nse-tandem 939 | ;; 940 | nsr-tandem) 941 | basic_machine=nsr-tandem 942 | ;; 943 | nsv-tandem) 944 | basic_machine=nsv-tandem 945 | ;; 946 | nsx-tandem) 947 | basic_machine=nsx-tandem 948 | ;; 949 | op50n-* | op60c-*) 950 | basic_machine=hppa1.1-oki 951 | os=-proelf 952 | ;; 953 | openrisc | openrisc-*) 954 | basic_machine=or32-unknown 955 | ;; 956 | os400) 957 | basic_machine=powerpc-ibm 958 | os=-os400 959 | ;; 960 | OSE68000 | ose68000) 961 | basic_machine=m68000-ericsson 962 | os=-ose 963 | ;; 964 | os68k) 965 | basic_machine=m68k-none 966 | os=-os68k 967 | ;; 968 | pa-hitachi) 969 | basic_machine=hppa1.1-hitachi 970 | os=-hiuxwe2 971 | ;; 972 | paragon) 973 | basic_machine=i860-intel 974 | os=-osf 975 | ;; 976 | parisc) 977 | basic_machine=hppa-unknown 978 | os=-linux 979 | ;; 980 | parisc-*) 981 | basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` 982 | os=-linux 983 | ;; 984 | pbd) 985 | basic_machine=sparc-tti 986 | ;; 987 | pbb) 988 | basic_machine=m68k-tti 989 | ;; 990 | pc532 | pc532-*) 991 | basic_machine=ns32k-pc532 992 | ;; 993 | pc98) 994 | basic_machine=i386-pc 995 | ;; 996 | pc98-*) 997 | basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` 998 | ;; 999 | pentium | p5 | k5 | k6 | nexgen | viac3) 1000 | basic_machine=i586-pc 1001 | ;; 1002 | pentiumpro | p6 | 6x86 | athlon | athlon_*) 1003 | basic_machine=i686-pc 1004 | ;; 1005 | pentiumii | pentium2 | pentiumiii | pentium3) 1006 | basic_machine=i686-pc 1007 | ;; 1008 | pentium4) 1009 | basic_machine=i786-pc 1010 | ;; 1011 | pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1012 | basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1013 | ;; 1014 | pentiumpro-* | p6-* | 6x86-* | athlon-*) 1015 | basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1016 | ;; 1017 | pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1018 | basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1019 | ;; 1020 | pentium4-*) 1021 | basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1022 | ;; 1023 | pn) 1024 | basic_machine=pn-gould 1025 | ;; 1026 | power) basic_machine=power-ibm 1027 | ;; 1028 | ppc | ppcbe) basic_machine=powerpc-unknown 1029 | ;; 1030 | ppc-* | ppcbe-*) 1031 | basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1032 | ;; 1033 | ppcle | powerpclittle) 1034 | basic_machine=powerpcle-unknown 1035 | ;; 1036 | ppcle-* | powerpclittle-*) 1037 | basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1038 | ;; 1039 | ppc64) basic_machine=powerpc64-unknown 1040 | ;; 1041 | ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1042 | ;; 1043 | ppc64le | powerpc64little) 1044 | basic_machine=powerpc64le-unknown 1045 | ;; 1046 | ppc64le-* | powerpc64little-*) 1047 | basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1048 | ;; 1049 | ps2) 1050 | basic_machine=i386-ibm 1051 | ;; 1052 | pw32) 1053 | basic_machine=i586-unknown 1054 | os=-pw32 1055 | ;; 1056 | rdos | rdos64) 1057 | basic_machine=x86_64-pc 1058 | os=-rdos 1059 | ;; 1060 | rdos32) 1061 | basic_machine=i386-pc 1062 | os=-rdos 1063 | ;; 1064 | rom68k) 1065 | basic_machine=m68k-rom68k 1066 | os=-coff 1067 | ;; 1068 | rm[46]00) 1069 | basic_machine=mips-siemens 1070 | ;; 1071 | rtpc | rtpc-*) 1072 | basic_machine=romp-ibm 1073 | ;; 1074 | s390 | s390-*) 1075 | basic_machine=s390-ibm 1076 | ;; 1077 | s390x | s390x-*) 1078 | basic_machine=s390x-ibm 1079 | ;; 1080 | sa29200) 1081 | basic_machine=a29k-amd 1082 | os=-udi 1083 | ;; 1084 | sb1) 1085 | basic_machine=mipsisa64sb1-unknown 1086 | ;; 1087 | sb1el) 1088 | basic_machine=mipsisa64sb1el-unknown 1089 | ;; 1090 | sde) 1091 | basic_machine=mipsisa32-sde 1092 | os=-elf 1093 | ;; 1094 | sei) 1095 | basic_machine=mips-sei 1096 | os=-seiux 1097 | ;; 1098 | sequent) 1099 | basic_machine=i386-sequent 1100 | ;; 1101 | sh5el) 1102 | basic_machine=sh5le-unknown 1103 | ;; 1104 | simso-wrs) 1105 | basic_machine=sparclite-wrs 1106 | os=-vxworks 1107 | ;; 1108 | sps7) 1109 | basic_machine=m68k-bull 1110 | os=-sysv2 1111 | ;; 1112 | spur) 1113 | basic_machine=spur-unknown 1114 | ;; 1115 | st2000) 1116 | basic_machine=m68k-tandem 1117 | ;; 1118 | stratus) 1119 | basic_machine=i860-stratus 1120 | os=-sysv4 1121 | ;; 1122 | strongarm-* | thumb-*) 1123 | basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` 1124 | ;; 1125 | sun2) 1126 | basic_machine=m68000-sun 1127 | ;; 1128 | sun2os3) 1129 | basic_machine=m68000-sun 1130 | os=-sunos3 1131 | ;; 1132 | sun2os4) 1133 | basic_machine=m68000-sun 1134 | os=-sunos4 1135 | ;; 1136 | sun3os3) 1137 | basic_machine=m68k-sun 1138 | os=-sunos3 1139 | ;; 1140 | sun3os4) 1141 | basic_machine=m68k-sun 1142 | os=-sunos4 1143 | ;; 1144 | sun4os3) 1145 | basic_machine=sparc-sun 1146 | os=-sunos3 1147 | ;; 1148 | sun4os4) 1149 | basic_machine=sparc-sun 1150 | os=-sunos4 1151 | ;; 1152 | sun4sol2) 1153 | basic_machine=sparc-sun 1154 | os=-solaris2 1155 | ;; 1156 | sun3 | sun3-*) 1157 | basic_machine=m68k-sun 1158 | ;; 1159 | sun4) 1160 | basic_machine=sparc-sun 1161 | ;; 1162 | sun386 | sun386i | roadrunner) 1163 | basic_machine=i386-sun 1164 | ;; 1165 | sv1) 1166 | basic_machine=sv1-cray 1167 | os=-unicos 1168 | ;; 1169 | symmetry) 1170 | basic_machine=i386-sequent 1171 | os=-dynix 1172 | ;; 1173 | t3e) 1174 | basic_machine=alphaev5-cray 1175 | os=-unicos 1176 | ;; 1177 | t90) 1178 | basic_machine=t90-cray 1179 | os=-unicos 1180 | ;; 1181 | tile*) 1182 | basic_machine=$basic_machine-unknown 1183 | os=-linux-gnu 1184 | ;; 1185 | tx39) 1186 | basic_machine=mipstx39-unknown 1187 | ;; 1188 | tx39el) 1189 | basic_machine=mipstx39el-unknown 1190 | ;; 1191 | toad1) 1192 | basic_machine=pdp10-xkl 1193 | os=-tops20 1194 | ;; 1195 | tower | tower-32) 1196 | basic_machine=m68k-ncr 1197 | ;; 1198 | tpf) 1199 | basic_machine=s390x-ibm 1200 | os=-tpf 1201 | ;; 1202 | udi29k) 1203 | basic_machine=a29k-amd 1204 | os=-udi 1205 | ;; 1206 | ultra3) 1207 | basic_machine=a29k-nyu 1208 | os=-sym1 1209 | ;; 1210 | v810 | necv810) 1211 | basic_machine=v810-nec 1212 | os=-none 1213 | ;; 1214 | vaxv) 1215 | basic_machine=vax-dec 1216 | os=-sysv 1217 | ;; 1218 | vms) 1219 | basic_machine=vax-dec 1220 | os=-vms 1221 | ;; 1222 | vpp*|vx|vx-*) 1223 | basic_machine=f301-fujitsu 1224 | ;; 1225 | vxworks960) 1226 | basic_machine=i960-wrs 1227 | os=-vxworks 1228 | ;; 1229 | vxworks68) 1230 | basic_machine=m68k-wrs 1231 | os=-vxworks 1232 | ;; 1233 | vxworks29k) 1234 | basic_machine=a29k-wrs 1235 | os=-vxworks 1236 | ;; 1237 | w65*) 1238 | basic_machine=w65-wdc 1239 | os=-none 1240 | ;; 1241 | w89k-*) 1242 | basic_machine=hppa1.1-winbond 1243 | os=-proelf 1244 | ;; 1245 | x64) 1246 | basic_machine=x86_64-pc 1247 | ;; 1248 | xbox) 1249 | basic_machine=i686-pc 1250 | os=-mingw32 1251 | ;; 1252 | xps | xps100) 1253 | basic_machine=xps100-honeywell 1254 | ;; 1255 | xscale-* | xscalee[bl]-*) 1256 | basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` 1257 | ;; 1258 | ymp) 1259 | basic_machine=ymp-cray 1260 | os=-unicos 1261 | ;; 1262 | none) 1263 | basic_machine=none-none 1264 | os=-none 1265 | ;; 1266 | 1267 | # Here we handle the default manufacturer of certain CPU types. It is in 1268 | # some cases the only manufacturer, in others, it is the most popular. 1269 | w89k) 1270 | basic_machine=hppa1.1-winbond 1271 | ;; 1272 | op50n) 1273 | basic_machine=hppa1.1-oki 1274 | ;; 1275 | op60c) 1276 | basic_machine=hppa1.1-oki 1277 | ;; 1278 | romp) 1279 | basic_machine=romp-ibm 1280 | ;; 1281 | mmix) 1282 | basic_machine=mmix-knuth 1283 | ;; 1284 | rs6000) 1285 | basic_machine=rs6000-ibm 1286 | ;; 1287 | vax) 1288 | basic_machine=vax-dec 1289 | ;; 1290 | pdp11) 1291 | basic_machine=pdp11-dec 1292 | ;; 1293 | we32k) 1294 | basic_machine=we32k-att 1295 | ;; 1296 | sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) 1297 | basic_machine=sh-unknown 1298 | ;; 1299 | cydra) 1300 | basic_machine=cydra-cydrome 1301 | ;; 1302 | orion) 1303 | basic_machine=orion-highlevel 1304 | ;; 1305 | orion105) 1306 | basic_machine=clipper-highlevel 1307 | ;; 1308 | mac | mpw | mac-mpw) 1309 | basic_machine=m68k-apple 1310 | ;; 1311 | pmac | pmac-mpw) 1312 | basic_machine=powerpc-apple 1313 | ;; 1314 | *-unknown) 1315 | # Make sure to match an already-canonicalized machine name. 1316 | ;; 1317 | *) 1318 | echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 1319 | exit 1 1320 | ;; 1321 | esac 1322 | 1323 | # Here we canonicalize certain aliases for manufacturers. 1324 | case $basic_machine in 1325 | *-digital*) 1326 | basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` 1327 | ;; 1328 | *-commodore*) 1329 | basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` 1330 | ;; 1331 | *) 1332 | ;; 1333 | esac 1334 | 1335 | # Decode manufacturer-specific aliases for certain operating systems. 1336 | 1337 | if [ x"$os" != x"" ] 1338 | then 1339 | case $os in 1340 | # First match some system type aliases that might get confused 1341 | # with valid system types. 1342 | # -solaris* is a basic system type, with this one exception. 1343 | -auroraux) 1344 | os=-auroraux 1345 | ;; 1346 | -solaris1 | -solaris1.*) 1347 | os=`echo $os | sed -e 's|solaris1|sunos4|'` 1348 | ;; 1349 | -solaris) 1350 | os=-solaris2 1351 | ;; 1352 | -unixware*) 1353 | os=-sysv4.2uw 1354 | ;; 1355 | -gnu/linux*) 1356 | os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` 1357 | ;; 1358 | # es1800 is here to avoid being matched by es* (a different OS) 1359 | -es1800*) 1360 | os=-ose 1361 | ;; 1362 | # Now accept the basic system types. 1363 | # The portable systems comes first. 1364 | # Each alternative MUST end in a * to match a version number. 1365 | # -sysv* is not here because it comes later, after sysvr4. 1366 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ 1367 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ 1368 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ 1369 | | -sym* | -kopensolaris* | -plan9* \ 1370 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ 1371 | | -aos* | -aros* | -cloudabi* | -sortix* \ 1372 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ 1373 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ 1374 | | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ 1375 | | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ 1376 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ 1377 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ 1378 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ 1379 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ 1380 | | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ 1381 | | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ 1382 | | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ 1383 | | -linux-newlib* | -linux-musl* | -linux-uclibc* \ 1384 | | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ 1385 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ 1386 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ 1387 | | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ 1388 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ 1389 | | -morphos* | -superux* | -rtmk* | -windiss* \ 1390 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ 1391 | | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ 1392 | | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ 1393 | | -midnightbsd* | -helenos*) 1394 | # Remember, each alternative MUST END IN *, to match a version number. 1395 | ;; 1396 | -qnx*) 1397 | case $basic_machine in 1398 | x86-* | i*86-*) 1399 | ;; 1400 | *) 1401 | os=-nto$os 1402 | ;; 1403 | esac 1404 | ;; 1405 | -nto-qnx*) 1406 | ;; 1407 | -nto*) 1408 | os=`echo $os | sed -e 's|nto|nto-qnx|'` 1409 | ;; 1410 | -sim | -xray | -os68k* | -v88r* \ 1411 | | -windows* | -osx | -abug | -netware* | -os9* \ 1412 | | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) 1413 | ;; 1414 | -mac*) 1415 | os=`echo "$os" | sed -e 's|mac|macos|'` 1416 | ;; 1417 | -linux-dietlibc) 1418 | os=-linux-dietlibc 1419 | ;; 1420 | -linux*) 1421 | os=`echo $os | sed -e 's|linux|linux-gnu|'` 1422 | ;; 1423 | -sunos5*) 1424 | os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1425 | ;; 1426 | -sunos6*) 1427 | os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1428 | ;; 1429 | -opened*) 1430 | os=-openedition 1431 | ;; 1432 | -os400*) 1433 | os=-os400 1434 | ;; 1435 | -wince*) 1436 | os=-wince 1437 | ;; 1438 | -utek*) 1439 | os=-bsd 1440 | ;; 1441 | -dynix*) 1442 | os=-bsd 1443 | ;; 1444 | -acis*) 1445 | os=-aos 1446 | ;; 1447 | -atheos*) 1448 | os=-atheos 1449 | ;; 1450 | -syllable*) 1451 | os=-syllable 1452 | ;; 1453 | -386bsd) 1454 | os=-bsd 1455 | ;; 1456 | -ctix* | -uts*) 1457 | os=-sysv 1458 | ;; 1459 | -nova*) 1460 | os=-rtmk-nova 1461 | ;; 1462 | -ns2) 1463 | os=-nextstep2 1464 | ;; 1465 | -nsk*) 1466 | os=-nsk 1467 | ;; 1468 | # Preserve the version number of sinix5. 1469 | -sinix5.*) 1470 | os=`echo $os | sed -e 's|sinix|sysv|'` 1471 | ;; 1472 | -sinix*) 1473 | os=-sysv4 1474 | ;; 1475 | -tpf*) 1476 | os=-tpf 1477 | ;; 1478 | -triton*) 1479 | os=-sysv3 1480 | ;; 1481 | -oss*) 1482 | os=-sysv3 1483 | ;; 1484 | -svr4*) 1485 | os=-sysv4 1486 | ;; 1487 | -svr3) 1488 | os=-sysv3 1489 | ;; 1490 | -sysvr4) 1491 | os=-sysv4 1492 | ;; 1493 | # This must come after -sysvr4. 1494 | -sysv*) 1495 | ;; 1496 | -ose*) 1497 | os=-ose 1498 | ;; 1499 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1500 | os=-mint 1501 | ;; 1502 | -zvmoe) 1503 | os=-zvmoe 1504 | ;; 1505 | -dicos*) 1506 | os=-dicos 1507 | ;; 1508 | -pikeos*) 1509 | # Until real need of OS specific support for 1510 | # particular features comes up, bare metal 1511 | # configurations are quite functional. 1512 | case $basic_machine in 1513 | arm*) 1514 | os=-eabi 1515 | ;; 1516 | *) 1517 | os=-elf 1518 | ;; 1519 | esac 1520 | ;; 1521 | -nacl*) 1522 | ;; 1523 | -ios) 1524 | ;; 1525 | -none) 1526 | ;; 1527 | *) 1528 | # Get rid of the `-' at the beginning of $os. 1529 | os=`echo $os | sed 's/[^-]*-//'` 1530 | echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 1531 | exit 1 1532 | ;; 1533 | esac 1534 | else 1535 | 1536 | # Here we handle the default operating systems that come with various machines. 1537 | # The value should be what the vendor currently ships out the door with their 1538 | # machine or put another way, the most popular os provided with the machine. 1539 | 1540 | # Note that if you're going to try to match "-MANUFACTURER" here (say, 1541 | # "-sun"), then you have to tell the case statement up towards the top 1542 | # that MANUFACTURER isn't an operating system. Otherwise, code above 1543 | # will signal an error saying that MANUFACTURER isn't an operating 1544 | # system, and we'll never get to this point. 1545 | 1546 | case $basic_machine in 1547 | score-*) 1548 | os=-elf 1549 | ;; 1550 | spu-*) 1551 | os=-elf 1552 | ;; 1553 | *-acorn) 1554 | os=-riscix1.2 1555 | ;; 1556 | arm*-rebel) 1557 | os=-linux 1558 | ;; 1559 | arm*-semi) 1560 | os=-aout 1561 | ;; 1562 | c4x-* | tic4x-*) 1563 | os=-coff 1564 | ;; 1565 | c8051-*) 1566 | os=-elf 1567 | ;; 1568 | hexagon-*) 1569 | os=-elf 1570 | ;; 1571 | tic54x-*) 1572 | os=-coff 1573 | ;; 1574 | tic55x-*) 1575 | os=-coff 1576 | ;; 1577 | tic6x-*) 1578 | os=-coff 1579 | ;; 1580 | # This must come before the *-dec entry. 1581 | pdp10-*) 1582 | os=-tops20 1583 | ;; 1584 | pdp11-*) 1585 | os=-none 1586 | ;; 1587 | *-dec | vax-*) 1588 | os=-ultrix4.2 1589 | ;; 1590 | m68*-apollo) 1591 | os=-domain 1592 | ;; 1593 | i386-sun) 1594 | os=-sunos4.0.2 1595 | ;; 1596 | m68000-sun) 1597 | os=-sunos3 1598 | ;; 1599 | m68*-cisco) 1600 | os=-aout 1601 | ;; 1602 | mep-*) 1603 | os=-elf 1604 | ;; 1605 | mips*-cisco) 1606 | os=-elf 1607 | ;; 1608 | mips*-*) 1609 | os=-elf 1610 | ;; 1611 | or32-*) 1612 | os=-coff 1613 | ;; 1614 | *-tti) # must be before sparc entry or we get the wrong os. 1615 | os=-sysv3 1616 | ;; 1617 | sparc-* | *-sun) 1618 | os=-sunos4.1.1 1619 | ;; 1620 | pru-*) 1621 | os=-elf 1622 | ;; 1623 | *-be) 1624 | os=-beos 1625 | ;; 1626 | *-ibm) 1627 | os=-aix 1628 | ;; 1629 | *-knuth) 1630 | os=-mmixware 1631 | ;; 1632 | *-wec) 1633 | os=-proelf 1634 | ;; 1635 | *-winbond) 1636 | os=-proelf 1637 | ;; 1638 | *-oki) 1639 | os=-proelf 1640 | ;; 1641 | *-hp) 1642 | os=-hpux 1643 | ;; 1644 | *-hitachi) 1645 | os=-hiux 1646 | ;; 1647 | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1648 | os=-sysv 1649 | ;; 1650 | *-cbm) 1651 | os=-amigaos 1652 | ;; 1653 | *-dg) 1654 | os=-dgux 1655 | ;; 1656 | *-dolphin) 1657 | os=-sysv3 1658 | ;; 1659 | m68k-ccur) 1660 | os=-rtu 1661 | ;; 1662 | m88k-omron*) 1663 | os=-luna 1664 | ;; 1665 | *-next) 1666 | os=-nextstep 1667 | ;; 1668 | *-sequent) 1669 | os=-ptx 1670 | ;; 1671 | *-crds) 1672 | os=-unos 1673 | ;; 1674 | *-ns) 1675 | os=-genix 1676 | ;; 1677 | i370-*) 1678 | os=-mvs 1679 | ;; 1680 | *-gould) 1681 | os=-sysv 1682 | ;; 1683 | *-highlevel) 1684 | os=-bsd 1685 | ;; 1686 | *-encore) 1687 | os=-bsd 1688 | ;; 1689 | *-sgi) 1690 | os=-irix 1691 | ;; 1692 | *-siemens) 1693 | os=-sysv4 1694 | ;; 1695 | *-masscomp) 1696 | os=-rtu 1697 | ;; 1698 | f30[01]-fujitsu | f700-fujitsu) 1699 | os=-uxpv 1700 | ;; 1701 | *-rom68k) 1702 | os=-coff 1703 | ;; 1704 | *-*bug) 1705 | os=-coff 1706 | ;; 1707 | *-apple) 1708 | os=-macos 1709 | ;; 1710 | *-atari*) 1711 | os=-mint 1712 | ;; 1713 | *) 1714 | os=-none 1715 | ;; 1716 | esac 1717 | fi 1718 | 1719 | # Here we handle the case where we know the os, and the CPU type, but not the 1720 | # manufacturer. We pick the logical manufacturer. 1721 | vendor=unknown 1722 | case $basic_machine in 1723 | *-unknown) 1724 | case $os in 1725 | -riscix*) 1726 | vendor=acorn 1727 | ;; 1728 | -sunos*) 1729 | vendor=sun 1730 | ;; 1731 | -cnk*|-aix*) 1732 | vendor=ibm 1733 | ;; 1734 | -beos*) 1735 | vendor=be 1736 | ;; 1737 | -hpux*) 1738 | vendor=hp 1739 | ;; 1740 | -mpeix*) 1741 | vendor=hp 1742 | ;; 1743 | -hiux*) 1744 | vendor=hitachi 1745 | ;; 1746 | -unos*) 1747 | vendor=crds 1748 | ;; 1749 | -dgux*) 1750 | vendor=dg 1751 | ;; 1752 | -luna*) 1753 | vendor=omron 1754 | ;; 1755 | -genix*) 1756 | vendor=ns 1757 | ;; 1758 | -mvs* | -opened*) 1759 | vendor=ibm 1760 | ;; 1761 | -os400*) 1762 | vendor=ibm 1763 | ;; 1764 | -ptx*) 1765 | vendor=sequent 1766 | ;; 1767 | -tpf*) 1768 | vendor=ibm 1769 | ;; 1770 | -vxsim* | -vxworks* | -windiss*) 1771 | vendor=wrs 1772 | ;; 1773 | -aux*) 1774 | vendor=apple 1775 | ;; 1776 | -hms*) 1777 | vendor=hitachi 1778 | ;; 1779 | -mpw* | -macos*) 1780 | vendor=apple 1781 | ;; 1782 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1783 | vendor=atari 1784 | ;; 1785 | -vos*) 1786 | vendor=stratus 1787 | ;; 1788 | esac 1789 | basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` 1790 | ;; 1791 | esac 1792 | 1793 | echo "$basic_machine$os" 1794 | exit 1795 | 1796 | # Local variables: 1797 | # eval: (add-hook 'write-file-functions 'time-stamp) 1798 | # time-stamp-start: "timestamp='" 1799 | # time-stamp-format: "%:y-%02m-%02d" 1800 | # time-stamp-end: "'" 1801 | # End: 1802 | -------------------------------------------------------------------------------- /facade/ar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[AR $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-ar $HSCT_ARFLAGS "$@" 9 | -------------------------------------------------------------------------------- /facade/as: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[AS $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-as $HSCT_ASFLAGS "$@" 9 | -------------------------------------------------------------------------------- /facade/cc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # CC is a compilation driver, so we should check which stage of compilation 4 | # is actually running and select which flags to provide. This makes no 5 | # difference for GCC, but e.g. clang warns when a flag is provided that is 6 | # unused 7 | 8 | run_it() { 9 | # echo "[CC $PWD]:" "$@" 10 | exec "$@" 11 | } 12 | 13 | running_pp=false 14 | running_cc=false 15 | 16 | # Guess what is actually running... 17 | for flag in "$@"; do 18 | case "$flag" in 19 | -E) running_pp=true ;; 20 | -c|-S) running_cc=true ;; 21 | *) ;; 22 | esac 23 | done 24 | 25 | # ...and pass the correct flags 26 | if $running_pp; then 27 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC $HSCT_CPPFLAGS "$@" 28 | elif $running_cc; then 29 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC $HSCT_CPPFLAGS $HSCT_CFLAGS "$@" 30 | else 31 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC $HSCT_CPPFLAGS $HSCT_CFLAGS $HSCT_LDFLAGS "$@" $HSCT_LDLIBS 32 | fi 33 | -------------------------------------------------------------------------------- /facade/cpp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[CPP $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CC -E $HSCT_CPPFLAGS "$@" 9 | -------------------------------------------------------------------------------- /facade/cxx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # CXX is a compilation driver, so we should check which stage of compilation 4 | # is actually running and select which flags to provide. This makes no 5 | # difference for GCC, but e.g. clang warns when a flag is provided that is 6 | # unused 7 | 8 | run_it() { 9 | # echo "[CXX $PWD]:" "$@" 10 | exec "$@" 11 | } 12 | 13 | running_pp=false 14 | running_cc=false 15 | 16 | # Guess what is actually running... 17 | for flag in "$@"; do 18 | case "$flag" in 19 | -E) running_pp=true ;; 20 | -c|-S) running_cc=true ;; 21 | *) ;; 22 | esac 23 | done 24 | 25 | # ...and pass the correct flags 26 | if $running_pp; then 27 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CXX $HSCT_CPPFLAGS "$@" 28 | elif $running_cc; then 29 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CXX $HSCT_CPPFLAGS $HSCT_CXXFLAGS "$@" 30 | else 31 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_CXX $HSCT_CPPFLAGS $HSCT_CXXFLAGS $HSCT_LDFLAGS "$@" $HSCT_LDLIBS 32 | fi 33 | -------------------------------------------------------------------------------- /facade/nm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[NM $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-nm "$@" 9 | -------------------------------------------------------------------------------- /facade/objcopy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[OBJCOPY $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-objcopy "$@" 9 | -------------------------------------------------------------------------------- /facade/objdump: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[OBJDUMP $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-objdump "$@" 9 | -------------------------------------------------------------------------------- /facade/ranlib: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[RANLIB $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-ranlib "$@" 9 | -------------------------------------------------------------------------------- /facade/strip: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | run_it() { 4 | # echo "[STRIP $PWD]:" "$@" 5 | exec "$@" 6 | } 7 | 8 | run_it $HELENOS_CROSS_PATH/$HSCT_REAL_TARGET-strip "$@" 9 | -------------------------------------------------------------------------------- /fdlibm/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=fdlibm 30 | shipversion=5.3 31 | shipsources="http://www.validlab.com/software/${shipname}53.tar.gz" 32 | shipfunnels=16 33 | 34 | build() { 35 | run tar xzf "${shipname}53.tar.gz" 36 | 37 | run cd "${shipname}53" 38 | run ./configure $HSCT_CONFIGURE_ARGS 39 | 40 | run make -j${shipfunnels} STATIC_ONLY=y 41 | } 42 | 43 | package() { 44 | run cp "${shipname}53/libfdm.a" "$HSCT_LIB_DIR/" 45 | run cp "${shipname}53/libfdm.a" "$HSCT_LIB_DIR/libm.a" 46 | 47 | run mkdir -p "$HSCT_MY_DIR/lib" 48 | run cp "${shipname}53/libfdm.a" "$HSCT_MY_DIR/lib/" 49 | run cp "${shipname}53/libfdm.a" "$HSCT_MY_DIR/lib/libm.a" 50 | } 51 | -------------------------------------------------------------------------------- /gcc/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=gcc 30 | shipversion=4.6.3 31 | mirror_="ftp://ftp.fu-berlin.de/unix/languages/gcc" 32 | shipsources="$mirror_/releases/$shipname-$shipversion/$shipname-$shipversion.tar.bz2 includes.patch libiberty.patch pex-helenos.c gcc.specs" 33 | shiptugs="libgmp libmpfr libmpc libisl zlib" 34 | shipfunnels=4 35 | 36 | build() { 37 | run tar xjf ${shipname}-${shipversion}.tar.bz2 38 | 39 | 40 | msg "Patching sources..." 41 | # Missing include diretives 42 | patch -p0 8 | + 9 | #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 10 | # ifndef HAVE_DOS_BASED_FILE_SYSTEM 11 | # define HAVE_DOS_BASED_FILE_SYSTEM 1 12 | 13 | -------------------------------------------------------------------------------- /gcc/libiberty.patch: -------------------------------------------------------------------------------- 1 | --- gcc-4.6.3/libiberty/configure 2 | +++ gcc-4.6.3/libiberty/configure 3 | @@ -6755,7 +6755,7 @@ 4 | $as_echo_n "(cached) " >&6 5 | else 6 | if test "$cross_compiling" = yes; then : 7 | - ac_cv_func_strncmp_works=no 8 | + ac_cv_func_strncmp_works=yes 9 | else 10 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext 11 | /* end confdefs.h. */ 12 | --- gcc-4.6.3/libiberty/Makefile.in 13 | +++ gcc-4.6.3/libiberty/Makefile.in 14 | @@ -129,7 +129,7 @@ 15 | dyn-string.c \ 16 | fdmatch.c ffs.c fibheap.c filename_cmp.c floatformat.c \ 17 | fnmatch.c fopen_unlocked.c \ 18 | - getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ 19 | + getcwd.c getpagesize.c getpwd.c getruntime.c \ 20 | gettimeofday.c \ 21 | hashtab.c hex.c \ 22 | index.c insque.c \ 23 | @@ -169,8 +169,8 @@ 24 | ./cp-demint.$(objext) ./crc32.$(objext) ./dyn-string.$(objext) \ 25 | ./fdmatch.$(objext) ./fibheap.$(objext) \ 26 | ./filename_cmp.$(objext) ./floatformat.$(objext) \ 27 | - ./fnmatch.$(objext) ./fopen_unlocked.$(objext) \ 28 | - ./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \ 29 | + ./fopen_unlocked.$(objext) \ 30 | + ./getpwd.$(objext) \ 31 | ./getruntime.$(objext) ./hashtab.$(objext) ./hex.$(objext) \ 32 | ./lbasename.$(objext) ./lrealpath.$(objext) \ 33 | ./make-relative-prefix.$(objext) ./make-temp-file.$(objext) \ 34 | 35 | -------------------------------------------------------------------------------- /gcc/pex-helenos.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Vojtech Horky 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef __helenos__ 30 | #include "pex-unix.c" 31 | #else 32 | 33 | #define _HELENOS_SOURCE 34 | 35 | #include "config.h" 36 | #include "libiberty.h" 37 | #include "pex-common.h" 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | struct pex_task_wait { 50 | task_wait_t task_wait; 51 | task_id_t task_id; 52 | }; 53 | 54 | /* Helen-OS specific information stored in each pex_obj. */ 55 | struct pex_helenos { 56 | struct pex_task_wait *tasks; 57 | size_t task_count; 58 | }; 59 | 60 | /* 61 | * Implementation of the individual operations. 62 | */ 63 | 64 | static int pex_helenos_open_read(struct pex_obj *obj ATTRIBUTE_UNUSED, 65 | const char *name, int binary ATTRIBUTE_UNUSED) 66 | { 67 | return open(name, O_RDONLY); 68 | } 69 | 70 | static int pex_helenos_open_write(struct pex_obj *obj ATTRIBUTE_UNUSED, 71 | const char *name, int binary ATTRIBUTE_UNUSED) 72 | { 73 | return open(name, O_WRONLY | O_CREAT | O_TRUNC); 74 | } 75 | 76 | static int pex_helenos_close(struct pex_obj *obj ATTRIBUTE_UNUSED, int fd) 77 | { 78 | return close(fd); 79 | } 80 | 81 | static pid_t pex_helenos_exec_child(struct pex_obj *obj, 82 | int flags ATTRIBUTE_UNUSED, 83 | const char *executable, char * const * argv, 84 | char * const * env ATTRIBUTE_UNUSED, 85 | int in, int out, int errdes, 86 | int toclose ATTRIBUTE_UNUSED, 87 | const char **errmsg, int *err) 88 | { 89 | struct pex_helenos *pex_helenos = (struct pex_helenos *) obj->sysdep; 90 | 91 | /* Prepare space for the task_wait structure. */ 92 | pex_helenos->tasks = XRESIZEVEC(struct pex_task_wait, 93 | pex_helenos->tasks, pex_helenos->task_count + 1); 94 | 95 | 96 | struct pex_task_wait *this_task = &pex_helenos->tasks[pex_helenos->task_count]; 97 | 98 | char full_path[1024]; 99 | // FIXME: decide on paths 100 | snprintf(full_path, 1023, "/app/%s", executable); 101 | int rc = task_spawnvf(&this_task->task_id, &this_task->task_wait, 102 | full_path, argv, in, out, errdes); 103 | 104 | if (rc != 0) { 105 | *err = rc; 106 | *errmsg = "task_spawnvf"; 107 | pex_helenos->tasks = XRESIZEVEC(struct pex_task_wait, 108 | pex_helenos->tasks, pex_helenos->task_count); 109 | return (pid_t) -1; 110 | } 111 | 112 | pex_helenos->task_count++; 113 | 114 | return (pid_t) this_task->task_id; 115 | } 116 | 117 | static int pex_helenos_wait(struct pex_obj *obj, 118 | pid_t pid, int *status, 119 | struct pex_time *time, int done, 120 | const char **errmsg, int *err) 121 | { 122 | struct pex_helenos *pex_helenos = (struct pex_helenos *) obj->sysdep; 123 | task_id_t task_id = (task_id_t) pid; 124 | 125 | /* Find the task in the list of known ones. */ 126 | struct pex_task_wait *this_task = NULL; 127 | for (size_t i = 0; i < pex_helenos->task_count; i++) { 128 | if (pex_helenos->tasks[i].task_id == task_id) { 129 | this_task = &pex_helenos->tasks[i]; 130 | break; 131 | } 132 | } 133 | 134 | if (this_task == NULL) { 135 | *err = -ENOENT; 136 | *errmsg = "no such task registered"; 137 | *status = *err; 138 | return -1; 139 | } 140 | 141 | /* 142 | * If @c done is set, we are cleaning-up. Kill the process 143 | * mercilessly. 144 | */ 145 | if (done) { 146 | task_kill(this_task->task_id); 147 | } 148 | 149 | if (time != NULL) { 150 | memset(time, 0, sizeof(*time)); 151 | } 152 | 153 | task_exit_t task_exit; 154 | int task_retval; 155 | int rc = task_wait(&this_task->task_wait, &task_exit, &task_retval); 156 | 157 | if (rc != 0) { 158 | *err = -rc; 159 | *errmsg = "task_wait"; 160 | *status = -rc; 161 | return -1; 162 | } else { 163 | if (task_exit == TASK_EXIT_UNEXPECTED) { 164 | *status = INT_MIN; 165 | return -1; 166 | } else { 167 | *status = task_retval; 168 | return 0; 169 | } 170 | } 171 | } 172 | 173 | static void pex_helenos_cleanup(struct pex_obj *obj) 174 | { 175 | struct pex_helenos *pex_helenos = (struct pex_helenos *) obj->sysdep; 176 | 177 | free(pex_helenos->tasks); 178 | free(pex_helenos); 179 | 180 | obj->sysdep = NULL; 181 | } 182 | 183 | 184 | /* 185 | * PEX initialization. 186 | */ 187 | 188 | const struct pex_funcs funcs = { 189 | pex_helenos_open_read, 190 | pex_helenos_open_write, 191 | pex_helenos_exec_child, 192 | pex_helenos_close, 193 | pex_helenos_wait, 194 | NULL, 195 | NULL, 196 | NULL, 197 | pex_helenos_cleanup 198 | }; 199 | 200 | struct pex_obj *pex_init(int flags, const char *pname, const char *tempbase) 201 | { 202 | /* Common initialization. */ 203 | struct pex_obj *obj = pex_init_common(flags, pname, tempbase, &funcs); 204 | 205 | /* Prepare the HelenOS specific data. */ 206 | struct pex_helenos *pex_helenos = XNEW(struct pex_helenos); 207 | pex_helenos->tasks = NULL; 208 | pex_helenos->task_count = 0; 209 | 210 | obj->sysdep = pex_helenos; 211 | 212 | return obj; 213 | } 214 | 215 | #endif 216 | -------------------------------------------------------------------------------- /gzx/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2023 Jiri Svoboda 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=gzx 30 | shipversion=7746a098745d3c2a1097bdbf0d2d40c01a33468f 31 | shipsources="git:${shipname}:${shipversion}:https://github.com/jxsvoboda/${shipname}" 32 | shiptugs="" 33 | shipfunnels=1 34 | 35 | build() { 36 | export PATH=$PATH:$HELENOS_ROOT/tools/xcw/bin 37 | export EXPORT_DIR=$HELENOS_EXPORT_ROOT 38 | cd "${shipname}" 39 | run make -j$shipfunnels hos 40 | } 41 | 42 | package() { 43 | cd "${shipname}" 44 | run mkdir -p "$HSCT_MY_DIR/${shipname}" 45 | for bin in gtap gzx; do 46 | run cp ${bin}-hos "$HSCT_MY_DIR/${shipname}/${bin}" 47 | done 48 | run cp font.bin "$HSCT_MY_DIR/${shipname}/font.bin" 49 | run cp -r roms "$HSCT_MY_DIR/${shipname}" 50 | } 51 | -------------------------------------------------------------------------------- /hsct.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright (c) 2013-2017 Vojtech Horky 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions 9 | # are met: 10 | # 11 | # - Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # - Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # - The name of the author may not be used to endorse or promote products 17 | # derived from this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | # 30 | 31 | # Calling harbour functions: 32 | # These functions are always called in a subshell to "guard" them a little 33 | # bit (variables set by the harbour, cd into package directory). 34 | # 35 | # Notice on usage of set -o errexit (set -e) 36 | # We want to use that option for the harbour scripts to get rid of the 37 | # "|| return 1" at the end of each line. 38 | # Obvious solution is to wrap the call like this: 39 | # ( set -o errexit; build ) || { hsct_error "..."; return 1; } 40 | # This doesn't work because the whole subshell is then part of a || 41 | # operand and thus the set -e is ignored (even if it is a subshell). 42 | # See https://groups.google.com/d/msg/gnu.bash.bug/NCK_0GmIv2M/y6RQF1AWUQkJ 43 | # Thus, we need to use the following template to get past this: 44 | # ( set -o errexit; build; exit $? ); 45 | # [ $? -eq 0 ] || { hsct_error "..."; return 1; } 46 | # 47 | # Also notice that we never ever call exit from the top-most shell when 48 | # leaving after an error. That is to prevent terminating user shell when 49 | # this script is sourced ("env" command). It complicates the error handling 50 | # a bit but it is more reliable than trying to guess whether we are running 51 | # in a subshell or not. 52 | # 53 | 54 | HSCT_HOME=`which -- "$0" 2>/dev/null` 55 | # Maybe, we are running Bash 56 | [ -z "$HSCT_HOME" ] && HSCT_HOME=`which -- "$BASH_SOURCE" 2>/dev/null` 57 | HSCT_HOME=`dirname -- "$HSCT_HOME"` 58 | HSCT_HOME=`cd $HSCT_HOME && echo $PWD` 59 | HSCT_HSCT="$HSCT_HOME/hsct.sh" 60 | 61 | HSCT_BUILD_DIR=`pwd`/build 62 | HSCT_INCLUDE_DIR=`pwd`/include 63 | HSCT_LIB_DIR=`pwd`/libs 64 | HSCT_DIST_DIR="`pwd`/dist/" 65 | HSCT_ARCHIVE_DIR="`pwd`/archives/" 66 | HSCT_CACHE_DIR=`pwd`/helenos 67 | 68 | # Print short help. 69 | # Does not exit the whole script. 70 | hsct_usage() { 71 | echo "Usage:" 72 | echo " $1 action [package]" 73 | echo " Action can be one of following:" 74 | echo " clean Clean build directory to save space." 75 | echo " distclean Prepare for recompilation (clean flag files)." 76 | echo " fetch Fetch sources (e.g. download from homepage)." 77 | echo " build Build given package." 78 | echo " package Save installable files to allow cleaning." 79 | echo " install Install to uspace/dist of HelenOS." 80 | echo " archive Create tarball instead of installing." 81 | echo " $1 init [/path/to/HelenOS] [profile]" 82 | echo " Initialize current directory as coastline build directory". 83 | echo " Full path has to be provided to the HelenOS source tree." 84 | echo " If profile is specified, forcefully rebuild to specified profile." 85 | echo " If no argument is provided, path to HelenOS source tree is" 86 | echo " read from the HELENOS_ROOT environment variable." 87 | echo " $1 help" 88 | echo " Display this help and exit." 89 | } 90 | 91 | # Print high-level information message. 92 | hsct_info() { 93 | echo ">>>" "$@" >&2 94 | } 95 | 96 | # Print lower-level information message (additional info after hsct_info). 97 | hsct_info2() { 98 | echo " ->" "$@" >&2 99 | } 100 | 101 | # Print information message from HARBOUR script. 102 | msg() { 103 | hsct_info "$@" 104 | } 105 | 106 | # Print high-level error message. 107 | hsct_error() { 108 | echo "[hsct]:" "Error:" "$@" >&2 109 | } 110 | 111 | # Print additional details to the error message. 112 | hsct_error2() { 113 | echo "[hsct]:" " -> " "$@" >&2 114 | } 115 | 116 | # Run a command but print it first. 117 | hsct_run_echo() { 118 | echo -n "[hsct]: " 119 | for ___i in "$@"; do 120 | echo -n "$___i" | sed -e 's#"#\\"#g' -e 's#.*#"&" #' 121 | done 122 | echo 123 | "$@" 124 | } 125 | 126 | # Run comman from HARBOUR script and print it as well. 127 | run() { 128 | hsct_run_echo "$@" 129 | } 130 | 131 | hsct_process_harbour_opts() { 132 | HSCT_OPTS_NO_DEPENDENCY_BUILDING=false 133 | HSCT_OPTS_NO_FILE_DOWNLOADING=false 134 | HSCT_OPTS_FORCE=false 135 | HSCT_HARBOUR_NAME="" 136 | 137 | while [ "$#" -ne 0 ]; do 138 | case "$1" in 139 | --no-deps) 140 | HSCT_OPTS_NO_DEPENDENCY_BUILDING=true 141 | ;; 142 | --no-fetch) 143 | HSCT_OPTS_NO_FILE_DOWNLOADING=true 144 | ;; 145 | --force) 146 | HSCT_OPTS_FORCE=true 147 | ;; 148 | --*) 149 | hsct_error "Unknown option $1." 150 | return 60 151 | ;; 152 | *) 153 | if [ -z "$HSCT_HARBOUR_NAME" ]; then 154 | HSCT_HARBOUR_NAME="$1" 155 | else 156 | hsct_error "Only one package name allowed." 157 | return 61 158 | fi 159 | ;; 160 | esac 161 | shift 162 | done 163 | 164 | return 0 165 | } 166 | 167 | # Fetch all the specified files in the HARBOUR 168 | hsct_fetch() { 169 | mkdir -p "$HSCT_SOURCES_DIR" 170 | hsct_info "Fetching sources..." 171 | for _src in $shipsources; do 172 | _scheme=`echo "$_src" | cut -d: -f 1` 173 | if [ "$_scheme" = "git" ]; then 174 | _filename=`echo "$_src" | cut -d: -f 2` 175 | _rev=`echo "$_src" | cut -d: -f 3` 176 | _url=`echo "$_src" | cut -d: -f 4-` 177 | else 178 | _filename=`basename "$_src"` 179 | _url="$_src" 180 | fi 181 | echo "filename:'$_filename' url:'$_url'" 182 | if [ "$_filename" = "$_url" ]; then 183 | continue 184 | fi 185 | if ! [ -r "$HSCT_SOURCES_DIR/$_filename" ]; then 186 | if $HSCT_OPTS_NO_FILE_DOWNLOADING; then 187 | hsct_error "File $_filename missing, cannot continue." 188 | hsct_error2 "Build without --no-fetch." 189 | return 62 190 | fi 191 | 192 | hsct_info2 "Fetching $_filename..." 193 | # Remove the file even on Ctrl-C when fetching 194 | trap "rm -f \"$HSCT_SOURCES_DIR/$_filename\"; echo" SIGINT SIGQUIT 195 | if [ "$_scheme" = "git" ]; then 196 | # Clone the repository 197 | if ! git clone "$_url" "$HSCT_SOURCES_DIR/$_filename"; then 198 | rm -f "$HSCT_SOURCES_DIR/$_filename" 199 | hsct_error "Failed to fetch $_url." 200 | return 63 201 | fi 202 | # Check out the specified revision 203 | if [ -n "$_rev" ]; then 204 | prevdir="$(pwd)" 205 | cd "$HSCT_SOURCES_DIR/$_filename" 206 | if ! git checkout "$_rev" 2>/dev/null; then 207 | rm -rf "$HSCT_SOURCES_DIR/$_filename" 208 | hsct_error "Failed to check out revision $_rev." 209 | return 63 210 | fi 211 | cd "$prevdir" 212 | fi 213 | else 214 | if [ "$_scheme" = "http" ]; then 215 | # If we request an insecure download anyway, don't check certificate after redirection. 216 | # This works around a problem with fdlibm download as of July 2020. 217 | if ! wget $HSCT_WGET_OPTS --no-check-certificate "$_url" -O "$HSCT_SOURCES_DIR/$_filename"; then 218 | rm -f "$HSCT_SOURCES_DIR/$_filename" 219 | hsct_error "Failed to fetch $_url." 220 | return 63 221 | fi 222 | else 223 | if ! wget $HSCT_WGET_OPTS "$_url" -O "$HSCT_SOURCES_DIR/$_filename"; then 224 | rm -f "$HSCT_SOURCES_DIR/$_filename" 225 | hsct_error "Failed to fetch $_url." 226 | return 63 227 | fi 228 | fi 229 | fi 230 | trap - SIGINT SIGQUIT 231 | fi 232 | # TODO - check MD5 233 | done 234 | return 0 235 | } 236 | 237 | # Remove the build directory of given package and enable rebuild 238 | # of the package. 239 | hsct_distclean() { 240 | hsct_info "Cleaning build directory and flag files..." 241 | rm -rf "$HSCT_BUILD_DIR/$shipname" 242 | rm -f "$HSCT_BUILD_DIR/${shipname}.built" 243 | rm -f "$HSCT_BUILD_DIR/${shipname}.packaged" 244 | } 245 | 246 | # Remove the build directory of given package. 247 | hsct_clean() { 248 | if [ -e "$HSCT_BUILD_DIR/${shipname}.built" ]; then 249 | if ! [ -e "$HSCT_BUILD_DIR/${shipname}.packaged" ]; then 250 | # Built but not packaged? If we remove the build directory 251 | # we will not be able to package. 252 | if ! $HSCT_OPTS_FORCE; then 253 | hsct_error "Cannot clean when built but not packaged." 254 | hsct_error2 "Use distclean or --force if you know what you are doing." 255 | return 51 256 | fi 257 | fi 258 | fi 259 | hsct_info "Cleaning build directory..." 260 | rm -rf "$HSCT_BUILD_DIR/$shipname/" 261 | } 262 | 263 | 264 | # Build the package. 265 | hsct_build() { 266 | mkdir -p "$HSCT_BUILD_DIR/$shipname" 267 | if [ -e "$HSCT_BUILD_DIR/${shipname}.built" ]; then 268 | hsct_info "No need to build $shipname." 269 | return 0 270 | fi 271 | 272 | # Check for prerequisities 273 | for tug in $shiptugs; do 274 | if ! [ -e "$HSCT_BUILD_DIR/${tug}.packaged" ]; then 275 | if $HSCT_OPTS_NO_DEPENDENCY_BUILDING; then 276 | hsct_error "Dependency $tug not built, cannot continue." 277 | hsct_error2 "Build $tug first or run without --no-deps." 278 | return 64 279 | fi 280 | hsct_info "Need to build $tug first." 281 | hsct_info2 "Running $HSCT_HSCT package $tug" 282 | ( 283 | $HSCT_HSCT package $tug 284 | exit $? 285 | ) 286 | if [ $? -ne 0 ]; then 287 | hsct_error "Failed to package dependency $tug." 288 | hsct_error2 "Cannot continue building $shipname." 289 | return 65 290 | fi 291 | hsct_info2 "Back from building $tug." 292 | fi 293 | done 294 | 295 | hsct_fetch || return $? 296 | 297 | for _src in $shipsources; do 298 | _scheme=`echo "$_src" | cut -d: -f 1` 299 | if [ "$_scheme" = "git" ]; then 300 | _filename=`echo "$_src" | cut -d: -f 2` 301 | _origin="$HSCT_SOURCES_DIR/$_filename" 302 | cp -r "$_origin" "$HSCT_BUILD_DIR/$shipname/$_filename" 303 | else 304 | _url="$_src" 305 | _filename=`basename "$_url"` 306 | if [ "$_filename" = "$_url" ]; then 307 | _origin="$HSCT_HOME/$shipname/$_filename" 308 | else 309 | _origin="$HSCT_SOURCES_DIR/$_filename" 310 | fi 311 | 312 | ln -srf "$_origin" "$HSCT_BUILD_DIR/$shipname/$_filename" 313 | fi 314 | done 315 | 316 | ( 317 | cd "$HSCT_BUILD_DIR/$shipname/" 318 | hsct_info "Building..." 319 | set -o errexit 320 | build 321 | exit $? 322 | ) 323 | if [ $? -ne 0 ]; then 324 | hsct_error "Build failed!" 325 | return 66 326 | fi 327 | touch "$HSCT_BUILD_DIR/${shipname}.built" 328 | return 0 329 | } 330 | 331 | # Pseudo-installation - copy from build directory to "my" directory, copy libraries 332 | hsct_package() { 333 | mkdir -p "$HSCT_INCLUDE_DIR" || { hsct_error "Failed to create include directory."; return 67; } 334 | mkdir -p "$HSCT_LIB_DIR" || { hsct_error "Failed to create library directory."; return 67; } 335 | mkdir -p "$HSCT_MY_DIR" || { hsct_error "Failed to create package directory."; return 67; } 336 | 337 | if [ -e "$HSCT_BUILD_DIR/${shipname}.packaged" ]; then 338 | hsct_info "No need to package $shipname." 339 | return 0; 340 | fi 341 | 342 | hsct_build || return $? 343 | 344 | ( 345 | cd "$HSCT_BUILD_DIR/$shipname/" 346 | hsct_info "Packaging..." 347 | set -o errexit 348 | package 349 | exit $? 350 | ) 351 | if [ $? -ne 0 ]; then 352 | hsct_error "Packaging failed!" 353 | return 68 354 | fi 355 | touch "$HSCT_BUILD_DIR/${shipname}.packaged" 356 | return 0 357 | } 358 | 359 | # Install the package to HelenOS source tree (to uspace/overlay). 360 | hsct_install() { 361 | hsct_package || return $? 362 | 363 | hsct_info "Installing..." 364 | if ls "$HSCT_MY_DIR"/* &>/dev/null; then 365 | mkdir -p "$HSCT_OVERLAY" 366 | cp -v -r -L "$HSCT_MY_DIR"/* "$HSCT_OVERLAY" || return 69 367 | hsct_info2 "Do not forget to rebuild the image." 368 | else 369 | hsct_info2 "Note: nothing to install." 370 | fi 371 | return 0 372 | } 373 | 374 | # Create tarball to allow redistribution of the build packages 375 | hsct_archive() { 376 | hsct_package || return $? 377 | 378 | hsct_info "Creating the archive..." 379 | mkdir -p "$HSCT_ARCHIVE_DIR" 380 | ( 381 | set -o errexit 382 | cd "$HSCT_DIST_DIR/$shipname" 383 | case "$HSCT_FORMAT" in 384 | tar.gz) 385 | tar czf "$HSCT_ARCHIVE_DIR/$shipname.tar.gz" . 386 | ;; 387 | tar.xz) 388 | tar cJf "$HSCT_ARCHIVE_DIR/$shipname.tar.xz" . 389 | ;; 390 | *) 391 | hsct_info "Unknown archive_format $HSCT_FORMAT." 392 | exit 71 393 | ;; 394 | esac 395 | ) 396 | if [ $? -ne 0 ]; then 397 | hsct_error "Archiving failed!" 398 | return 72 399 | fi 400 | 401 | return 0 402 | } 403 | 404 | hsct_load_config() { 405 | # Defaults 406 | HSCT_CONFIG="./config.sh" 407 | HSCT_WGET_OPTS= 408 | HSCT_SOURCES_DIR=`pwd`/sources 409 | HSCT_FORMAT="tar.xz" 410 | HSCT_PARALLELISM=`nproc` 411 | HELENOS_ROOT= 412 | 413 | if [ -e "$HSCT_CONFIG" ]; then 414 | . $HSCT_CONFIG 415 | fi 416 | } 417 | 418 | hsct_save_config() { 419 | echo "HSCT_WGET_OPTS=\"${HSCT_WGET_OPTS}\"" >> "${HSCT_CONFIG}.new" 420 | echo "HSCT_SOURCES_DIR=\"${HSCT_SOURCES_DIR}\"" >> "${HSCT_CONFIG}.new" 421 | echo "HSCT_FORMAT=\"${HSCT_FORMAT}\"" >> "${HSCT_CONFIG}.new" 422 | echo "HSCT_PARALLELISM=\"${HSCT_PARALLELISM}\"" >> "${HSCT_CONFIG}.new" 423 | echo "HELENOS_ROOT=\"${HELENOS_ROOT}\"" >> "${HSCT_CONFIG}.new" 424 | mv "${HSCT_CONFIG}.new" "${HSCT_CONFIG}" 425 | } 426 | 427 | # Update after changes in HelenOS itself 428 | hsct_update() { 429 | EXPORT_DIR=`pwd`/helenos 430 | 431 | ( 432 | cd helenos_build 433 | hsct_info "Exporting libraries and header files." 434 | env DESTDIR="$EXPORT_DIR" ninja export-dev 435 | ) 436 | 437 | if [ $? -ne 0 ]; then 438 | hsct_error "Failed to export development files." 439 | return 75 440 | fi 441 | } 442 | 443 | # Initialize current directory for coastline building. 444 | hsct_init() { 445 | hsct_load_config 446 | 447 | _root_dir="$1" 448 | profile="$2" 449 | 450 | if [ -z "$_root_dir" ]; then 451 | # Try to get HELENOS_ROOT from the environment if not specified. 452 | _root_dir="$HELENOS_ROOT" 453 | fi 454 | 455 | if [ -z "$_root_dir" ]; then 456 | hsct_error "HELENOS_ROOT is not set. Either set the environment variable, or specify it on the command line."; 457 | return 73 458 | fi 459 | 460 | _root_dir=`( cd "$_root_dir"; pwd ) 2>/dev/null` 461 | if ! [ -e "$_root_dir/HelenOS.config" ]; then 462 | hsct_error "$_root_dir does not look like a valid HelenOS directory."; 463 | return 74 464 | fi 465 | 466 | HELENOS_ROOT="$_root_dir" 467 | 468 | hsct_info "Initializing this build directory." 469 | ( 470 | EXPORT_DIR=`pwd`/helenos 471 | set -o errexit 472 | 473 | if [ -z "$profile" ]; then 474 | hsct_info2 "Configuring." 475 | mkdir -p helenos_build 476 | cd helenos_build 477 | "$HELENOS_ROOT"/configure.sh 478 | else 479 | hsct_info2 "Cleaning previous configuration in $PWD/helenos_build." 480 | rm -rf helenos_build 481 | mkdir helenos_build 482 | cd helenos_build 483 | hsct_info2 "Configuring for $profile." 484 | "$HELENOS_ROOT"/configure.sh "$profile" 485 | fi 486 | ) 487 | if [ $? -ne 0 ]; then 488 | if [ -z "$profile" ]; then 489 | hsct_error "Failed to reuse existing HelenOS configuration." 490 | else 491 | hsct_error "Failed to automatically configure HelenOS for profile '$profile'." 492 | fi 493 | return 75 494 | fi 495 | 496 | hsct_update 497 | 498 | hsct_info "Creating facade toolchain." 499 | mkdir -p facade 500 | facade_path="$PWD/facade" 501 | 502 | ( 503 | . helenos/config.sh 504 | 505 | if [ -z "$HELENOS_ARCH" ]; then 506 | hsct_error "HELENOS_ARCH undefined." 507 | return 76 508 | fi 509 | 510 | cd $HSCT_HOME/facade 511 | for x in *; do 512 | install -m 755 "$x" "$facade_path/$HELENOS_ARCH-helenos-$x" 513 | done 514 | ) 515 | 516 | if [ $? -ne 0 ]; then 517 | hsct_error "Failed to create toolchain facade for profile '$profile'." 518 | return 77 519 | fi 520 | 521 | hsct_save_config 522 | 523 | return 0 524 | } 525 | 526 | alias leave_script_ok='return 0 2>/dev/null || exit 0' 527 | alias leave_script_err='return 1 2>/dev/null || exit 1' 528 | 529 | hsct_print_vars() { 530 | # This is separate from the rest, so that the user can run 531 | # eval `path/to/hsct.sh vars` to get these vars in interactive shell. 532 | 533 | hsct_load_config 534 | HELENOS_EXPORT_ROOT="$HSCT_CACHE_DIR" 535 | HELENOS_CONFIG="$HSCT_CACHE_DIR/config.sh" 536 | 537 | if ! [ -e "$HELENOS_CONFIG" ]; then 538 | hsct_error "Configuration not found. Maybe you need to run init first?" 539 | return 78 540 | fi 541 | 542 | . $HELENOS_CONFIG 543 | 544 | echo "export HELENOS_EXPORT_ROOT='$HSCT_CACHE_DIR'" 545 | echo "export HSCT_REAL_CC='$HELENOS_TARGET-gcc'" 546 | echo "export HSCT_REAL_CXX='$HELENOS_TARGET-g++'" 547 | 548 | echo "export HSCT_ARFLAGS='$HELENOS_ARFLAGS'" 549 | echo "export HSCT_CPPFLAGS='-isystem $HSCT_INCLUDE_DIR $HELENOS_CPPFLAGS'" 550 | echo "export HSCT_CFLAGS='$HELENOS_CFLAGS'" 551 | echo "export HSCT_CXXFLAGS='$HELENOS_CXXFLAGS'" 552 | echo "export HSCT_ASFLAGS='$HELENOS_ASFLAGS'" 553 | echo "export HSCT_LDFLAGS='-L $HSCT_LIB_DIR $HELENOS_LDFLAGS'" 554 | echo "export HSCT_LDLIBS='$HELENOS_LDLIBS'" 555 | 556 | target="$HELENOS_ARCH-helenos" 557 | cctarget="$HELENOS_ARCH-linux-gnu" 558 | cvars="CC=$target-cc CXX=$target-cxx AR=$target-ar AS=$target-as CPP=$target-cpp NM=$target-nm OBJDUMP=$target-objdump OBJCOPY=$target-objcopy STRIP=$target-strip RANLIB=$target-ranlib" 559 | 560 | echo "export HSCT_CC='$target-cc'" 561 | echo "export HSCT_CXX='$target-cxx'" 562 | echo "export HSCT_TARGET='$target'" 563 | echo "export HSCT_REAL_TARGET='$HELENOS_TARGET'" 564 | # Target to set for cross-compiled cross-compilers. 565 | echo "export HSCT_CCROSS_TARGET='$cctarget'" 566 | echo "export HSCT_CONFIGURE_VARS='$cvars'" 567 | echo "export HSCT_CONFIGURE_ARGS='--build=`sh $HSCT_HOME/config.guess` --host=$target $cvars'" 568 | 569 | echo "export HELENOS_CROSS_PATH=$HELENOS_CROSS_PATH" 570 | echo "export PATH='$PWD/facade:$HELENOS_CROSS_PATH:$PATH'" 571 | } 572 | 573 | hsct_pkg() { 574 | hsct_load_config 575 | eval `hsct_print_vars` 576 | 577 | if [ -z "$HELENOS_EXPORT_ROOT" ]; then 578 | case "$HSCT_ACTION" in 579 | clean|distclean|fetch) 580 | ;; 581 | *) 582 | return 79 583 | ;; 584 | esac 585 | fi 586 | 587 | HSCT_MY_DIR="$HSCT_DIST_DIR/$HSCT_HARBOUR_NAME" 588 | HSCT_OVERLAY="$HELENOS_ROOT/uspace/overlay" 589 | HSCT_CONFIG_SUB="$HSCT_HOME/config.sub" 590 | 591 | if ! [ "$HSCT_PARALLELISM" -ge 0 ] 2>/dev/null; then 592 | HSCT_PARALLELISM="1" 593 | fi 594 | 595 | if ! [ -d "$HSCT_HOME/$HSCT_HARBOUR_NAME" ]; then 596 | hsct_error "Unknown package $HSCT_HARBOUR_NAME." 597 | leave_script_err 598 | fi 599 | 600 | if ! [ -r "$HSCT_HOME/$HSCT_HARBOUR_NAME/HARBOUR" ]; then 601 | hsct_error "HARBOUR file missing." >&2 602 | leave_script_err 603 | fi 604 | 605 | # Source the harbour to get access to the variables and functions 606 | . "$HSCT_HOME/$HSCT_HARBOUR_NAME/HARBOUR" 607 | 608 | if [ "$shipfunnels" -ne "1" ] 2>/dev/null; then 609 | shipfunnels="$HSCT_PARALLELISM" 610 | fi 611 | 612 | case "$HSCT_ACTION" in 613 | clean) 614 | hsct_clean 615 | ;; 616 | distclean) 617 | hsct_distclean 618 | ;; 619 | fetch) 620 | hsct_fetch 621 | ;; 622 | build) 623 | hsct_build 624 | ;; 625 | package) 626 | hsct_package 627 | ;; 628 | install) 629 | hsct_install 630 | ;; 631 | archive) 632 | hsct_archive 633 | ;; 634 | *) 635 | hsct_error "Internal error, we shall not get to this point!" 636 | leave_script_err 637 | ;; 638 | esac 639 | 640 | return $? 641 | } 642 | 643 | HSCT_ACTION="$1" 644 | 645 | case "$HSCT_ACTION" in 646 | clean|distclean|fetch|build|package|install|archive) 647 | shift 648 | if ! hsct_process_harbour_opts "$@"; then 649 | leave_script_err 650 | fi 651 | if [ -z "$HSCT_HARBOUR_NAME" ]; then 652 | hsct_usage "$0" 653 | leave_script_err 654 | fi 655 | hsct_pkg 656 | exit $? 657 | ;; 658 | vars) 659 | hsct_print_vars 660 | exit $? 661 | ;; 662 | init) 663 | hsct_init "$2" "$3" "$4" 664 | exit $? 665 | ;; 666 | help|--help|-h|-?) 667 | hsct_usage "$0" 668 | leave_script_ok 669 | ;; 670 | update) 671 | hsct_update 672 | exit $? 673 | ;; 674 | *) 675 | hsct_usage "$0" 676 | leave_script_err 677 | ;; 678 | esac 679 | 680 | -------------------------------------------------------------------------------- /jainja/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014 Martin Decky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=jainja 30 | shipversion=0.8 31 | shipsources="http://sourceforge.net/projects/${shipname}/files/${shipname}-${shipversion}/${shipname}-${shipversion}.tar.gz jainja.batch Makefile.patch headers.patch" 32 | shiptugs="fdlibm" 33 | shipfunnels=0 34 | 35 | build() { 36 | run tar xzf "${shipname}-${shipversion}.tar.gz" 37 | 38 | patch -p0 "$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 79 | find . -executable -type f | while read testname; do 80 | run cp "$testname" "$HSCT_MY_DIR/tests/${shipname}/$testname" || exit 1 81 | echo "/tests/${shipname}/$testname" | sed 's#\./##' >>"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 82 | done || exit 1 83 | ) 84 | } 85 | -------------------------------------------------------------------------------- /libgmp/gmp-h.patch: -------------------------------------------------------------------------------- 1 | --- gmp-5.1.0/gmp-h.in 2012-12-18 20:05:09.000000000 +0100 2 | +++ gmp-5.1.0/gmp-h.in 2013-01-18 18:27:45.965852213 +0100 3 | @@ -24,6 +24,8 @@ 4 | #if defined (__cplusplus) 5 | #include /* for std::istream, std::ostream, std::string */ 6 | #include 7 | +#else 8 | +#include 9 | #endif 10 | -------------------------------------------------------------------------------- /libiconv/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014 Jan Mares 3 | # Copyright (c) 2015 Vojtech Horky 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 10 | # - Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # - Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # - The name of the author may not be used to endorse or promote products 16 | # derived from this software without specific prior written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | shipname=libiconv 31 | shipversion=1.14 32 | shipsources="http://ftp.gnu.org/pub/gnu/${shipname}/${shipname}-${shipversion}.tar.gz" 33 | 34 | build() { 35 | run tar xzf "${shipname}-${shipversion}.tar.gz" 36 | cd "${shipname}-${shipversion}" 37 | 38 | # Force static-only build (thx Jan Mares) 39 | run sed -e 's#enable_shared=yes#enable_shared=no#' \ 40 | -e 's#enable_static=no#enable_static=yes#' \ 41 | -i preload/configure 42 | 43 | cp $HSCT_CONFIG_SUB build-aux/config.sub 44 | cp $HSCT_CONFIG_SUB libcharset/build-aux/config.sub 45 | 46 | run env \ 47 | gl_cv_header_signal_h_SIGPIPE=yes \ 48 | ./configure \ 49 | $HSCT_CONFIGURE_ARGS \ 50 | --enable-static \ 51 | --disable-nls \ 52 | --disable-shared 53 | 54 | # Even when building static library, the build process needs 55 | # preloadable_libiconv.so file. So let's create one. 56 | run sed 's#cp .libs/libiconv.so preloadable_libiconv.so#touch preloadable_libiconv.so#' -i preload/Makefile 57 | 58 | run make STATIC_ONLY=y 59 | } 60 | 61 | package() { 62 | cd "${shipname}-${shipversion}" 63 | run make install DESTDIR=$PWD/PKG 64 | 65 | run cp PKG/usr/local/include/*.h "$HSCT_INCLUDE_DIR/" 66 | run cp PKG/usr/local/lib/*.a "$HSCT_LIB_DIR/" 67 | 68 | run mkdir -p "$HSCT_MY_DIR/inc/c" 69 | run cp PKG/usr/local/include/*.h "$HSCT_MY_DIR/inc/c" 70 | 71 | run mkdir -p "$HSCT_MY_DIR/lib" 72 | run cp PKG/usr/local/lib/*.a "$HSCT_MY_DIR/lib" 73 | 74 | run mkdir -p "$HSCT_MY_DIR/app/" 75 | run cp PKG/usr/local/bin/iconv "$HSCT_MY_DIR/app/" 76 | } 77 | -------------------------------------------------------------------------------- /libisl/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=libisl 30 | shipname_=isl 31 | shipversion=0.11.1 32 | shipsources="https://libisl.sourceforge.io/${shipname_}-${shipversion}.tar.bz2" 33 | shiptugs="libgmp" 34 | shipfunnels=4 35 | 36 | build() { 37 | run tar xjf "${shipname_}-${shipversion}.tar.bz2" 38 | cd ${shipname_}-${shipversion} 39 | 40 | cp $HSCT_CONFIG_SUB . 41 | 42 | run ./configure \ 43 | $HSCT_CONFIGURE_ARGS \ 44 | --disable-shared \ 45 | 46 | run make -j$shipfunnels STATIC_ONLY=y 47 | } 48 | 49 | package() { 50 | cd "${shipname_}-${shipversion}" 51 | run make install "DESTDIR=$PWD/PKG" 52 | 53 | # Copy the headers and static library 54 | run mkdir -p "$HSCT_INCLUDE_DIR/${shipname_}" 55 | run cp PKG/usr/local/include/isl/*.h "$HSCT_INCLUDE_DIR/isl" 56 | run cp PKG/usr/local/lib/libisl.a "$HSCT_LIB_DIR/" 57 | 58 | run mkdir -p "$HSCT_MY_DIR/inc/c/isl" 59 | run cp PKG/usr/local/include/isl/*.h "$HSCT_MY_DIR/inc/c/isl" 60 | 61 | run mkdir -p "$HSCT_MY_DIR/lib" 62 | run cp PKG/usr/local/lib/libisl.a "$HSCT_MY_DIR/lib" 63 | 64 | ( 65 | msg "Preparing tests..." 66 | run mkdir -p "$HSCT_MY_DIR/tests/${shipname}/" 67 | run cp isl_pip "$HSCT_MY_DIR/tests/${shipname}/" 68 | cd test_inputs 69 | run cp *.pip "$HSCT_MY_DIR/tests/${shipname}/" 70 | echo "echo Running ${shipname} tests..." >"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 71 | for testname in *.pip; do 72 | # This is taken from pip_test.sh 73 | cat >>"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" <"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 88 | find . -executable -type f | while read testname; do 89 | run cp "$testname" "$HSCT_MY_DIR/tests/${shipname}/$testname" || exit 1 90 | echo "/tests/${shipname}/$testname" | sed 's#\./##' >>"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 91 | done || exit 1 92 | ) 93 | 94 | } 95 | -------------------------------------------------------------------------------- /libmpfr/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=libmpfr 30 | shipname_=mpfr 31 | shipversion=3.1.1 32 | shipsources="http://www.mpfr.org/${shipname_}-${shipversion}/${shipname_}-${shipversion}.tar.bz2" 33 | shiptugs="libgmp fdlibm" 34 | shipfunnels=4 35 | 36 | build() { 37 | run tar xjf "${shipname_}-${shipversion}.tar.bz2" 38 | cd "${shipname_}-${shipversion}" 39 | 40 | # Pretend we have something we really do not have 41 | extra_cppflags="-D_MPFR_H_HAVE_FILE" 42 | 43 | cp $HSCT_CONFIG_SUB . 44 | run ./configure \ 45 | $HSCT_CONFIGURE_ARGS \ 46 | CPPFLAGS="$extra_cppflags" \ 47 | --disable-shared \ 48 | || return 1 49 | 50 | msg "Building the library..." 51 | run make -j$shipfunnels STATIC_ONLY=y 52 | 53 | msg "Building the tests..." 54 | run make check || true 55 | 56 | ( 57 | cd tests 58 | find tversion tinternals tinits tisqrt tsgn tcheck \ 59 | tisnan texceptions tset_exp tset mpf_compat mpfr_compat \ 60 | reuse tabs tacos tacosh tadd tadd1sp tadd_d tadd_ui tagm \ 61 | tai tasin tasinh tatan tatanh taway tbuildopt tcan_round \ 62 | tcbrt tcmp tcmp2 tcmp_d tcmp_ld tcmp_ui tcmpabs \ 63 | tcomparisons tconst_catalan tconst_euler tconst_log2 \ 64 | tconst_pi tcopysign tcos tcosh tcot tcoth tcsc tcsch \ 65 | td_div td_sub tdigamma tdim tdiv tdiv_d tdiv_ui teint teq \ 66 | terf texp texp10 texp2 texpm1 tfactorial tfits tfma tfmod \ 67 | tfms tfprintf tfrac tfrexp tgamma tget_flt tget_d tget_d_2exp \ 68 | tget_f tget_ld_2exp tget_set_d64 tget_sj tget_str tget_z \ 69 | tgmpop tgrandom thyperbolic thypot tinp_str tj0 tj1 tjn tl2b \ 70 | tlgamma tli2 tlngamma tlog tlog10 tlog1p tlog2 tmin_prec \ 71 | tminmax tmodf tmul tmul_2exp tmul_d tmul_ui tnext \ 72 | tout_str toutimpl tpow tpow3 tpow_all tpow_z tprintf \ 73 | trandom trec_sqrt tremquo trint troot tround_prec tsec \ 74 | tsech tset_d tset_f tset_ld tset_q tset_si tset_sj \ 75 | tset_str tset_z tset_z_exp tsi_op tsin tsin_cos tsinh \ 76 | tsinh_cosh tsprintf tsqr tsqrt tsqrt_ui tstckintc tstdint tstrtofr \ 77 | tsub tsub1sp tsub_d tsub_ui tsubnormal tsum tswap ttan \ 78 | ttanh ttrunc tui_div tui_pow tui_sub turandom \ 79 | tvalist ty0 ty1 tyn tzeta tzeta_ui tversion 80 | exit $? 81 | ) 82 | } 83 | 84 | package() { 85 | cd "${shipname_}-${shipversion}" 86 | run make install DESTDIR=$PWD/PKG 87 | 88 | # Copy the headers and static library 89 | run cp PKG/usr/local/include/*.h "$HSCT_INCLUDE_DIR/" 90 | run cp PKG/usr/local/lib/*.a "$HSCT_LIB_DIR/" 91 | 92 | run mkdir -p "$HSCT_MY_DIR/inc/c" 93 | run cp PKG/usr/local/include/*.h "$HSCT_MY_DIR/inc/c" 94 | 95 | run mkdir -p "$HSCT_MY_DIR/lib" 96 | run cp PKG/usr/local/lib/*.a "$HSCT_MY_DIR/lib" 97 | 98 | # Copy the tests 99 | ( 100 | msg "Preparing tests..." 101 | run mkdir -p "$HSCT_MY_DIR/tests/${shipname}/" 102 | cd tests 103 | echo "echo Running ${shipname} tests..." >"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 104 | find . -executable -type f | while read testname; do 105 | run cp "$testname" "$HSCT_MY_DIR/tests/${shipname}/$testname" || exit 1 106 | echo "/tests/${shipname}/$testname" | sed 's#\./##' >>"$HSCT_MY_DIR/tests/run_${shipname}.bdsh" 107 | done || exit 1 108 | ) 109 | } 110 | -------------------------------------------------------------------------------- /libpng/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014 Esteban Campostrini 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=libpng 30 | shipversion=1.6.12 31 | shipsources=" http://prdownloads.sourceforge.net/${shipname}/${shipname}-${shipversion}.tar.gz" 32 | shiptugs="fdlibm zlib" 33 | shipfunnels=4 34 | 35 | 36 | build() { 37 | run tar xzf "${shipname}-${shipversion}.tar.gz" 38 | 39 | cd "${shipname}-${shipversion}" 40 | cp "$HSCT_CONFIG_SUB" . 41 | run ./configure \ 42 | --disable-shared\ 43 | $HSCT_CONFIGURE_ARGS 44 | 45 | run make all-am STATIC_ONLY=y 46 | } 47 | 48 | package() { 49 | cd "${shipname}-${shipversion}" 50 | run make install DESTDIR=$PWD/PKG 51 | 52 | # Copy the headers and static library 53 | run cp PKG/usr/local/include/libpng16/pngconf.h PKG/usr/local/include/libpng16/png.h PKG/usr/local/include/libpng16/pnglibconf.h "$HSCT_INCLUDE_DIR/" 54 | run cp PKG/usr/local/lib/libpng16.a "$HSCT_LIB_DIR/" 55 | run cp $HSCT_LIB_DIR/libpng16.a $HSCT_LIB_DIR/libpng.a 56 | 57 | run mkdir -p "$HSCT_MY_DIR/inc/c" 58 | run cp PKG/usr/local/include/libpng16/pngconf.h PKG/usr/local/include/libpng16/png.h PKG/usr/local/include/libpng16/pnglibconf.h "$HSCT_MY_DIR/inc/c" 59 | 60 | run mkdir -p "$HSCT_MY_DIR/lib" 61 | run cp PKG/usr/local/lib/libpng16.a "$HSCT_MY_DIR/lib" 62 | run cp $HSCT_LIB_DIR/libpng16.a $HSCT_MY_DIR/lib/libpng.a 63 | 64 | # Copy the executables 65 | run mkdir -p "$HSCT_MY_DIR/app/" 66 | run cp pngfix png-fix-itxt pngtest "$HSCT_MY_DIR/app/" 67 | 68 | # Copy files needed for testing 69 | run cp pngtest.png "$HSCT_MY_DIR/" 70 | } 71 | 72 | -------------------------------------------------------------------------------- /lua/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2018 Jaroslav Jindrak 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=lua 30 | shipversion=5.3.5 31 | shipsources="http://www.lua.org/ftp/${shipname}-${shipversion}.tar.gz log2.patch conf.patch" 32 | shiptugs="fdlibm" 33 | shipfunnels=4 34 | 35 | build() { 36 | run tar xf ${shipname}-${shipversion}.tar.gz 37 | 38 | msg "Patching sources..." 39 | 40 | patch -p0 src/Makefile.sources 64 | 65 | # Now we would use the HelenOS-style Makefile to actually build 66 | # the binary. 67 | run make -C src -j$shipfunnels \ 68 | CC="$HSCT_CC" \ 69 | HELENOS_INCLUDE_ROOT="$HELENOS_EXPORT_ROOT/include" 70 | } 71 | 72 | package() { 73 | cd "${shipname}-${shipversion}" 74 | 75 | run mkdir -p "$HSCT_MY_DIR/app/" 76 | run cp "src/${shipname}" "$HSCT_MY_DIR/app/" 77 | } 78 | -------------------------------------------------------------------------------- /msim/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2012 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | 30 | BINARY = msim 31 | 32 | LDLIBS = \ 33 | -lclui \ 34 | -lclipboard \ 35 | -lconsole \ 36 | -linput \ 37 | -loutput 38 | 39 | CFLAGS = \ 40 | -I$(HELENOS_INCLUDE_ROOT)/libconsole/ \ 41 | -I$(HELENOS_INCLUDE_ROOT)/liboutput/ \ 42 | -I$(HELENOS_INCLUDE_ROOT)/libinput/ \ 43 | -Wno-error 44 | 45 | include Makefile.sources 46 | 47 | OBJECTS := $(addsuffix .o, $(basename $(SOURCES))) 48 | 49 | msim: $(OBJECTS) 50 | $(CC) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS) 51 | 52 | arch/helenos/%.o: arch/helenos/%.c 53 | $(CC) $(CFLAGS) -c -o $@ $< 54 | 55 | %.o: %.c 56 | $(CC) $(CFLAGS) -c -o $@ $< 57 | -------------------------------------------------------------------------------- /msim/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_CTYPE_H 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_ERRNO_H 1 9 | 10 | /* Define to 1 if you have the header file. */ 11 | #define HAVE_FCNTL_H 1 12 | 13 | /* Define to 1 if you have the header file. */ 14 | #define HAVE_GETOPT_H 1 15 | 16 | /* Define to 1 if you have the `getopt_long' function. */ 17 | #define HAVE_GETOPT_LONG 1 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_INTTYPES_H 1 21 | 22 | /* Define to 1 if you have the `readline' library (-lreadline). */ 23 | #define HAVE_LIBREADLINE 1 24 | 25 | /* Define to 1 if you have the `wsock32' library (-lwsock32). */ 26 | /* #undef HAVE_LIBWSOCK32 */ 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_MEMORY_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_READLINE_HISTORY_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_READLINE_READLINE_H 1 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_SIGNAL_H 1 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #define HAVE_STDARG_H 1 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #define HAVE_STDBOOL_H 1 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #define HAVE_STDINT_H 1 48 | 49 | /* Define to 1 if you have the header file. */ 50 | #define HAVE_STDIO_H 1 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #define HAVE_STDLIB_H 1 54 | 55 | /* Define to 1 if you have the header file. */ 56 | #define HAVE_STRINGS_H 1 57 | 58 | /* Define to 1 if you have the header file. */ 59 | #define HAVE_STRING_H 1 60 | 61 | /* Define to 1 if you have the header file. */ 62 | #define HAVE_SYS_STAT_H 1 63 | 64 | /* Define to 1 if you have the header file. */ 65 | #define HAVE_SYS_TIME_H 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_SYS_TYPES_H 1 69 | 70 | /* Define to 1 if you have the header file. */ 71 | #define HAVE_TIME_H 1 72 | 73 | /* Define to 1 if you have the header file. */ 74 | #define HAVE_UNISTD_H 1 75 | 76 | /* Name of package */ 77 | #define PACKAGE "msim" 78 | 79 | /* Define to the address where bug reports for this package should be sent. */ 80 | #define PACKAGE_BUGREPORT "" 81 | 82 | /* Define to the full name of this package. */ 83 | #define PACKAGE_NAME "" 84 | 85 | /* Define to the full name and version of this package. */ 86 | #define PACKAGE_STRING "" 87 | 88 | /* Define to the one symbol short name of this package. */ 89 | #define PACKAGE_TARNAME "" 90 | 91 | /* Define to the version of this package. */ 92 | #define PACKAGE_VERSION "" 93 | 94 | /* Define to 1 if you have the ANSI C header files. */ 95 | #define STDC_HEADERS 1 96 | 97 | /* Version number of package */ 98 | #define VERSION "1.3.8.1" 99 | 100 | /* Define to 1 if your processor stores words with the most significant byte 101 | first (like Motorola and SPARC, unlike Intel and VAX). */ 102 | /* #undef WORDS_BIGENDIAN */ 103 | 104 | /* Define to empty if `const' does not conform to ANSI C. */ 105 | /* #undef const */ 106 | 107 | /* Define to `unsigned int' if does not define. */ 108 | /* #undef size_t */ 109 | -------------------------------------------------------------------------------- /msim/helenos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Vojtech Horky 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /** @addtogroup msim 30 | * @{ 31 | */ 32 | 33 | #ifndef MSIM_HELENOS_H_ 34 | #define MSIM_HELENOS_H_ 35 | 36 | char *helenos_input_get_next_command(void); 37 | void helenos_dprinter_init(void); 38 | 39 | #endif 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | -------------------------------------------------------------------------------- /msim/input.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Vojtech Horky 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /** @addtogroup msim 30 | * @{ 31 | */ 32 | /** @file HelenOS specific functions for MSIM simulator. 33 | */ 34 | 35 | /* Because of asprintf. */ 36 | #define _GNU_SOURCE 37 | #include "helenos.h" 38 | #define _HELENOS_SOURCE 39 | #include 40 | #undef _HELENOS_SOURCE 41 | #include 42 | #include 43 | 44 | extern void mprintf(const char *); 45 | 46 | static tinput_t *input_prompt; 47 | 48 | /** Terminal and readline initialization 49 | * 50 | */ 51 | void input_init(void) 52 | { 53 | input_prompt = tinput_new(); 54 | if (input_prompt == NULL) { 55 | fprintf(stderr, "Failed to intialize input."); 56 | abort(); 57 | } 58 | helenos_dprinter_init(); 59 | } 60 | 61 | void input_inter(void) 62 | { 63 | } 64 | 65 | void input_shadow( void) 66 | { 67 | } 68 | 69 | void input_back( void) 70 | { 71 | } 72 | 73 | char *helenos_input_get_next_command(void) 74 | { 75 | tinput_set_prompt(input_prompt, "[msim] "); 76 | 77 | char *commline = NULL; 78 | int rc = tinput_read(input_prompt, &commline); 79 | 80 | if (rc == ENOENT) { 81 | rc = asprintf(&commline, "quit"); 82 | mprintf("Quit\n"); 83 | if (rc != EOK) { 84 | exit(1); 85 | } 86 | } 87 | 88 | /* On error, it remains NULL. */ 89 | return commline; 90 | } 91 | 92 | 93 | bool stdin_poll(char *key) 94 | { 95 | cons_event_t ev; 96 | suseconds_t timeout = 0; 97 | errno = EOK; 98 | console_flush(input_prompt->console); 99 | bool has_input = console_get_event_timeout(input_prompt->console, &ev, &timeout); 100 | if (!has_input) { 101 | return false; 102 | } 103 | 104 | if (ev.type != CEV_KEY || ev.ev.key.type != KEY_PRESS) 105 | return false; 106 | 107 | *key = ev.ev.key.c; 108 | 109 | return true; 110 | } 111 | 112 | -------------------------------------------------------------------------------- /msim/misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Vojtech Horky 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /** @addtogroup msim 30 | * @{ 31 | */ 32 | /** @file HelenOS specific functions for MSIM simulator. 33 | */ 34 | #include "../../io/input.h" 35 | #include "../../io/output.h" 36 | #include "../../device/dprinter.h" 37 | #include "../../debug/gdb.h" 38 | #include "../../cmd.h" 39 | #include "../../fault.h" 40 | #include "../../device/machine.h" 41 | #include "helenos.h" 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | /* Define when the dprinter device shall try to filter 48 | * out ANSI escape sequences. 49 | */ 50 | #define IGNORE_ANSI_ESCAPE_SEQUENCES 51 | /* Define when you want the ANSI escape sequences to be dumped as 52 | * hex numbers. 53 | */ 54 | // #define DUMP_ANSI_ESCAPE_SEQUENCES 55 | 56 | void interactive_control(void) 57 | { 58 | tobreak = false; 59 | 60 | if (reenter) { 61 | mprintf("\n"); 62 | reenter = false; 63 | } 64 | 65 | stepping = 0; 66 | 67 | while (interactive) { 68 | char *commline = helenos_input_get_next_command(); 69 | if (commline == NULL) { 70 | mprintf("Quit\n"); 71 | input_back(); 72 | exit(1); 73 | } 74 | 75 | /* Check for empty input. */ 76 | if (commline[0] == '\0') { 77 | interpret("step"); 78 | } else { 79 | interpret(commline); 80 | } 81 | 82 | free(commline); 83 | } 84 | } 85 | 86 | bool gdb_remote_init(void) 87 | { 88 | return false; 89 | } 90 | 91 | void gdb_session(void) 92 | { 93 | } 94 | 95 | void gdb_handle_event(gdb_event_t event) 96 | { 97 | } 98 | 99 | 100 | static void (*original_printer_write)(cpu_t *, device_s *, ptr_t, uint32_t); 101 | static void helenos_printer_write(cpu_t *cpu, device_s *dev, ptr_t addr, uint32_t val) 102 | { 103 | #ifdef IGNORE_ANSI_ESCAPE_SEQUENCES 104 | static bool inside_ansi_escape = false; 105 | static bool just_ended_ansi_escape = false; 106 | 107 | if (inside_ansi_escape) { 108 | #ifdef DUMP_ANSI_ESCAPE_SEQUENCES 109 | fprintf(stderr, "%02" PRIx32 "'%c' ", val, val >= 32 ? val : '?'); 110 | #endif 111 | if (isalpha((int) val)) { 112 | just_ended_ansi_escape = true; 113 | inside_ansi_escape = false; 114 | #ifdef DUMP_ANSI_ESCAPE_SEQUENCES 115 | fprintf(stderr, " [END]\n"); 116 | #endif 117 | } 118 | 119 | return; 120 | } 121 | 122 | if (val == 0x1B) { 123 | inside_ansi_escape = true; 124 | 125 | if (!just_ended_ansi_escape) { 126 | #ifdef DUMP_ANSI_ESCAPE_SEQUENCES 127 | fprintf(stderr, "\n"); 128 | #endif 129 | } 130 | #ifdef DUMP_ANSI_ESCAPE_SEQUENCES 131 | fprintf(stderr, "ESC sequence: "); 132 | #endif 133 | 134 | return; 135 | } 136 | 137 | just_ended_ansi_escape = false; 138 | #endif 139 | 140 | (*original_printer_write)(cpu, dev, addr, val); 141 | } 142 | 143 | void helenos_dprinter_init(void) 144 | { 145 | original_printer_write = dprinter.write; 146 | dprinter.write = helenos_printer_write; 147 | } 148 | 149 | 150 | -------------------------------------------------------------------------------- /pcc/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014 Jakub Jermar 3 | # Copyright (c) 2017 Vojtech Horky 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 10 | # - Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # - Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # - The name of the author may not be used to endorse or promote products 16 | # derived from this software without specific prior written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | shipname=pcc 31 | shipversion=1.0.0 32 | mirror_="ftp://pcc.ludd.ltu.se/pub/pcc-releases" 33 | shipsources="$mirror_/$shipname-$shipversion.tgz pcc-helenos.patch ccconfig.h" 34 | shipprofiles="amd64 ia32 mips32/malta-be mips32/malta-le mips32/msim ppc32" 35 | shiptugs="" 36 | shipfunnels=1 37 | 38 | build() { 39 | run tar xzf ${shipname}-${shipversion}.tgz 40 | 41 | msg "Patching sources..." 42 | patch -p0 &5 11 | echo "$as_me: error: '$target' is not (yet) supported by pcc." >&2;} 12 | --- pcc-1.0.0/cc/cc/cc.c 2011-03-15 20:25:36.000000000 +0100 13 | +++ pcc-1.0.0/cc/cc/cc.c 2013-09-11 19:46:33.156788000 +0200 14 | @@ -1326,6 +1337,63 @@ 15 | return (exitCode != 0); 16 | } 17 | 18 | +#elif defined(__helenos__) 19 | +#define _HELENOS_SOURCE 20 | +#include 21 | + 22 | +int callsys(char *f, char *v[]) 23 | +{ 24 | + size_t len; 25 | + char *path = NULL; 26 | + const char *s; 27 | + int t; 28 | + task_wait_t twait; 29 | + task_exit_t texit; 30 | + int retval; 31 | + 32 | + task_id_t tid; 33 | + 34 | + if (vflag) { 35 | + fprintf(stderr, "%s ", f); 36 | + for (t = 1; v[t]; t++) 37 | + fprintf(stderr, "%s ", v[t]); 38 | + fprintf(stderr, "\n"); 39 | + } 40 | + 41 | + if (Bflag) { 42 | + len = strlen (Bflag) + 8; 43 | + path = malloc (len); 44 | + if (path == NULL) { 45 | + error("callsys: malloc failed"); 46 | + exit(1); 47 | + } 48 | + if ((s = strrchr(f, '/'))) { 49 | + strlcpy(path, Bflag, len); 50 | + strlcat(path, s, len); 51 | + if (task_spawnv(&tid, &twait, path, v) == 0) 52 | + goto _wait; 53 | + } 54 | + } 55 | + 56 | + if (task_spawnv(&tid, &twait, f, v) == 0) 57 | + goto _wait; 58 | + 59 | + if ((s = strrchr(f, '/')) && task_spawnv(&tid, &twait, s + 1, v) == 0) 60 | + goto _wait; 61 | + 62 | + errorx(8, "Can't find %s\n", f); 63 | + return 0; 64 | + 65 | +_wait: 66 | + 67 | + if (task_wait(&twait, &texit, &retval) != 0) { 68 | + error("Couldn't wait on task"); 69 | + return 0; 70 | + } 71 | + 72 | + return retval; 73 | +} 74 | + 75 | #else 76 | 77 | int 78 | diff -ur --unidirectional-new-file pcc-1.0.0/cc/ccom/main.c pcc/cc/ccom/main.c 79 | --- pcc-1.0.0/cc/ccom/main.c 2011-01-22 23:08:23.000000000 +0100 80 | +++ pcc-1.0.0/cc/ccom/main.c 2013-09-11 19:46:33.156788000 +0200 81 | @@ -299,6 +299,9 @@ 82 | perror(NULL); 83 | exit(1); 84 | } 85 | + } else { 86 | + fprintf(stderr, "Reading from standard input is disabled on HelenOS\n"); 87 | + exit(1); 88 | } 89 | if (argc > 1 && strcmp(argv[1], "-") != 0) { 90 | if (freopen(argv[1], "w", stdout) == NULL) { 91 | @@ -310,7 +313,9 @@ 92 | } 93 | 94 | mkdope(); 95 | +#ifndef __helenos__ 96 | signal(SIGSEGV, segvcatch); 97 | +#endif 98 | #ifdef SIGBUS 99 | signal(SIGBUS, segvcatch); 100 | #endif 101 | --- pcc-1.0.0/cc/ccom/pftn.c 2011-02-20 11:19:07.000000000 +0100 102 | +++ pcc-1.0.0/cc/ccom/pftn.c 2013-09-11 19:46:33.156788000 +0200 103 | @@ -1139,6 +1139,12 @@ 104 | } 105 | 106 | ap = attr_find(apl, ATTR_BASETYP); 107 | + 108 | + if (ap == NULL) { 109 | + cerror("unknown type"); 110 | + return SZINT; 111 | + } 112 | + 113 | sz = ap->atypsz; 114 | 115 | #ifdef GCC_COMPAT 116 | --- pcc-1.0.0/cc/cpp/cpp.c 2011-03-27 15:17:19.000000000 +0200 117 | +++ pcc-1.0.0/cc/cpp/cpp.c 2013-09-11 19:46:33.156788000 +0200 118 | @@ -274,7 +274,7 @@ 119 | if ((ofd = open(argv[1], O_WRONLY|O_CREAT, 0600)) < 0) 120 | error("Can't creat %s", argv[1]); 121 | } else 122 | - ofd = 1; /* stdout */ 123 | + ofd = fileno(stdout); 124 | istty = isatty(ofd); 125 | 126 | if (argc && strcmp(argv[0], "-")) { 127 | @@ -402,7 +402,7 @@ 128 | struct symtab *nl; 129 | usch *osp; 130 | usch *fn, *safefn; 131 | - int c, it; 132 | + int c; 133 | 134 | if (flslvl) 135 | return; 136 | @@ -436,7 +436,7 @@ 137 | ; 138 | if (c != '\n') 139 | goto bad; 140 | - it = SYSINC; 141 | + (void) SYSINC; 142 | safefn = fn; 143 | } else { 144 | usch *nm = stringbuf; 145 | @@ -869,7 +869,6 @@ 146 | { 147 | usch *t; 148 | usch *sb = stringbuf; 149 | - int dummy; 150 | 151 | flbuf(); 152 | savch(0); 153 | @@ -877,8 +876,8 @@ 154 | t = sheap("%s:%d: warning: ", ifiles->fname, ifiles->lineno); 155 | write (2, t, strlen((char *)t)); 156 | } 157 | - dummy = write (2, s, strlen((char *)s)); 158 | - dummy = write (2, "\n", 1); 159 | + write (2, s, strlen((char *)s)); 160 | + write (2, "\n", 1); 161 | stringbuf = sb; 162 | } 163 | 164 | @@ -886,16 +885,15 @@ 165 | xerror(usch *s) 166 | { 167 | usch *t; 168 | - int dummy; 169 | 170 | flbuf(); 171 | savch(0); 172 | if (ifiles != NULL) { 173 | t = sheap("%s:%d: error: ", ifiles->fname, ifiles->lineno); 174 | - dummy = write (2, t, strlen((char *)t)); 175 | + write (2, t, strlen((char *)t)); 176 | } 177 | - dummy = write (2, s, strlen((char *)s)); 178 | - dummy = write (2, "\n", 1); 179 | + write (2, s, strlen((char *)s)); 180 | + write (2, "\n", 1); 181 | exit(1); 182 | } 183 | 184 | @@ -1709,12 +1707,27 @@ 185 | } 186 | } 187 | 188 | +static ssize_t 189 | +_write_all(int fd, const void* buffer, size_t count) 190 | +{ 191 | + size_t remaining = count; 192 | + while (remaining > 0) { 193 | + ssize_t retval = write(ofd, buffer, remaining); 194 | + if (retval < 0) { 195 | + return retval; 196 | + } 197 | + remaining -= retval; 198 | + buffer += retval; 199 | + } 200 | + return count; 201 | +} 202 | + 203 | void 204 | flbuf() 205 | { 206 | if (obufp == 0) 207 | return; 208 | - if (Mflag == 0 && write(ofd, outbuf, obufp) < 0) 209 | + if (Mflag == 0 && _write_all(ofd, outbuf, obufp) < 0) 210 | error("obuf write error"); 211 | lastoch = outbuf[obufp-1]; 212 | obufp = 0; 213 | @@ -1862,7 +1875,7 @@ 214 | struct symtab *sp; 215 | struct tree *w, *new, *last; 216 | int len, cix, bit, fbit, svbit, ix, bitno; 217 | - const usch *k, *m, *sm; 218 | + const usch *k, *m; 219 | 220 | /* Count full string length */ 221 | for (k = key, len = 0; *k; k++, len++) 222 | @@ -1897,7 +1910,7 @@ 223 | 224 | sp = (struct symtab *)w; 225 | 226 | - sm = m = sp->namep; 227 | + m = sp->namep; 228 | k = key; 229 | 230 | /* Check for correct string and return */ 231 | --- pcc-1.0.0/cc/cpp/token.c 2011-03-12 18:08:26.000000000 +0100 232 | +++ pcc-1.0.0/cc/cpp/token.c 2013-09-11 19:46:33.156788000 +0200 233 | @@ -182,7 +182,7 @@ 234 | fastscan(void) 235 | { 236 | struct symtab *nl; 237 | - int ch, i, ccnt, onemore; 238 | + int ch, i, ccnt; 239 | usch *cp; 240 | 241 | goto run; 242 | @@ -356,7 +356,7 @@ 243 | ch = NXTCH(); 244 | goto xloop; 245 | } 246 | - onemore = i = ccnt = 0; 247 | + i = ccnt = 0; 248 | do { 249 | yytext[i++] = (usch)ch; 250 | ch = NXTCH(); 251 | @@ -799,7 +799,8 @@ 252 | if (++inclevel > MAX_INCLEVEL) 253 | error("Limit for nested includes exceeded"); 254 | } else { 255 | - ic->infil = 0; 256 | + error("Reading from stdin is disabled on HelenOS."); 257 | + ic->infil = fileno(stdin); 258 | ic->orgfn = ic->fname = (const usch *)""; 259 | } 260 | #ifndef BUF_STACK 261 | -------------------------------------------------------------------------------- /python2/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # 30 | # This script is based on patches of Zbigniew Halas from his Python on 31 | # HelenOS repository https://github.com/zhalas/helenos-build-python. 32 | # Thanks, Zbignew. 33 | # 34 | # All the praise belongs to him, errors are mine. 35 | # 36 | 37 | shipname=python2 38 | shipversion=2.7.6 39 | shipsources="http://www.python.org/ftp/python/${shipversion}/Python-${shipversion}.tar.xz \ 40 | cross-tools.patch modules.patch posixmodule.patch posixpath.patch configure" 41 | shiptugs="fdlibm" 42 | shipfunnels=16 43 | 44 | build() { 45 | run tar xJf Python-${shipversion}.tar.xz 46 | run mv Python-${shipversion} python-native 47 | run cp -r python-native python-cross 48 | 49 | msg "Preparing native Python first..." 50 | 51 | ( 52 | set -o errexit 53 | run cd python-native 54 | run ./configure 55 | run make -j$shipfunnels 56 | ) 57 | [ $? -ne 0 ] && exit 1 58 | 59 | msg "Building cross Python now..." 60 | 61 | ( 62 | set -o errexit 63 | run cd python-cross 64 | 65 | msg "Patching soures..." 66 | # Use a native generator 67 | patch -p1 <../cross-tools.patch 68 | # Do not build all modules 69 | patch -p1 <../modules.patch 70 | # We are not fully POSIX-compliant 71 | patch -p1 <../posixmodule.patch 72 | 73 | # TODO: enable more static modules 74 | msg "Setting static build for modules..." 75 | sed -e '1i*static*' -e 's:^#math:math:' -i Modules/Setup.dist 76 | 77 | cp $HSCT_CONFIG_SUB . 78 | cp $HSCT_CONFIG_SUB Modules/_ctypes/libffi 79 | cp ../configure . 80 | 81 | msg "Building..." 82 | run ./configure \ 83 | $HSCT_CONFIGURE_ARGS \ 84 | --without-threads \ 85 | --disable-shared \ 86 | --prefix=/ \ 87 | --libdir=/lib \ 88 | --bindir=/app \ 89 | ac_cv_file__dev_ptmx=no \ 90 | ac_cv_file__dev_ptc=no \ 91 | ac_cv_have_long_long_format=yes \ 92 | ac_cv_sizeof_pid_t=4 93 | 94 | # Workaround shared linking 95 | sed -e '/^LINKFORSHARED=/d' -i Makefile 96 | 97 | run make -j$shipfunnels \ 98 | STATIC_ONLY=y \ 99 | HOSTPGEN=../python-native/Parser/pgen \ 100 | HOSTPYTHON=../python-native/python 101 | ) 102 | [ $? -ne 0 ] && exit 1 103 | 104 | exit 0 105 | } 106 | 107 | package() { 108 | cd python-cross 109 | run make install "DESTDIR=$PWD/PKG" || true 110 | 111 | # Copy installed files 112 | run mkdir -p "$HSCT_MY_DIR/app" 113 | run cp -r PKG/app/python2.7 "$HSCT_MY_DIR/app/python" 114 | 115 | run mkdir -p "$HSCT_MY_DIR/lib" 116 | run cp -r PKG/lib/*python* "$HSCT_MY_DIR/lib" 117 | run chmod 0644 "$HSCT_MY_DIR/lib/"*.a 118 | 119 | patch -d "$HSCT_MY_DIR/lib" -p0 <../posixpath.patch 120 | } 121 | -------------------------------------------------------------------------------- /python2/cross-tools.patch: -------------------------------------------------------------------------------- 1 | diff -r 3a1db0d2747e Makefile.pre.in 2 | --- a/Makefile.pre.in Sun Nov 10 02:36:30 2013 -0500 3 | +++ b/Makefile.pre.in Fri Dec 13 16:10:56 2013 +0100 4 | @@ -191,6 +191,7 @@ 5 | 6 | PYTHON= python$(EXE) 7 | BUILDPYTHON= python$(BUILDEXE) 8 | +HOSTPYTHON= $(BUILDPYTHON) 9 | 10 | PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ 11 | _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ 12 | @@ -231,6 +232,7 @@ 13 | ########################################################################## 14 | # Parser 15 | PGEN= Parser/pgen$(EXE) 16 | +HOSTPGEN= $(PGEN) 17 | 18 | PSRCS= \ 19 | Parser/acceler.c \ 20 | @@ -293,7 +295,7 @@ 21 | 22 | ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py 23 | # XXX Note that a build now requires Python exist before the build starts 24 | -ASDLGEN= $(srcdir)/Parser/asdl_c.py 25 | +ASDLGEN=$(HOSTPYTHON) $(srcdir)/Parser/asdl_c.py 26 | 27 | ########################################################################## 28 | # Python 29 | @@ -598,7 +600,7 @@ 30 | $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) 31 | @$(MKDIR_P) Include 32 | $(MAKE) $(PGEN) 33 | - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) 34 | + $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) 35 | $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS) 36 | $(MAKE) $(GRAMMAR_H) 37 | touch $(GRAMMAR_C) 38 | -------------------------------------------------------------------------------- /python2/modules.patch: -------------------------------------------------------------------------------- 1 | diff -r 3a1db0d2747e Modules/Setup.dist 2 | --- a/Modules/Setup.dist Sun Nov 10 02:36:30 2013 -0500 3 | +++ b/Modules/Setup.dist Fri Dec 13 15:36:30 2013 +0100 4 | @@ -114,7 +114,7 @@ 5 | 6 | posix posixmodule.c # posix (UNIX) system calls 7 | errno errnomodule.c # posix (UNIX) errno values 8 | -pwd pwdmodule.c # this is needed to find out the user's home dir 9 | +# pwd pwdmodule.c # this is needed to find out the user's home dir 10 | # if $HOME is not set 11 | _sre _sre.c # Fredrik Lundh's new regular expressions 12 | _codecs _codecsmodule.c # access to the builtin codecs and codec registry 13 | -------------------------------------------------------------------------------- /python2/posixmodule.patch: -------------------------------------------------------------------------------- 1 | diff -r 3a1db0d2747e Modules/posixmodule.c 2 | --- a/Modules/posixmodule.c Sun Nov 10 02:36:30 2013 -0500 3 | +++ b/Modules/posixmodule.c Fri Dec 13 15:36:45 2013 +0100 4 | @@ -162,6 +162,19 @@ 5 | #endif /* ! __WATCOMC__ || __QNX__ */ 6 | #endif /* ! __IBMC__ */ 7 | 8 | + 9 | +#undef HAVE_OPENPTY 10 | +#undef HAVE_FORKPTY 11 | +#undef HAVE_DEV_PTMX 12 | +#undef HAVE_DEV_PTC 13 | +#undef HAVE_POPEN 14 | +#undef HAVE_GETPPID 15 | +#undef HAVE_GETUID 16 | +#undef HAVE_GETEUID 17 | +#undef HAVE_GETEGID 18 | +#undef HAVE_EXECV 19 | +#undef HAVE_TTYNAME 20 | + 21 | #ifndef _MSC_VER 22 | 23 | #if defined(__sgi)&&_COMPILER_VERSION>=700 24 | @@ -2913,161 +2926,8 @@ 25 | static PyObject * 26 | posix_utime(PyObject *self, PyObject *args) 27 | { 28 | -#ifdef MS_WINDOWS 29 | - PyObject *arg; 30 | - PyUnicodeObject *obwpath; 31 | - wchar_t *wpath = NULL; 32 | - char *apath = NULL; 33 | - HANDLE hFile; 34 | - time_t atimesec, mtimesec; 35 | - long ausec, musec; 36 | - FILETIME atime, mtime; 37 | - PyObject *result = NULL; 38 | - 39 | - if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { 40 | - wpath = PyUnicode_AS_UNICODE(obwpath); 41 | - Py_BEGIN_ALLOW_THREADS 42 | - hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, 43 | - NULL, OPEN_EXISTING, 44 | - FILE_FLAG_BACKUP_SEMANTICS, NULL); 45 | - Py_END_ALLOW_THREADS 46 | - if (hFile == INVALID_HANDLE_VALUE) 47 | - return win32_error_unicode("utime", wpath); 48 | - } else 49 | - /* Drop the argument parsing error as narrow strings 50 | - are also valid. */ 51 | - PyErr_Clear(); 52 | - 53 | - if (!wpath) { 54 | - if (!PyArg_ParseTuple(args, "etO:utime", 55 | - Py_FileSystemDefaultEncoding, &apath, &arg)) 56 | - return NULL; 57 | - Py_BEGIN_ALLOW_THREADS 58 | - hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0, 59 | - NULL, OPEN_EXISTING, 60 | - FILE_FLAG_BACKUP_SEMANTICS, NULL); 61 | - Py_END_ALLOW_THREADS 62 | - if (hFile == INVALID_HANDLE_VALUE) { 63 | - win32_error("utime", apath); 64 | - PyMem_Free(apath); 65 | - return NULL; 66 | - } 67 | - PyMem_Free(apath); 68 | - } 69 | - 70 | - if (arg == Py_None) { 71 | - SYSTEMTIME now; 72 | - GetSystemTime(&now); 73 | - if (!SystemTimeToFileTime(&now, &mtime) || 74 | - !SystemTimeToFileTime(&now, &atime)) { 75 | - win32_error("utime", NULL); 76 | - goto done; 77 | - } 78 | - } 79 | - else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { 80 | - PyErr_SetString(PyExc_TypeError, 81 | - "utime() arg 2 must be a tuple (atime, mtime)"); 82 | - goto done; 83 | - } 84 | - else { 85 | - if (extract_time(PyTuple_GET_ITEM(arg, 0), 86 | - &atimesec, &ausec) == -1) 87 | - goto done; 88 | - time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime); 89 | - if (extract_time(PyTuple_GET_ITEM(arg, 1), 90 | - &mtimesec, &musec) == -1) 91 | - goto done; 92 | - time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime); 93 | - } 94 | - if (!SetFileTime(hFile, NULL, &atime, &mtime)) { 95 | - /* Avoid putting the file name into the error here, 96 | - as that may confuse the user into believing that 97 | - something is wrong with the file, when it also 98 | - could be the time stamp that gives a problem. */ 99 | - win32_error("utime", NULL); 100 | - goto done; 101 | - } 102 | - Py_INCREF(Py_None); 103 | - result = Py_None; 104 | -done: 105 | - CloseHandle(hFile); 106 | - return result; 107 | -#else /* MS_WINDOWS */ 108 | - 109 | - char *path = NULL; 110 | - time_t atime, mtime; 111 | - long ausec, musec; 112 | - int res; 113 | - PyObject* arg; 114 | - 115 | -#if defined(HAVE_UTIMES) 116 | - struct timeval buf[2]; 117 | -#define ATIME buf[0].tv_sec 118 | -#define MTIME buf[1].tv_sec 119 | -#elif defined(HAVE_UTIME_H) 120 | -/* XXX should define struct utimbuf instead, above */ 121 | - struct utimbuf buf; 122 | -#define ATIME buf.actime 123 | -#define MTIME buf.modtime 124 | -#define UTIME_ARG &buf 125 | -#else /* HAVE_UTIMES */ 126 | - time_t buf[2]; 127 | -#define ATIME buf[0] 128 | -#define MTIME buf[1] 129 | -#define UTIME_ARG buf 130 | -#endif /* HAVE_UTIMES */ 131 | - 132 | - 133 | - if (!PyArg_ParseTuple(args, "etO:utime", 134 | - Py_FileSystemDefaultEncoding, &path, &arg)) 135 | - return NULL; 136 | - if (arg == Py_None) { 137 | - /* optional time values not given */ 138 | - Py_BEGIN_ALLOW_THREADS 139 | - res = utime(path, NULL); 140 | - Py_END_ALLOW_THREADS 141 | - } 142 | - else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { 143 | - PyErr_SetString(PyExc_TypeError, 144 | - "utime() arg 2 must be a tuple (atime, mtime)"); 145 | - PyMem_Free(path); 146 | - return NULL; 147 | - } 148 | - else { 149 | - if (extract_time(PyTuple_GET_ITEM(arg, 0), 150 | - &atime, &ausec) == -1) { 151 | - PyMem_Free(path); 152 | - return NULL; 153 | - } 154 | - if (extract_time(PyTuple_GET_ITEM(arg, 1), 155 | - &mtime, &musec) == -1) { 156 | - PyMem_Free(path); 157 | - return NULL; 158 | - } 159 | - ATIME = atime; 160 | - MTIME = mtime; 161 | -#ifdef HAVE_UTIMES 162 | - buf[0].tv_usec = ausec; 163 | - buf[1].tv_usec = musec; 164 | - Py_BEGIN_ALLOW_THREADS 165 | - res = utimes(path, buf); 166 | - Py_END_ALLOW_THREADS 167 | -#else 168 | - Py_BEGIN_ALLOW_THREADS 169 | - res = utime(path, UTIME_ARG); 170 | - Py_END_ALLOW_THREADS 171 | -#endif /* HAVE_UTIMES */ 172 | - } 173 | - if (res < 0) { 174 | - return posix_error_with_allocated_filename(path); 175 | - } 176 | - PyMem_Free(path); 177 | Py_INCREF(Py_None); 178 | return Py_None; 179 | -#undef UTIME_ARG 180 | -#undef ATIME 181 | -#undef MTIME 182 | -#endif /* MS_WINDOWS */ 183 | } 184 | 185 | 186 | -------------------------------------------------------------------------------- /python2/posixpath.patch: -------------------------------------------------------------------------------- 1 | --- python2.7/posixpath.py 2013-12-15 19:41:45.768518889 +0100 2 | +++ python2.7/posixpath.py 2013-12-15 20:10:04.427832683 +0100 3 | @@ -263,20 +263,7 @@ 4 | i = path.find('/', 1) 5 | if i < 0: 6 | i = len(path) 7 | - if i == 1: 8 | - if 'HOME' not in os.environ: 9 | - import pwd 10 | - userhome = pwd.getpwuid(os.getuid()).pw_dir 11 | - else: 12 | - userhome = os.environ['HOME'] 13 | - else: 14 | - import pwd 15 | - try: 16 | - pwent = pwd.getpwnam(path[1:i]) 17 | - except KeyError: 18 | - return path 19 | - userhome = pwent.pw_dir 20 | - userhome = userhome.rstrip('/') 21 | + userhome = '/data' 22 | return (userhome + path[i:]) or '/' 23 | 24 | 25 | -------------------------------------------------------------------------------- /sycek/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2018 Jiri Svoboda 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=sycek 30 | shipversion=dffa8fd5ba43b8129d1d5d71966b54d64b1a332c 31 | shipsources="git:${shipname}:${shipversion}:https://github.com/jxsvoboda/${shipname}" 32 | shipgitrev="" 33 | shiptugs="" 34 | shipfunnels=1 35 | 36 | build() { 37 | export PATH=$PATH:$HELENOS_ROOT/tools/xcw/bin 38 | export EXPORT_DIR=$HELENOS_EXPORT_ROOT 39 | cd "${shipname}" 40 | run make -j$shipfunnels hos 41 | } 42 | 43 | package() { 44 | cd "${shipname}" 45 | run mkdir -p "$HSCT_MY_DIR/app/" 46 | run cp ccheck-hos "$HSCT_MY_DIR/app/ccheck" 47 | } 48 | -------------------------------------------------------------------------------- /travis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright (c) 2018 Vojtech Horky 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions 9 | # are met: 10 | # 11 | # - Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # - Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # - The name of the author may not be used to endorse or promote products 17 | # derived from this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | # 30 | 31 | # 32 | # This is wrapper script for testing build of HelenOS harbours under 33 | # Travis CI [1]. 34 | # 35 | # You probably do not want to run this script directly. If you wish to test 36 | # that HelenOS harbours builds for all architectures, consider using either 37 | # our CI solution [2]. 38 | # 39 | # [1] https://travis-ci.org/ 40 | # [2] http://www.helenos.org/wiki/CI 41 | # 42 | 43 | H_ARCH_CONFIG_CROSS_TARGET=2 44 | 45 | h_get_arch_config_space() { 46 | cat <<'EOF_CONFIG_SPACE' 47 | amd64:amd64-helenos 48 | arm32/beagleboardxm:arm-helenos 49 | arm32/beaglebone:arm-helenos 50 | arm32/gta02:arm-helenos 51 | arm32/integratorcp:arm-helenos 52 | arm32/raspberrypi:arm-helenos 53 | ia32:i686-helenos 54 | ia64/i460GX:ia64-helenos 55 | ia64/ski:ia64-helenos 56 | mips32/malta-be:mips-helenos 57 | mips32/malta-le:mipsel-helenos 58 | mips32/msim:mipsel-helenos 59 | ppc32:ppc-helenos 60 | sparc64/niagara:sparc64-helenos 61 | sparc64/ultra:sparc64-helenos 62 | EOF_CONFIG_SPACE 63 | } 64 | 65 | h_get_arch_config() { 66 | h_get_arch_config_space | grep "^$H_ARCH:" | cut '-d:' -f "$1" 67 | } 68 | 69 | 70 | 71 | # 72 | # main script starts here 73 | # 74 | 75 | # Check we are actually running inside Travis 76 | if [ -z "$TRAVIS" ]; then 77 | echo "\$TRAVIS env not set. Are you running me inside Travis?" >&2 78 | exit 5 79 | fi 80 | 81 | # Check HelenOS configuration was set-up 82 | if [ -z "$H_ARCH" ]; then 83 | echo "\$H_ARCH env not set. Are you running me inside Travis?" >&2 84 | exit 5 85 | fi 86 | 87 | # Check HARBOUR was definied 88 | if [ -z "$H_HARBOUR" ]; then 89 | echo "\$H_HARBOUR env not set. Are you running me inside Travis?" >&2 90 | exit 5 91 | fi 92 | 93 | # Check cross-compiler target 94 | H_CROSS_TARGET=`h_get_arch_config $H_ARCH_CONFIG_CROSS_TARGET` 95 | if [ -z "$H_CROSS_TARGET" ]; then 96 | echo "No suitable cross-target found for '$H_ARCH.'" >&2 97 | exit 1 98 | fi 99 | 100 | # Default HelenOS repository 101 | if [ -z "$H_HELENOS_REPOSITORY" ]; then 102 | H_HELENOS_REPOSITORY="https://github.com/HelenOS/helenos.git" 103 | fi 104 | 105 | if [ "$1" = "help" ]; then 106 | echo 107 | echo "Following variables needs to be set prior running this script." 108 | echo "Example settings follows:" 109 | echo 110 | echo "export H_ARCH=$H_ARCH" 111 | echo "export H_ARCH=$H_HARBOUR" 112 | echo "export TRAVIS_BUILD_ID=`date +%s`" 113 | echo 114 | exit 0 115 | 116 | elif [ "$1" = "install" ]; then 117 | set -x 118 | 119 | # Fetch and install cross-compiler 120 | wget "https://helenos.s3.amazonaws.com/toolchain/$H_CROSS_TARGET.tar.xz" -O "/tmp/$H_CROSS_TARGET.tar.xz" || exit 1 121 | sudo tar -xJ -C "/" -f "/tmp/$H_CROSS_TARGET.tar.xz" || exit 1 122 | exit 0 123 | 124 | elif [ "$1" = "run" ]; then 125 | set -x 126 | 127 | H_HARBOURS_HOME=`pwd` 128 | 129 | cd "$HOME" || exit 1 130 | 131 | git clone --depth 10 "$H_HELENOS_REPOSITORY" helenos || exit 1 132 | 133 | mkdir "build-$TRAVIS_BUILD_ID" || exit 1 134 | cd "build-$TRAVIS_BUILD_ID" || exit 1 135 | git clone "$HOME/helenos" helenos || exit 1 136 | mkdir build || exit 1 137 | cd build || exit 1 138 | "$H_HARBOURS_HOME/hsct.sh" init "$HOME/build-$TRAVIS_BUILD_ID/helenos" $H_ARCH || exit 1 139 | 140 | # We cannot flood the output as Travis has limit of maximum output size 141 | # (reason is to prevent endless stacktraces going forever). But also Travis 142 | # kills a job that does not print anything for a while. 143 | # 144 | # So we store the full output into a file and print single dot for each line. 145 | # As pipe tends to hide errors we check the success by checking that archive 146 | # exists. 147 | # 148 | "$H_HARBOURS_HOME/hsct.sh" archive "$H_HARBOUR" 2>&1 | tee build.log | awk '// {printf "."}' 149 | 150 | tail -n 1000 build.log 151 | 152 | test -s "archives/$H_HARBOUR.tar.xz" 153 | 154 | RET="$?" 155 | if [ $RET -ne 0 ]; then 156 | exit $RET 157 | fi 158 | 159 | ls -lh archives 160 | 161 | set +x 162 | 163 | echo "Looks good, $H_HARBOUR built on $H_ARCH." 164 | echo 165 | else 166 | echo "Invalid action specified." >&2 167 | exit 5 168 | fi 169 | -------------------------------------------------------------------------------- /zlib/HARBOUR: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2013 Vojtech Horky 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions 7 | # are met: 8 | # 9 | # - Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # - Redistributions in binary form must reproduce the above copyright 12 | # notice, this list of conditions and the following disclaimer in the 13 | # documentation and/or other materials provided with the distribution. 14 | # - The name of the author may not be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | shipname=zlib 30 | shipversion=1.3.1 31 | shipsources="http://zlib.net/${shipname}-${shipversion}.tar.gz" 32 | shipfunnels=4 33 | 34 | build() { 35 | run tar xzf "${shipname}-${shipversion}.tar.gz" 36 | # FIXME - need to create patch replacing all write() with write_all() 37 | # because apparently zlib expects that write() has to write() everything 38 | # (see gzwrite.c:84). 39 | cd "${shipname}-${shipversion}" 40 | run env \ 41 | CHOST=$HSCT_TARGET \ 42 | CC=$HSCT_CC \ 43 | ./configure \ 44 | --static 45 | run make -j$shipfunnels STATIC_ONLY=y 46 | } 47 | 48 | package() { 49 | cd "${shipname}-${shipversion}" 50 | run make install DESTDIR=$PWD/PKG 51 | 52 | # Copy the headers and static library 53 | run cp PKG/usr/local/include/zlib.h PKG/usr/local/include/zconf.h "$HSCT_INCLUDE_DIR/" 54 | run cp PKG/usr/local/lib/libz.a "$HSCT_LIB_DIR/" 55 | 56 | run mkdir -p "$HSCT_MY_DIR/inc/c" 57 | run cp PKG/usr/local/include/zlib.h PKG/usr/local/include/zconf.h "$HSCT_MY_DIR/inc/c" 58 | 59 | run mkdir -p "$HSCT_MY_DIR/lib" 60 | run cp PKG/usr/local/lib/libz.a "$HSCT_MY_DIR/lib" 61 | 62 | # Copy the executables 63 | run mkdir -p "$HSCT_MY_DIR/app/" 64 | run cp minigzip "$HSCT_MY_DIR/app/" 65 | if [ -x minigzip64 ]; then 66 | run cp minigzip64 "$HSCT_MY_DIR/app/" 67 | fi 68 | } 69 | --------------------------------------------------------------------------------