Streamline build from source steps

This commit is contained in:
Chiran Fernando 2025-05-22 17:07:45 +05:30
parent c7fc15399b
commit 2a0075b22e

114
README.md
View file

@ -223,102 +223,100 @@ asgardeo:
``` ```
## Build from Source ## Build from Source
### Prerequisites for Building ### Prerequisites
* Go 1.20 or higher * Go 1.20 or higher
* Git * Git
* Make (for Linux/macOS builds) * Make (optional, for simplified builds)
### Building on Linux/macOS ### Clone and Build
1. Clone the repository: 1. **Clone the repository:**
```bash ```bash
git clone https://github.com/wso2/open-mcp-auth-proxy git clone https://github.com/wso2/open-mcp-auth-proxy
cd open-mcp-auth-proxy cd open-mcp-auth-proxy
``` ```
2. Install dependencies: 2. **Install dependencies:**
```bash ```bash
go get -v -t -d ./... go get -v -t -d ./...
``` ```
3. Build for your platform: 3. **Build the application:**
**Option A: Using Make**
```bash ```bash
# Build for all platforms # Build for all platforms
make all make all
# Or build for a specific platform # Or build for specific platforms
make build-linux # For Linux make build-linux # For Linux (x86_64)
make build-darwin # For macOS
make build-linux-arm # For ARM-based Linux make build-linux-arm # For ARM-based Linux
make build-darwin # For macOS
make build-windows # For Windows make build-windows # For Windows
``` ```
4. Find your build in the `build` directory: **Option B: Manual build (works on all platforms)**
```bash ```bash
# For Linux # Build for your current platform
go build -o openmcpauthproxy ./cmd/proxy
# Cross-compile for other platforms
GOOS=linux GOARCH=amd64 go build -o openmcpauthproxy-linux ./cmd/proxy
GOOS=windows GOARCH=amd64 go build -o openmcpauthproxy.exe ./cmd/proxy
GOOS=darwin GOARCH=amd64 go build -o openmcpauthproxy-macos ./cmd/proxy
```
### Run the Built Application
After building, you'll find the executables in the `build` directory (when using Make) or in your project root (when building manually).
**Linux/macOS:**
```bash
# If built with Make
./build/linux/openmcpauthproxy --demo ./build/linux/openmcpauthproxy --demo
# For macOS # If built manually
./build/darwin/openmcpauthproxy --demo ./openmcpauthproxy --demo
``` ```
### Building on Windows **Windows:**
1. Clone the repository:
```powershell ```powershell
git clone https://github.com/wso2/open-mcp-auth-proxy # If built with Make
cd open-mcp-auth-proxy .\build\windows\openmcpauthproxy.exe --demo
```
2. Install dependencies: # If built manually
```powershell
go get -v -t -d ./...
```
3. Option 1: Build using Make if you have it installed:
```powershell
make build-windows
```
Option 2: Build manually without Make:
```powershell
mkdir -p build\windows
go build -o build\windows\openmcpauthproxy.exe .\cmd\proxy
copy config.yaml build\windows\
```
4. Run the built application:
```powershell
cd build\windows
.\openmcpauthproxy.exe --demo .\openmcpauthproxy.exe --demo
``` ```
### Starting the Proxy on Windows ### Available Command Line Options
1. Open Command Prompt or PowerShell ```bash
2. Navigate to the build directory:
```powershell
cd build\windows
```
3. Run the executable with your desired options:
```powershell
# Start in demo mode (using Asgardeo sandbox) # Start in demo mode (using Asgardeo sandbox)
openmcpauthproxy.exe --demo ./openmcpauthproxy --demo
# Start with Asgardeo integration # Start with your own Asgardeo organization
openmcpauthproxy.exe --asgardeo ./openmcpauthproxy --asgardeo
# Start in stdio mode # Use stdio transport mode instead of SSE
openmcpauthproxy.exe --demo --stdio ./openmcpauthproxy --demo --stdio
# Enable debug logging # Enable debug logging
openmcpauthproxy.exe --demo --debug ./openmcpauthproxy --demo --debug
# See all available options # Show all available options
openmcpauthproxy.exe --help ./openmcpauthproxy --help
``` ```
4. The proxy will start and display messages indicating it's running ### Additional Make Targets
5. To stop the proxy, press `Ctrl+C` in the command window
If you're using Make, these additional targets are available:
```bash
make test # Run tests
make coverage # Run tests with coverage report
make fmt # Format code with gofmt
make vet # Run go vet
make clean # Clean build artifacts
make help # Show all available targets
```