#!/bin/bash

cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119961-16/SUNWsprot/reloc/usr/ccs/bin
sudo install -c /usr/bin -m 555 -u root -g root as
cd /usr/ccs/bin
sudo ln -s ../../bin/as as
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119961-16/SUNWsprot/reloc/usr/lib/amd64
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libtdf.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libxprof_audit.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libxprof.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119961-16/SUNWsprot/reloc/usr/lib
sudo install -c /usr/lib -m 755 -u root -g bin cm4defs
sudo install -c /usr/lib -m 755 -u root -g bin libtdf.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libxprof_audit.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libxprof.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119964-35/SUNWlibC/reloc/usr/include
sudo install -c /usr/include -m 644 -u root -g bin demangle.h
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119964-35/SUNWlibC/reloc/usr/lib/amd64
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libCrun.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libCrunG3.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libCstd.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libdemangle.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libiostream.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119964-35/SUNWlibC/reloc/usr/lib
sudo install -c /usr/lib -m 755 -u root -g bin libC.so.5
sudo install -c /usr/lib -m 755 -u root -g bin libCrun.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libCrunG3.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libCstd.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libdemangle.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libiostream.so.1

# Begin potential confusion
# This script does not install libm.so.1, libm.so.2, or libmvec.so.1
# These already exist in OpenIndiana, might break things?
# Only install the sunmath bits
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119967-02/SUNWlibm/reloc/usr/include
sudo install -c /usr/include -m 644 -u root -g bin sunmath.h
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119967-02/SUNWlibmr/reloc/lib/amd64
sudo install -c /lib/amd64 -m 644 -u root -g bin llib-lsunmath.ln
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119967-02/SUNWlibmr/reloc/lib
sudo install -c /lib -m 644 -u root -g bin llib-lsunmath
sudo install -c /lib -m 644 -u root -g bin llib-lsunmath.ln
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119967-02/SUNWlibmsr/reloc/lib/amd64
sudo install -c /lib/amd64 -m 644 -u root -g bin libsunmath.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/119967-02/SUNWlibmsr/reloc/lib
sudo install -c /lib -m 644 -u root -g bin libsunmath.so.1
# End of potential confusion

cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/120754-17/SUNWlibm/reloc/usr/include
sudo install -c /usr/include -m 644 -u root -g bin libmtsk_db.h
sudo install -c /usr/include -m 644 -u root -g bin omp_collector_api.h
sudo install -c /usr/include -m 644 -u root -g bin omp.h
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/120754-17/SUNWlibmsr/reloc/lib/amd64
sudo install -c /lib/amd64 -m 755 -u root -g bin libmmheap.so.1
sudo install -c /lib/amd64 -m 755 -u root -g bin libmtsk_db.so.1
sudo install -c /lib/amd64 -m 755 -u root -g bin libmtsk.so.1
sudo install -c /lib/amd64 -m 755 -u root -g bin libstkovf.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/120754-17/SUNWlibmsr/reloc/lib
sudo install -c /lib -m 755 -u root -g bin libmmheap.so.1
sudo install -c /lib -m 755 -u root -g bin libmtsk_db.so.1
sudo install -c /lib -m 755 -u root -g bin libmtsk.so.1
sudo install -c /lib -m 755 -u root -g bin libstkovf.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/152227-01/SUNWlibm/reloc/usr/lib/amd64
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libfsu_db.so.1
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libfsu.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/152227-01/SUNWlibm/reloc/usr/lib
sudo install -c /usr/lib -m 755 -u root -g bin libfsu_db.so.1
sudo install -c /usr/lib -m 755 -u root -g bin libfsu.so.1
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/152229-01/SUNWlibm/reloc/usr/include
sudo install -c /usr/include -m 644 -u root -g bin sunperf.h
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/152229-01/SUNWlibm/reloc/usr/lib/amd64
sudo install -c /usr/lib/amd64 -m 755 -u root -g bin libsunperf.so.3.2
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/152229-01/SUNWlibm/reloc/usr/lib
sudo install -c /usr/lib -m 755 -u root -g bin libsunperf.so.4.2
cd ~/OracleDeveloperStudio12.6-solaris-x86-pkg/patches/system/152229-01/SUNWlibm/reloc/usr/lib/locale/C/LC_MESSAGES
sudo install -c /usr/lib/locale/C/LC_MESSAGES -m 644 -u root -g bin SUNW_SPRO_libsunperf.cat
