mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-11-04 09:26:10 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			74 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
build_linux() {
 | 
						|
  # Linux Docker image
 | 
						|
  name="$DOCKER_BASE"
 | 
						|
  DOCKER_BUILDS="$DOCKER_BUILDS $name"
 | 
						|
  docker build -t "$name:current" .
 | 
						|
  docker run "$name:current" --version
 | 
						|
  printf '%s\n' "#!/bin/sh" "echo 'hello world'" > myscript
 | 
						|
  docker run -v "$PWD:/mnt" "$name:current" myscript
 | 
						|
 | 
						|
  # Copy static executable from docker image
 | 
						|
  id=$(docker create "$name:current")
 | 
						|
  docker cp "$id:/bin/shellcheck" "shellcheck"
 | 
						|
  docker rm "$id"
 | 
						|
  ls -l shellcheck
 | 
						|
  ./shellcheck myscript
 | 
						|
  for tag in $TAGS
 | 
						|
  do
 | 
						|
    cp "shellcheck" "deploy/shellcheck-$tag.linux-x86_64";
 | 
						|
  done
 | 
						|
}
 | 
						|
 | 
						|
build_aarch64() {
 | 
						|
  # Linux aarch64 static executable
 | 
						|
  docker run -v "$PWD:/mnt" koalaman/aarch64-builder 'buildsc'
 | 
						|
  for tag in $TAGS
 | 
						|
  do
 | 
						|
    cp "shellcheck" "deploy/shellcheck-$tag.linux-aarch64"
 | 
						|
  done
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
build_armv6hf() {
 | 
						|
  # Linux armv6hf static executable
 | 
						|
  docker run -v "$PWD:/mnt" koalaman/armv6hf-builder -c 'compile-shellcheck'
 | 
						|
  for tag in $TAGS
 | 
						|
  do
 | 
						|
    cp "shellcheck" "deploy/shellcheck-$tag.linux-armv6hf";
 | 
						|
  done
 | 
						|
}
 | 
						|
 | 
						|
build_windows() {
 | 
						|
  # Windows .exe
 | 
						|
  docker run -v "$PWD:/appdata" koalaman/winghc cuib
 | 
						|
  for tag in $TAGS
 | 
						|
  do
 | 
						|
    cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe";
 | 
						|
  done
 | 
						|
}
 | 
						|
 | 
						|
build_osx() {
 | 
						|
  # Darwin x86_64 executable
 | 
						|
  brew update
 | 
						|
  brew install cabal-install pandoc gnu-tar
 | 
						|
  sudo ln -sf /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
 | 
						|
  sudo ln -sf /usr/local/bin/gtar /usr/local/bin/tar
 | 
						|
  export PATH="/usr/local/bin:$PATH"
 | 
						|
 | 
						|
  cabal update
 | 
						|
  cabal install --dependencies-only
 | 
						|
  cabal build shellcheck
 | 
						|
 | 
						|
  # Cabal 3 no longer has a predictable output path
 | 
						|
  path="$(find . -name 'shellcheck' -type f -perm +111)"
 | 
						|
  [[ -e "$path" ]]
 | 
						|
 | 
						|
  for tag in $TAGS
 | 
						|
  do
 | 
						|
    cp "$path" "deploy/shellcheck-$tag.darwin-x86_64";
 | 
						|
  done
 | 
						|
}
 | 
						|
 |