Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: build_tools/common.sh

Issue 14172016: Enable glibc shared library support for zlib. (Closed) Base URL: https://naclports.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | examples/games/nethack/nacl-nethack.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # 4 #
5 # Environment variable NACL_ARCH should be unset or set to "i686" 5 # Environment variable NACL_ARCH should be unset or set to "i686"
6 # for a 32-bit build. It should be set to "x86_64", "pnacl", or "arm" 6 # for a 32-bit build. It should be set to "x86_64", "pnacl", or "arm"
7 # for a 64-bit, pnacl, or arm builds. 7 # for a 64-bit, pnacl, or arm builds.
8 8
9 9
10 # NAMING CONVENTION 10 # NAMING CONVENTION
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 # export the nacl tools 585 # export the nacl tools
586 export CC=${NACLCC} 586 export CC=${NACLCC}
587 export CXX=${NACLCXX} 587 export CXX=${NACLCXX}
588 export AR=${NACLAR} 588 export AR=${NACLAR}
589 export RANLIB=${NACLRANLIB} 589 export RANLIB=${NACLRANLIB}
590 export PKG_CONFIG_PATH=${NACLPORTS_LIBDIR}/pkgconfig 590 export PKG_CONFIG_PATH=${NACLPORTS_LIBDIR}/pkgconfig
591 export PKG_CONFIG_LIBDIR=${NACLPORTS_LIBDIR} 591 export PKG_CONFIG_LIBDIR=${NACLPORTS_LIBDIR}
592 export FREETYPE_CONFIG=${NACLPORTS_PREFIX_BIN}/freetype-config 592 export FREETYPE_CONFIG=${NACLPORTS_PREFIX_BIN}/freetype-config
593 export PATH=${NACL_BIN_PATH}:${PATH}; 593 export PATH=${NACL_BIN_PATH}:${PATH};
594 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR} 594 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR}
595 Remove "build-nacl" 595 Remove build-nacl
596 MakeDir "build-nacl" 596 MakeDir build-nacl
597 cd "build-nacl" 597 cd build-nacl
598 echo "Directory: $(pwd)" 598 echo "Directory: $(pwd)"
599 599
600 local conf_host=${NACL_CROSS_PREFIX} 600 local conf_host=${NACL_CROSS_PREFIX}
601 if [ ${NACL_ARCH} = "pnacl" ]; then 601 if [ ${NACL_ARCH} = "pnacl" ]; then
602 # The PNaCl tools use "pnacl-" as the prefix, but config.sub 602 # The PNaCl tools use "pnacl-" as the prefix, but config.sub
603 # does not know about "pnacl". It only knows about "le32-nacl". 603 # does not know about "pnacl". It only knows about "le32-nacl".
604 # Unfortunately, most of the config.subs here are so old that 604 # Unfortunately, most of the config.subs here are so old that
605 # it doesn't know about that "le32" either. So we just say "nacl". 605 # it doesn't know about that "le32" either. So we just say "nacl".
606 conf_host="nacl" 606 conf_host="nacl"
607 fi 607 fi
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 666
667 667
668 # echo a command before exexuting it under 'time' 668 # echo a command before exexuting it under 'time'
669 TimeCommand() { 669 TimeCommand() {
670 echo "$@" 670 echo "$@"
671 time "$@" 671 time "$@"
672 } 672 }
673 673
674 674
675 Validate() {
676 if [ ${NACL_ARCH} = "pnacl" ]; then
677 return
678 elif [ ${NACL_ARCH} = "arm" ]; then
679 NACL_VALIDATE=${NACL_SDK_ROOT}/tools/ncval_arm
680 elif [ ${NACL_ARCH} = "x86_64" ]; then
681 NACL_VALIDATE="${NACL_SDK_ROOT}/tools/ncval_x86_64 --errors"
682 else
683 NACL_VALIDATE=${NACL_SDK_ROOT}/tools/ncval_x86_32
684 fi
685 LogExecute ${NACL_VALIDATE} $@
686 if [ $? != 0 ]; then
687 exit 1
688 fi
689 }
690
691
692 DefaultValidateStep() {
693 if [ ${NACL_ARCH} != "pnacl" -a -n "${EXECUTABLES:-}" ]; then
694 for nexe in $EXECUTABLES ; do
695 Validate $nexe
696 done
697 fi
698 }
699
700
675 RunSelLdrCommand() { 701 RunSelLdrCommand() {
676 if [ $NACL_ARCH = "arm" ]; then 702 if [ $NACL_ARCH = "arm" ]; then
677 # no sel_ldr for arm 703 # no sel_ldr for arm
678 return 704 return
679 fi 705 fi
680 echo "[sel_ldr] $@" 706 echo "[sel_ldr] $@"
681 if [ $NACL_GLIBC = "1" ]; then 707 if [ $NACL_GLIBC = "1" ]; then
682 time "${NACL_SEL_LDR}" -a -B "${NACL_IRT}" -- \ 708 time "${NACL_SEL_LDR}" -a -B "${NACL_IRT}" -- \
683 "${NACL_SDK_LIB}/runnable-ld.so" --library-path "${NACL_SDK_LIB}" "$@" 709 "${NACL_SDK_LIB}/runnable-ld.so" --library-path "${NACL_SDK_LIB}" "$@"
684 else 710 else
685 time "${NACL_SEL_LDR}" -a -B "${NACL_IRT}" -- "$@" 711 time "${NACL_SEL_LDR}" -a -B "${NACL_IRT}" -- "$@"
686 fi 712 fi
687 } 713 }
688 714
715
689 WriteSelLdrScript() { 716 WriteSelLdrScript() {
690 if [ $NACL_ARCH = "arm" ]; then 717 if [ $NACL_ARCH = "arm" ]; then
691 # no sel_ldr for arm 718 # no sel_ldr for arm
692 return 719 return
693 fi 720 fi
694 if [ $NACL_GLIBC = "1" ]; then 721 if [ $NACL_GLIBC = "1" ]; then
695 cat > $1 <<HERE 722 cat > $1 <<HERE
696 #!/bin/bash 723 #!/bin/bash
697 export NACLLOG=/dev/null 724 export NACLLOG=/dev/null
698 "${NACL_SEL_LDR}" -a -B "${NACL_IRT}" -- \ 725
699 "${NACL_SDK_LIB}/runnable-ld.so" --library-path "${NACL_SDK_LIB}" "$2" "\$@" 726 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}")
727 SEL_LDR=${NACL_SEL_LDR}
728 IRT=${NACL_IRT}
729 SDK_LIB_DIR=${NACL_SDK_LIB}
730 LIB_PATH=\${SDK_LIB_DIR}:\${SCRIPT_DIR}
731
732 "\${SEL_LDR}" -a -B "\${IRT}" -- \\
733 "\${SDK_LIB_DIR}/runnable-ld.so" --library-path "\${LIB_PATH}" \\
734 "\${SCRIPT_DIR}/$2" "\$@"
700 HERE 735 HERE
701 else 736 else
702 cat > $1 <<HERE 737 cat > $1 <<HERE
703 #!/bin/bash 738 #!/bin/bash
704 export NACLLOG=/dev/null 739 export NACLLOG=/dev/null
705 "${NACL_SEL_LDR}" -B "${NACL_IRT}" -- "$2" "\$@" 740
741 SCRIPT_DIR=\$(dirname "\${BASH_SOURCE[0]}")
742 SEL_LDR=${NACL_SEL_LDR}
743 IRT=${NACL_IRT}
744
745 "\${SEL_LDR}" -B "\${IRT}" -- "\${SCRIPT_DIR}/$2" "\$@"
706 HERE 746 HERE
707 fi 747 fi
708 chmod 750 $1 748 chmod 750 $1
709 echo "Wrote script pwd:$PWD $1" 749 echo "Wrote script pwd:$PWD $1"
710 } 750 }
711 751
712 DefaultTranslateStep() { 752
713 local package=$1 753 TranslatePexe() {
714 local build_dir="${NACL_PACKAGES_REPOSITORY}/${package}" 754 local pexe=$1
715 local pexe=${build_dir}/$2
716 local arches="arm x86-32 x86-64" 755 local arches="arm x86-32 x86-64"
717
718 Banner "Translating ${pexe}" 756 Banner "Translating ${pexe}"
719 ls -l ${pexe}
720 757
721 echo "stripping pexe" 758 echo "stripping pexe"
722 TimeCommand ${NACLSTRIP} ${pexe} -o ${pexe}.stripped 759 TimeCommand ${NACLSTRIP} ${pexe} -o ${pexe}.stripped
723 ls -l ${pexe}.stripped
724 760
725 for a in ${arches} ; do 761 for a in ${arches} ; do
726 echo
727 echo "translating pexe [$a]" 762 echo "translating pexe [$a]"
728 nexe=${pexe}.$a.nexe 763 nexe=${pexe}.$a.nexe
729 TimeCommand ${TRANSLATOR} -arch $a ${pexe}.stripped -o ${nexe} 764 TimeCommand ${TRANSLATOR} -arch $a ${pexe}.stripped -o ${nexe}
730 ls -l ${nexe}
731 done 765 done
732 766
733 # PIC branch 767 # PIC branch
734 for a in ${arches} ; do 768 for a in ${arches} ; do
735 echo
736 echo "translating pexe [$a,pic]" 769 echo "translating pexe [$a,pic]"
737 nexe=${pexe}.$a.pic.nexe 770 nexe=${pexe}.$a.pic.nexe
738 TimeCommand ${TRANSLATOR} -arch $a -fPIC ${pexe}.stripped -o ${nexe} 771 TimeCommand ${TRANSLATOR} -arch $a -fPIC ${pexe}.stripped -o ${nexe}
739 ls -l ${nexe}
740 done 772 done
741 773
742 # Now the same spiel with an optimized pexe 774 # Now the same spiel with an optimized pexe
743 opt_args="-O3 -inline-threshold=100" 775 opt_args="-O3 -inline-threshold=100"
744 echo
745 echo "optimizing pexe [${opt_args}]" 776 echo "optimizing pexe [${opt_args}]"
746 TimeCommand ${OPT} ${opt_args} ${pexe}.stripped -o ${pexe}.stripped.opt 777 TimeCommand ${OPT} ${opt_args} ${pexe}.stripped -o ${pexe}.stripped.opt
747 ls -l ${pexe}.stripped.opt
748 778
749 for a in ${arches} ; do 779 for a in ${arches} ; do
750 echo
751 echo "translating pexe [$a]" 780 echo "translating pexe [$a]"
752 nexe=${pexe}.opt.$a.nexe 781 nexe=${pexe}.opt.$a.nexe
753 TimeCommand ${TRANSLATOR} -arch $a ${pexe}.stripped.opt -o ${nexe} 782 TimeCommand ${TRANSLATOR} -arch $a ${pexe}.stripped.opt -o ${nexe}
754 ls -l ${nexe}
755 done 783 done
756 784
757 # PIC branch 785 # PIC branch
758 for a in ${arches}; do 786 for a in ${arches}; do
759 echo
760 echo "translating pexe [$a,pic]" 787 echo "translating pexe [$a,pic]"
761 nexe=${pexe}.$a.pic.opt.nexe 788 nexe=${pexe}.$a.pic.opt.nexe
762 TimeCommand ${TRANSLATOR} -arch $a -fPIC ${pexe}.stripped.opt -o ${nexe} 789 TimeCommand ${TRANSLATOR} -arch $a -fPIC ${pexe}.stripped.opt -o ${nexe}
763 ls -l ${nexe}
764 done 790 done
765 791
766 ls -l $(dirname ${pexe}) 792 ls -l $(dirname ${pexe})/*.nexe ${pexe}
767 } 793 }
768 794
769 795
796 DefaultTranslateStep() {
797 if [ ${NACL_ARCH} = "pnacl" -a -n "${EXECUTABLES:-}" ]; then
798 for pexe in ${EXECUTABLES} ; do
799 TranslatePexe ${pexe}
800 done
801 fi
802 }
803
804
770 DefaultPackageInstall() { 805 DefaultPackageInstall() {
771 DefaultPreInstallStep 806 DefaultPreInstallStep
772 DefaultDownloadStep 807 DefaultDownloadStep
773 DefaultExtractStep 808 DefaultExtractStep
774 DefaultPatchStep 809 DefaultPatchStep
775 DefaultConfigureStep 810 DefaultConfigureStep
776 DefaultBuildStep 811 DefaultBuildStep
812 DefaultTranslateStep
813 DefaultValidateStep
777 DefaultInstallStep 814 DefaultInstallStep
778 DefaultCleanUpStep 815 DefaultCleanUpStep
779 } 816 }
OLDNEW
« no previous file with comments | « no previous file | examples/games/nethack/nacl-nethack.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698