如何使用cygwin在Windows上运行.sh文件?

时间:2013-11-22 15:40:46

标签: linux windows cygwin

我是cygwin终端的初学者。我正在尝试使用命令*.sh在Windows 8上运行./file_name.sh文件,但它给出了以下错误....

Using prebuilt externals

ERROR: Cannot find 'make' program. Please install Cygwin make package or define the GNUMAKE variable to point to it.

我在cygwin驱动器中安装了F,我谷歌此错误并在computer properties > advance system properties > variable environment > path >edit中设置变量路径,变量路径为;F:\cygwin\bin 但是不起作用。我怎样才能解决这个问题?

这是我的剧本

`# set params`
NDK_ROOT=/cygdrive/f/Android/android-ndk-r9b
COCOS2DX_ROOT=/cygdrive/f/Android/cocos2d-2.0-rc2-x-2.0.1
GAME_ROOT=$COCOS2DX_ROOT/molatx
GAME_ANDROID_ROOT=$GAME_ROOT/proj.android
RESOURCE_ROOT=$GAME_ROOT/Resources

buildexternalsfromsource=

usage(){
cat << EOF
usage: $0 [options]

Build C/C++ native code using Android NDK

OPTIONS:
   -s   Build externals from source
   -h   this help
EOF
}

while getopts "s" OPTION; do
    case "$OPTION" in
        s)
            buildexternalsfromsource=1
            ;;
        h)
            usage
            exit 0
            ;;
    esac
done

`# make sure assets is exist`
if [ -d $GAME_ANDROID_ROOT/assets ]; then
    rm -rf $GAME_ANDROID_ROOT/assets
fi

mkdir $GAME_ANDROID_ROOT/assets

`# copy resources`
for file in $RESOURCE_ROOT/*
do
    if [ -d "$file" ]; then
        cp -rf "$file" $GAME_ANDROID_ROOT/assets
    fi

    if [ -f "$file" ]; then
        cp "$file" $GAME_ANDROID_ROOT/assets
    fi
done

`# copy icons (if they exist)`
file=$GAME_ANDROID_ROOT/assets/Icon-72.png
if [ -f "$file" ]; then
    cp $file $GAME_ANDROID_ROOT/res/drawable-hdpi/icon.png
fi
file=$GAME_ANDROID_ROOT/assets/Icon-48.png
if [ -f "$file" ]; then
    cp $file $GAME_ANDROID_ROOT/res/drawable-mdpi/icon.png
fi
file=$GAME_ANDROID_ROOT/assets/Icon-32.png
if [ -f "$file" ]; then
    cp $file $GAME_ANDROID_ROOT/res/drawable-ldpi/icon.png
fi


if [[ $buildexternalsfromsource ]]; then
    echo "Building external dependencies from source"
    $NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
        NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source
else
    echo "Using prebuilt externals"
    $NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
        NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt
fi

2 个答案:

答案 0 :(得分:1)

您必须使用cygwin“setup.exe”向导安装make package。 检查脚本编译的编程语言是什么,因为该语言的编译器也是脚本的依赖项。

可能你也需要安装一些库。

答案 1 :(得分:0)

您的Windows系统路径与您的Cygwin路径不同。如果使用cygwin安装程序安装所需的软件包,它们将在$ PATH中可用。

运行cygwin setup install:make,automake,gcc,gcc-c ++