mirror of
				https://github.com/nkanaev/yarr.git
				synced 2025-10-30 22:43:29 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			5bf7647cba
			...
			gh-actions
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 348693fa95 | ||
|  | b40c6fc9e4 | ||
|  | 73fd637b23 | 
							
								
								
									
										25
									
								
								.github/actions/prepare/action.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								.github/actions/prepare/action.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,25 +0,0 @@ | |||||||
| name: Build & Upload |  | ||||||
| inputs: |  | ||||||
|   id: |  | ||||||
|     description: artifact name |  | ||||||
|     required: true |  | ||||||
|   cmd: |  | ||||||
|     description: command to run |  | ||||||
|     required: true |  | ||||||
|   out: |  | ||||||
|     description: path to output file |  | ||||||
|     required: true |  | ||||||
| runs: |  | ||||||
|   using: composite |  | ||||||
|   steps: |  | ||||||
|     - name: compile |  | ||||||
|       run: ${{ inputs.cmd }} |  | ||||||
|       shell: bash |  | ||||||
|     - name: archive |  | ||||||
|       run: tar -cvf ${{ inputs.out }}.tar ${{ inputs.out }} |  | ||||||
|       shell: bash |  | ||||||
|     - name: upload |  | ||||||
|       uses: actions/upload-artifact@v4 |  | ||||||
|       with: |  | ||||||
|         name: ${{ inputs.id }} |  | ||||||
|         path: ${{ inputs.out }}.tar |  | ||||||
							
								
								
									
										229
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										229
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -5,121 +5,169 @@ on: | |||||||
|     tags: |     tags: | ||||||
|       - v* |       - v* | ||||||
|   workflow_dispatch: |   workflow_dispatch: | ||||||
|  |   workflow_run: | ||||||
|  |     workflows: [Test] | ||||||
|  |     types: | ||||||
|  |       - completed | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
|   build_macos: |   build_macos: | ||||||
|     name: Build for MacOS |     name: Build for MacOS | ||||||
|     runs-on: macos-13 |     runs-on: macos-13 | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: "Checkout" | ||||||
|       uses: actions/checkout@v4 |       uses: actions/checkout@v2 | ||||||
|     - name: Setup Go |  | ||||||
|       uses: actions/setup-go@v4 |  | ||||||
|       with: |       with: | ||||||
|         go-version: '^1.18' |         submodules: 'recursive' | ||||||
|     - name: Build arm64 gui |     - name: "Setup Go" | ||||||
|       uses: ./.github/actions/prepare |       uses: actions/setup-go@v2 | ||||||
|       with: |       with: | ||||||
|         id: darwin_arm64_gui |         go-version: '^1.17' | ||||||
|         cmd: make darwin_arm64_gui |     - name: Cache Go Modules | ||||||
|         out: out/darwin_arm64_gui/yarr.app |       uses: actions/cache@v4 | ||||||
|     - name: Build amd64 gui |  | ||||||
|       uses: ./.github/actions/prepare |  | ||||||
|       with: |       with: | ||||||
|         id: darwin_amd64_gui |         path: ~/go/pkg/mod | ||||||
|         cmd: make darwin_amd64_gui |         key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||||||
|         out: out/darwin_amd64_gui/yarr.app |         restore-keys: | | ||||||
|     - name: Build arm64 |           ${{ runner.os }}-go- | ||||||
|       uses: ./.github/actions/prepare |     - name: "Build" | ||||||
|  |       run: make build_macos | ||||||
|  |     - name: Upload | ||||||
|  |       uses: actions/upload-artifact@v4 | ||||||
|       with: |       with: | ||||||
|         id: darwin_arm64 |         name: macos | ||||||
|         cmd: make darwin_arm64 |         path: _output/macos/yarr.app | ||||||
|         out: out/darwin_arm64/yarr |  | ||||||
|     - name: Build amd64 |  | ||||||
|       uses: ./.github/actions/prepare |  | ||||||
|       with: |  | ||||||
|         id: darwin_amd64 |  | ||||||
|         cmd: make darwin_amd64 |  | ||||||
|         out: out/darwin_amd64/yarr |  | ||||||
|  |  | ||||||
|   build_windows: |   build_windows: | ||||||
|     name: Build for Windows |     name: Build for Windows | ||||||
|     runs-on: windows-2022 |     runs-on: windows-2022 | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: "Checkout" | ||||||
|       uses: actions/checkout@v4 |       uses: actions/checkout@v2 | ||||||
|     - name: Setup Go |  | ||||||
|       uses: actions/setup-go@v4 |  | ||||||
|       with: |       with: | ||||||
|         go-version: '^1.18' |         submodules: 'recursive' | ||||||
|     - name: Setup Zig |     - name: "Setup Go" | ||||||
|       uses: mlugg/setup-zig@v1 |       uses: actions/setup-go@v2 | ||||||
|       with: |       with: | ||||||
|         version: 0.14.0 |         go-version: '^1.17' | ||||||
|     - name: Build arm64 gui |     - name: Cache Go Modules | ||||||
|       if: false |       uses: actions/cache@v4 | ||||||
|       uses: ./.github/actions/prepare |  | ||||||
|       with: |       with: | ||||||
|         id: windows_arm64_gui |         path: ~/go/pkg/mod | ||||||
|         cmd: make windows_arm64_gui |         key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||||||
|         out: out/windows_arm64_gui/yarr.app |         restore-keys: | | ||||||
|     - name: Build amd64 gui |           ${{ runner.os }}-go- | ||||||
|       uses: ./.github/actions/prepare |     - name: "Build" | ||||||
|  |       run: make build_windows | ||||||
|  |     - name: Upload | ||||||
|  |       uses: actions/upload-artifact@v4 | ||||||
|       with: |       with: | ||||||
|         id: windows_amd64_gui |         name: windows | ||||||
|         cmd: make windows_amd64_gui |         path: _output/windows/yarr.exe | ||||||
|         out: out/windows_amd64_gui/yarr.app |  | ||||||
|     - name: Build arm64 |  | ||||||
|       uses: ./.github/actions/prepare |  | ||||||
|       with: |  | ||||||
|         id: windows_arm64 |  | ||||||
|         cmd: make windows_arm64 |  | ||||||
|         out: out/windows_arm64/yarr |  | ||||||
|     - name: Build amd64 |  | ||||||
|       uses: ./.github/actions/prepare |  | ||||||
|       with: |  | ||||||
|         id: windows_amd64 |  | ||||||
|         cmd: make windows_amd64 |  | ||||||
|         out: out/windows_amd64/yarr |  | ||||||
|  |  | ||||||
|   build_linux: |   build_linux: | ||||||
|     name: Build for Linux |     name: Build for Linux | ||||||
|     runs-on: ubuntu-22.04 |     runs-on: ubuntu-22.04 | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: "Checkout" | ||||||
|       uses: actions/checkout@v4 |       uses: actions/checkout@v2 | ||||||
|     - name: Setup Go |  | ||||||
|       uses: actions/setup-go@v4 |  | ||||||
|       with: |       with: | ||||||
|         go-version: '^1.18' |         submodules: 'recursive' | ||||||
|     - name: Setup Zig |     - name: "Setup Go" | ||||||
|       uses: mlugg/setup-zig@v1 |       uses: actions/setup-go@v2 | ||||||
|       with: |       with: | ||||||
|         version: 0.14.0 |         go-version: '^1.17' | ||||||
|     - name: Build amd64 |     - name: Cache Go Modules | ||||||
|       uses: ./.github/actions/prepare |       uses: actions/cache@v4 | ||||||
|       with: |       with: | ||||||
|         id: linux_amd64 |         path: ~/go/pkg/mod | ||||||
|         cmd: make linux_amd64 |         key: ${{ runner.os }}-amd64-go-${{ hashFiles('**/go.sum') }} | ||||||
|         out: out/linux_amd64/yarr |         restore-keys: | | ||||||
|     - name: Build arm64 |           ${{ runner.os }}-go-amd64 | ||||||
|       uses: ./.github/actions/prepare |     - name: "Build" | ||||||
|  |       run: make build_linux | ||||||
|  |     - name: Upload | ||||||
|  |       uses: actions/upload-artifact@v4 | ||||||
|       with: |       with: | ||||||
|         id: linux_arm64 |         name: linux | ||||||
|         cmd: make linux_arm64 |         path: _output/linux/yarr | ||||||
|         out: out/linux_arm64/yarr |  | ||||||
|     - name: Build armv7 |   build_linux-arm: | ||||||
|       uses: ./.github/actions/prepare |     name: Build for Linux ARM | ||||||
|  |     runs-on: ubuntu-22.04 | ||||||
|  |     steps: | ||||||
|  |     - name: Install dependencies | ||||||
|  |       run: > | ||||||
|  |         sudo apt-get install -y | ||||||
|  |         gcc-arm-linux-gnueabihf | ||||||
|  |         libc6-dev-armhf-cross | ||||||
|  |     - name: "Checkout" | ||||||
|  |       uses: actions/checkout@v2 | ||||||
|       with: |       with: | ||||||
|         id: linux_armv7 |         submodules: 'recursive' | ||||||
|         cmd: make linux_armv7 |     - name: "Setup Go" | ||||||
|         out: out/linux_armv7/yarr |       uses: actions/setup-go@v2 | ||||||
|  |       with: | ||||||
|  |         go-version: '^1.17' | ||||||
|  |     - name: Cache Go Modules | ||||||
|  |       uses: actions/cache@v4 | ||||||
|  |       with: | ||||||
|  |         path: ~/go/pkg/mod | ||||||
|  |         key: ${{ runner.os }}-armv7-go-${{ hashFiles('**/go.sum') }} | ||||||
|  |         restore-keys: | | ||||||
|  |           ${{ runner.os }}-go-armv7 | ||||||
|  |     - name: "Build" | ||||||
|  |       env: | ||||||
|  |         CC: arm-linux-gnueabihf-gcc | ||||||
|  |         GOARCH: arm | ||||||
|  |         GOARM: 7 | ||||||
|  |       run: make build_linux | ||||||
|  |     - name: Upload | ||||||
|  |       uses: actions/upload-artifact@v4 | ||||||
|  |       with: | ||||||
|  |         name: linux_arm | ||||||
|  |         path: _output/linux/yarr | ||||||
|  |  | ||||||
|  |   build_linux-arm64: | ||||||
|  |     name: Build for Linux ARM64 | ||||||
|  |     runs-on: ubuntu-22.04 | ||||||
|  |     steps: | ||||||
|  |     - name: Install dependencies | ||||||
|  |       run: > | ||||||
|  |         sudo apt-get install -y | ||||||
|  |         gcc-aarch64-linux-gnu | ||||||
|  |         libc6-dev-arm64-cross | ||||||
|  |     - name: "Checkout" | ||||||
|  |       uses: actions/checkout@v2 | ||||||
|  |       with: | ||||||
|  |         submodules: 'recursive' | ||||||
|  |     - name: "Setup Go" | ||||||
|  |       uses: actions/setup-go@v2 | ||||||
|  |       with: | ||||||
|  |         go-version: '^1.17' | ||||||
|  |     - name: Cache Go Modules | ||||||
|  |       uses: actions/cache@v4 | ||||||
|  |       with: | ||||||
|  |         path: ~/go/pkg/mod | ||||||
|  |         key: ${{ runner.os }}-arm64-go-${{ hashFiles('**/go.sum') }} | ||||||
|  |         restore-keys: | | ||||||
|  |           ${{ runner.os }}-go-arm64 | ||||||
|  |     - name: "Build" | ||||||
|  |       env: | ||||||
|  |         CC: aarch64-linux-gnu-gcc | ||||||
|  |         GOARCH: arm64 | ||||||
|  |       run: make build_linux | ||||||
|  |     - name: Upload | ||||||
|  |       uses: actions/upload-artifact@v4 | ||||||
|  |       with: | ||||||
|  |         name: linux_arm64 | ||||||
|  |         path: _output/linux/yarr | ||||||
|  |  | ||||||
|   create_release: |   create_release: | ||||||
|     name: Create Release |     name: Create Release | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     if: ${{ startsWith(github.ref, 'refs/tags/') }} |     if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'test') }} | ||||||
|     needs: [build_macos, build_windows, build_linux] |     needs: [build_macos, build_windows, build_linux, build_linux-arm, build_linux-arm64] | ||||||
|     steps: |     steps: | ||||||
|     - name: Download Artifacts |     - name: Download Artifacts | ||||||
|       uses: actions/download-artifact@v4.1.7 |       uses: actions/download-artifact@v4.1.7 | ||||||
| @@ -128,8 +176,17 @@ jobs: | |||||||
|     - name: Preparation |     - name: Preparation | ||||||
|       run: | |       run: | | ||||||
|         ls -R |         ls -R | ||||||
|  |         chmod u+x macos/Contents/MacOS/yarr | ||||||
|  |         chmod u+x linux/yarr | ||||||
|  |         chmod u+x linux_arm/yarr | ||||||
|  |         chmod u+x linux_arm64/yarr | ||||||
|  |  | ||||||
|  |         mv macos yarr.app && zip -r yarr-${GITHUB_REF_NAME}-macos64.zip yarr.app | ||||||
|  |         ( cd windows        && zip ../yarr-${GITHUB_REF_NAME}-windows64.zip yarr.exe ) | ||||||
|  |         ( cd linux          && zip ../yarr-${GITHUB_REF_NAME}-linux64.zip yarr ) | ||||||
|  |         ( cd linux_arm      && zip ../yarr-${GITHUB_REF_NAME}-linux_arm.zip yarr ) | ||||||
|  |         ( cd linux_arm64    && zip ../yarr-${GITHUB_REF_NAME}-linux_arm64.zip yarr ) | ||||||
|     - name: Upload Release |     - name: Upload Release | ||||||
|       if: false |  | ||||||
|       uses: softprops/action-gh-release@v2 |       uses: softprops/action-gh-release@v2 | ||||||
|       env: |       env: | ||||||
|         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
| @@ -137,4 +194,8 @@ jobs: | |||||||
|           draft: true |           draft: true | ||||||
|           prerelease: true |           prerelease: true | ||||||
|           files: | |           files: | | ||||||
|             *.zip |             yarr-${{ github.ref_name }}-macos64.zip | ||||||
|  |             yarr-${{ github.ref_name }}-windows64.zip | ||||||
|  |             yarr-${{ github.ref_name }}-linux64.zip | ||||||
|  |             yarr-${{ github.ref_name }}-linux_arm.zip | ||||||
|  |             yarr-${{ github.ref_name }}-linux_arm64.zip | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @@ -8,7 +8,7 @@ jobs: | |||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout code |     - name: Checkout code | ||||||
|       uses: actions/checkout@v4 |       uses: actions/checkout@v3 | ||||||
|  |  | ||||||
|     - name: Set up Go |     - name: Set up Go | ||||||
|       uses: actions/setup-go@v4 |       uses: actions/setup-go@v4 | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,4 @@ | |||||||
| /_output | /_output | ||||||
| /out |  | ||||||
| /yarr | /yarr | ||||||
| *.db | *.db | ||||||
| *.db-shm | *.db-shm | ||||||
|   | |||||||
							
								
								
									
										48
									
								
								cmd/generate_versioninfo/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								cmd/generate_versioninfo/main.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | package main | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"flag" | ||||||
|  | 	"io/ioutil" | ||||||
|  | 	"strings" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | var rsrc = `1 VERSIONINFO | ||||||
|  | FILEVERSION     {VERSION_COMMA},0,0 | ||||||
|  | PRODUCTVERSION  {VERSION_COMMA},0,0 | ||||||
|  | BEGIN | ||||||
|  |   BLOCK "StringFileInfo" | ||||||
|  |   BEGIN | ||||||
|  |     BLOCK "080904E4" | ||||||
|  |     BEGIN | ||||||
|  |       VALUE "CompanyName", "Old MacDonald's Farm" | ||||||
|  |       VALUE "FileDescription", "Yet another RSS reader" | ||||||
|  |       VALUE "FileVersion", "{VERSION}" | ||||||
|  |       VALUE "InternalName", "yarr" | ||||||
|  |       VALUE "LegalCopyright", "nkanaev" | ||||||
|  |       VALUE "OriginalFilename", "yarr.exe" | ||||||
|  |       VALUE "ProductName", "yarr" | ||||||
|  |       VALUE "ProductVersion", "{VERSION}" | ||||||
|  |     END | ||||||
|  |   END | ||||||
|  |   BLOCK "VarFileInfo" | ||||||
|  |   BEGIN | ||||||
|  |     VALUE "Translation", 0x809, 1252 | ||||||
|  |   END | ||||||
|  | END | ||||||
|  |  | ||||||
|  | 1 ICON "icon.ico" | ||||||
|  | ` | ||||||
|  |  | ||||||
|  | func main() { | ||||||
|  | 	var version, outfile string | ||||||
|  | 	flag.StringVar(&version, "version", "0.0", "") | ||||||
|  | 	flag.StringVar(&outfile, "outfile", "versioninfo.rc", "") | ||||||
|  | 	flag.Parse() | ||||||
|  |  | ||||||
|  | 	version_comma := strings.ReplaceAll(version, ".", ",") | ||||||
|  |  | ||||||
|  | 	out := strings.ReplaceAll(rsrc, "{VERSION}", version) | ||||||
|  | 	out = strings.ReplaceAll(out, "{VERSION_COMMA}", version_comma) | ||||||
|  |  | ||||||
|  | 	ioutil.WriteFile(outfile, []byte(out), 0644) | ||||||
|  | } | ||||||
							
								
								
									
										99
									
								
								cmd/package_macos/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								cmd/package_macos/main.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,99 @@ | |||||||
|  | package main | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"flag" | ||||||
|  | 	"fmt" | ||||||
|  | 	"io/ioutil" | ||||||
|  | 	"log" | ||||||
|  | 	"os" | ||||||
|  | 	"os/exec" | ||||||
|  | 	"path" | ||||||
|  | 	"strconv" | ||||||
|  | 	"strings" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | var plist = `<?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||||
|  | <plist version="1.0"> | ||||||
|  | <dict> | ||||||
|  | 	<key>CFBundleName</key> | ||||||
|  | 	<string>yarr</string> | ||||||
|  | 	<key>CFBundleDisplayName</key> | ||||||
|  | 	<string>yarr</string> | ||||||
|  | 	<key>CFBundleIdentifier</key> | ||||||
|  | 	<string>nkanaev.yarr</string> | ||||||
|  | 	<key>CFBundleVersion</key> | ||||||
|  | 	<string>VERSION</string> | ||||||
|  | 	<key>CFBundlePackageType</key> | ||||||
|  | 	<string>APPL</string> | ||||||
|  | 	<key>CFBundleExecutable</key> | ||||||
|  | 	<string>yarr</string> | ||||||
|  |  | ||||||
|  | 	<key>CFBundleIconFile</key> | ||||||
|  | 	<string>icon</string> | ||||||
|  | 	<key>LSApplicationCategoryType</key> | ||||||
|  | 	<string>public.app-category.news</string> | ||||||
|  |  | ||||||
|  | 	<key>NSHighResolutionCapable</key> | ||||||
|  | 	<string>True</string> | ||||||
|  |  | ||||||
|  | 	<key>LSMinimumSystemVersion</key> | ||||||
|  | 	<string>10.13</string> | ||||||
|  | 	<key>LSUIElement</key> | ||||||
|  | 	<true/> | ||||||
|  | 	<key>NSHumanReadableCopyright</key> | ||||||
|  | 	<string>Copyright © 2020 nkanaev. All rights reserved.</string> | ||||||
|  | </dict> | ||||||
|  | </plist> | ||||||
|  | ` | ||||||
|  |  | ||||||
|  | func run(cmd ...string) { | ||||||
|  | 	fmt.Println(cmd) | ||||||
|  | 	err := exec.Command(cmd[0], cmd[1:]...).Run() | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal(err) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func main() { | ||||||
|  | 	var version, outdir string | ||||||
|  | 	flag.StringVar(&version, "version", "0.0", "") | ||||||
|  | 	flag.StringVar(&outdir, "outdir", "", "") | ||||||
|  | 	flag.Parse() | ||||||
|  |  | ||||||
|  | 	outfile := "yarr" | ||||||
|  |  | ||||||
|  | 	binDir := path.Join(outdir, "yarr.app", "Contents/MacOS") | ||||||
|  | 	resDir := path.Join(outdir, "yarr.app", "Contents/Resources") | ||||||
|  |  | ||||||
|  | 	plistFile := path.Join(outdir, "yarr.app", "Contents/Info.plist") | ||||||
|  | 	pkginfoFile := path.Join(outdir, "yarr.app", "Contents/PkgInfo") | ||||||
|  |  | ||||||
|  | 	os.MkdirAll(binDir, 0700) | ||||||
|  | 	os.MkdirAll(resDir, 0700) | ||||||
|  |  | ||||||
|  | 	f, _ := ioutil.ReadFile(path.Join(outdir, outfile)) | ||||||
|  | 	ioutil.WriteFile(path.Join(binDir, outfile), f, 0755) | ||||||
|  |  | ||||||
|  | 	ioutil.WriteFile(plistFile, []byte(strings.Replace(plist, "VERSION", version, 1)), 0644) | ||||||
|  | 	ioutil.WriteFile(pkginfoFile, []byte("APPL????"), 0644) | ||||||
|  |  | ||||||
|  | 	iconFile := path.Join(outdir, "icon.png") | ||||||
|  | 	iconsetDir := path.Join(outdir, "icon.iconset") | ||||||
|  | 	os.Mkdir(iconsetDir, 0700) | ||||||
|  |  | ||||||
|  | 	for _, res := range []int{1024, 512, 256, 128, 64, 32, 16} { | ||||||
|  | 		outfile := fmt.Sprintf("icon_%dx%d.png", res, res) | ||||||
|  | 		if res == 1024 || res == 64 { | ||||||
|  | 			outfile = fmt.Sprintf("icon_%dx%d@2x.png", res/2, res/2) | ||||||
|  | 		} | ||||||
|  | 		cmd := []string{ | ||||||
|  | 			"sips", "-s", "format", "png", "--resampleWidth", strconv.Itoa(res), | ||||||
|  | 			iconFile, "--out", path.Join(iconsetDir, outfile), | ||||||
|  | 		} | ||||||
|  | 		run(cmd...) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	icnsFile := path.Join(resDir, "icon.icns") | ||||||
|  | 	run("iconutil", "-c", "icns", iconsetDir, "-o", icnsFile) | ||||||
|  | } | ||||||
							
								
								
									
										32
									
								
								doc/build.md
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								doc/build.md
									
									
									
									
									
								
							| @@ -1,33 +1,21 @@ | |||||||
| ## Compilation | ## Compilation | ||||||
|  |  | ||||||
| Prerequisies: | Install `Go >= 1.17` and `GCC`. Get the source code: | ||||||
|  |  | ||||||
| * Go >= 1.18 |  | ||||||
| * C Compiler (GCC / Clang / ...) |  | ||||||
| * Zig >= 0.14.0 (optional, for cross-compiling CLI versions) |  | ||||||
| * binutils (optional, for building Windows GUI version) |  | ||||||
|  |  | ||||||
| Get the source code: |  | ||||||
|  |  | ||||||
|     git clone https://github.com/nkanaev/yarr.git |     git clone https://github.com/nkanaev/yarr.git | ||||||
|  |  | ||||||
| Compile: | Then run one of the corresponding commands: | ||||||
|  |  | ||||||
|     # create cli for the host OS/architecture |     # create an executable for the host os | ||||||
|     make host               # out/yarr |     make build_macos    # -> _output/macos/yarr.app | ||||||
|  |     make build_linux    # -> _output/linux/yarr | ||||||
|  |     make build_windows  # -> _output/windows/yarr.exe | ||||||
|  |  | ||||||
|     # create GUI, works only in the target OS |     # host-specific cli version (no gui) | ||||||
|     make windows_amd64_gui  # out/windows_amd64_gui/yarr.exe |     make build_default  # -> _output/yarr | ||||||
|     make windows_arm64_gui  # out/windows_arm64_gui/yarr.exe |  | ||||||
|     make darwin_arm64_gui   # out/darwin_arm64_gui/yarr.app |  | ||||||
|     make darwin_amd64_gui   # out/darwin_amd64_gui/yarr.app |  | ||||||
|  |  | ||||||
|     # create cli, cross-compiles within any OS/architecture |     # ... or start a dev server locally | ||||||
|     make linux_amd64 |     make serve          # starts a server at http://localhost:7070 | ||||||
|     make linux_arm64 |  | ||||||
|     make linux_armv7 |  | ||||||
|     make windows_amd64 |  | ||||||
|     make windows_arm64 |  | ||||||
|  |  | ||||||
|     # ... or build a docker image |     # ... or build a docker image | ||||||
|     docker build -t yarr -f etc/dockerfile . |     docker build -t yarr -f etc/dockerfile . | ||||||
|   | |||||||
| @@ -3,12 +3,12 @@ RUN apk add build-base git | |||||||
| WORKDIR /src | WORKDIR /src | ||||||
| COPY . . | COPY . . | ||||||
| RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg \ | RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg \ | ||||||
|   make host |   make build_linux | ||||||
|  |  | ||||||
| FROM alpine:latest | FROM alpine:latest | ||||||
| RUN apk add --no-cache ca-certificates && \ | RUN apk add --no-cache ca-certificates && \ | ||||||
|     update-ca-certificates |     update-ca-certificates | ||||||
| COPY --from=build /src/out/yarr /usr/local/bin/yarr | COPY --from=build /src/_output/linux/yarr /usr/local/bin/yarr | ||||||
| EXPOSE 7070 | EXPOSE 7070 | ||||||
| ENTRYPOINT ["/usr/local/bin/yarr"] | ENTRYPOINT ["/usr/local/bin/yarr"] | ||||||
| CMD ["-addr", "0.0.0.0:7070", "-db", "/data/yarr.db"] | CMD ["-addr", "0.0.0.0:7070", "-db", "/data/yarr.db"] | ||||||
|   | |||||||
| @@ -27,12 +27,18 @@ RUN env \ | |||||||
|         CC=aarch64-linux-gnu-gcc \ |         CC=aarch64-linux-gnu-gcc \ | ||||||
|         CGO_ENABLED=1 \ |         CGO_ENABLED=1 \ | ||||||
|         GOOS=linux GOARCH=arm64 \ |         GOOS=linux GOARCH=arm64 \ | ||||||
|     make host && mv out/yarr /root/out/yarr.arm64 |     go build \ | ||||||
|  |         -tags "sqlite_foreign_keys linux" \ | ||||||
|  |         -ldflags="-s -w" \ | ||||||
|  |         -o /root/out/yarr.arm64 ./cmd/yarr | ||||||
|  |  | ||||||
| RUN env \ | RUN env \ | ||||||
|         CC=arm-linux-gnueabihf-gcc \ |         CC=arm-linux-gnueabihf-gcc \ | ||||||
|         CGO_ENABLED=1 \ |         CGO_ENABLED=1 \ | ||||||
|         GOOS=linux GOARCH=arm GOARM=7 \ |         GOOS=linux GOARCH=arm GOARM=7 \ | ||||||
|     make host && mv out/yarr /root/out/yarr.armv7 |     go build \ | ||||||
|  |         -tags "sqlite_foreign_keys linux" \ | ||||||
|  |         -ldflags="-s -w" \ | ||||||
|  |         -o /root/out/yarr.arm7 ./cmd/yarr | ||||||
|  |  | ||||||
| CMD ["/bin/bash"] | CMD ["/bin/bash"] | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								etc/icon.icns
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								etc/icon.icns
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 54 KiB | 
| @@ -1,62 +0,0 @@ | |||||||
| #/bin/sh |  | ||||||
|  |  | ||||||
| set -e |  | ||||||
|  |  | ||||||
| usage() { |  | ||||||
|   echo "usage: $0 VERSION path/to/icon.icns path/to/binary output/dir" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| if [ $# -eq 0 ]; then |  | ||||||
|     usage |  | ||||||
|     exit |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| VERSION=$1 |  | ||||||
| ICNFILE=$2 |  | ||||||
| BINFILE=$3 |  | ||||||
| OUTPATH=$4 |  | ||||||
|  |  | ||||||
| mkdir -p $OUTPATH/yarr.app/Contents/MacOS |  | ||||||
| mkdir -p $OUTPATH/yarr.app/Contents/Resources |  | ||||||
|  |  | ||||||
| mv $BINFILE $OUTPATH/yarr.app/Contents/MacOS/yarr |  | ||||||
| cp $ICNFILE $OUTPATH/yarr.app/Contents/Resources/icon.icns |  | ||||||
|  |  | ||||||
| chmod u+x  $OUTPATH/yarr.app/Contents/MacOS/yarr |  | ||||||
|  |  | ||||||
| echo -n 'APPL????' >$OUTPATH/yarr.app/Contents/PkgInfo |  | ||||||
| cat <<EOF >$OUTPATH/yarr.app/Contents/Info.plist |  | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |  | ||||||
| <plist version="1.0"> |  | ||||||
| <dict> |  | ||||||
| 	<key>CFBundleName</key> |  | ||||||
| 	<string>yarr</string> |  | ||||||
| 	<key>CFBundleDisplayName</key> |  | ||||||
| 	<string>yarr</string> |  | ||||||
| 	<key>CFBundleIdentifier</key> |  | ||||||
| 	<string>nkanaev.yarr</string> |  | ||||||
| 	<key>CFBundleVersion</key> |  | ||||||
| 	<string>$VERSION</string> |  | ||||||
| 	<key>CFBundlePackageType</key> |  | ||||||
| 	<string>APPL</string> |  | ||||||
| 	<key>CFBundleExecutable</key> |  | ||||||
| 	<string>yarr</string> |  | ||||||
|  |  | ||||||
| 	<key>CFBundleIconFile</key> |  | ||||||
| 	<string>icon</string> |  | ||||||
| 	<key>LSApplicationCategoryType</key> |  | ||||||
| 	<string>public.app-category.news</string> |  | ||||||
|  |  | ||||||
| 	<key>NSHighResolutionCapable</key> |  | ||||||
| 	<string>True</string> |  | ||||||
|  |  | ||||||
| 	<key>LSMinimumSystemVersion</key> |  | ||||||
| 	<string>10.13</string> |  | ||||||
| 	<key>LSUIElement</key> |  | ||||||
| 	<true/> |  | ||||||
| 	<key>NSHumanReadableCopyright</key> |  | ||||||
| 	<string>Copyright © 2020 nkanaev. All rights reserved.</string> |  | ||||||
| </dict> |  | ||||||
| </plist> |  | ||||||
| EOF |  | ||||||
| @@ -1,89 +0,0 @@ | |||||||
| #!/bin/bash |  | ||||||
|  |  | ||||||
| set -e |  | ||||||
|  |  | ||||||
| # Function to display usage information |  | ||||||
| usage() { |  | ||||||
|   echo "Usage: $0 [-version VERSION] [-outfile FILENAME]" |  | ||||||
|   echo "  -version VERSION   Set the version number (default: 0.0)" |  | ||||||
|   echo "  -outfile FILENAME  Set the output file name (default: versioninfo.rc)" |  | ||||||
|   echo "" |  | ||||||
|   echo "This script generates a Windows resource file with version information." |  | ||||||
|   exit 1 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # Default values |  | ||||||
| version="0.0" |  | ||||||
| outfile="versioninfo.rc" |  | ||||||
|  |  | ||||||
| # Check if help is requested |  | ||||||
| if [[ "$1" == "-h" || "$1" == "--help" ]]; then |  | ||||||
|   usage |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| if [ $# -eq 0 ]; then |  | ||||||
|   usage |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| # Parse command-line options |  | ||||||
| while [[ $# -gt 0 ]]; do |  | ||||||
|   case $1 in |  | ||||||
|     -version) |  | ||||||
|       if [[ -z "$2" || "$2" == -* ]]; then |  | ||||||
|         echo "Error: Missing value for -version parameter" |  | ||||||
|         usage |  | ||||||
|       fi |  | ||||||
|       version="$2" |  | ||||||
|       shift 2 |  | ||||||
|       ;; |  | ||||||
|     -outfile) |  | ||||||
|       if [[ -z "$2" || "$2" == -* ]]; then |  | ||||||
|         echo "Error: Missing value for -outfile parameter" |  | ||||||
|         usage |  | ||||||
|       fi |  | ||||||
|       outfile="$2" |  | ||||||
|       shift 2 |  | ||||||
|       ;; |  | ||||||
|     *) |  | ||||||
|       echo "Error: Unknown parameter: $1" |  | ||||||
|       usage |  | ||||||
|       ;; |  | ||||||
|   esac |  | ||||||
| done |  | ||||||
|  |  | ||||||
| # Replace dots with commas for version_comma |  | ||||||
| version_comma="${version//./,}" |  | ||||||
|  |  | ||||||
| # Use a here document for the template with ENDFILE delimiter |  | ||||||
| cat <<ENDFILE > "$outfile" |  | ||||||
| 1 VERSIONINFO |  | ||||||
| FILEVERSION     $version_comma,0,0 |  | ||||||
| PRODUCTVERSION  $version_comma,0,0 |  | ||||||
| BEGIN |  | ||||||
|   BLOCK "StringFileInfo" |  | ||||||
|   BEGIN |  | ||||||
|     BLOCK "080904E4" |  | ||||||
|     BEGIN |  | ||||||
|       VALUE "CompanyName", "Old MacDonald's Farm" |  | ||||||
|       VALUE "FileDescription", "Yet another RSS reader" |  | ||||||
|       VALUE "FileVersion", "$version" |  | ||||||
|       VALUE "InternalName", "yarr" |  | ||||||
|       VALUE "LegalCopyright", "nkanaev" |  | ||||||
|       VALUE "OriginalFilename", "yarr.exe" |  | ||||||
|       VALUE "ProductName", "yarr" |  | ||||||
|       VALUE "ProductVersion", "$version" |  | ||||||
|     END |  | ||||||
|   END |  | ||||||
|   BLOCK "VarFileInfo" |  | ||||||
|   BEGIN |  | ||||||
|     VALUE "Translation", 0x809, 1252 |  | ||||||
|   END |  | ||||||
| END |  | ||||||
|  |  | ||||||
| 1 ICON "icon.ico" |  | ||||||
| ENDFILE |  | ||||||
|  |  | ||||||
| # Set the correct permissions |  | ||||||
| chmod 644 "$outfile" |  | ||||||
|  |  | ||||||
| echo "Generated $outfile with version $version" |  | ||||||
							
								
								
									
										6
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								go.mod
									
									
									
									
									
								
							| @@ -4,8 +4,8 @@ go 1.18 | |||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/mattn/go-sqlite3 v1.14.7 | 	github.com/mattn/go-sqlite3 v1.14.7 | ||||||
| 	golang.org/x/net v0.36.0 | 	golang.org/x/net v0.33.0 | ||||||
| 	golang.org/x/sys v0.30.0 | 	golang.org/x/sys v0.28.0 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| require golang.org/x/text v0.22.0 // indirect | require golang.org/x/text v0.21.0 // indirect | ||||||
|   | |||||||
							
								
								
									
										74
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,8 +1,70 @@ | |||||||
|  | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||||||
| github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= | github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= | ||||||
| github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= | github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= | ||||||
| golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA= | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= | ||||||
| golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I= | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
| golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | ||||||
| golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= | ||||||
| golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= | golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= | ||||||
| golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= | golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= | ||||||
|  | golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= | ||||||
|  | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= | ||||||
|  | golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= | ||||||
|  | golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= | ||||||
|  | golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= | ||||||
|  | golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= | ||||||
|  | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
|  | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||||||
|  | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= | ||||||
|  | golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= | ||||||
|  | golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= | ||||||
|  | golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= | ||||||
|  | golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= | ||||||
|  | golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= | ||||||
|  | golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= | ||||||
|  | golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= | ||||||
|  | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= | ||||||
|  | golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | ||||||
|  | golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | ||||||
|  | golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= | ||||||
|  | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
|  | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||||||
|  | golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||||||
|  | golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= | ||||||
|  | golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||||||
|  | golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= | ||||||
|  | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||||||
|  | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= | ||||||
|  | golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= | ||||||
|  | golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= | ||||||
|  | golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= | ||||||
|  | golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= | ||||||
|  | golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= | ||||||
|  | golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= | ||||||
|  | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||||
|  | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||||||
|  | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= | ||||||
|  | golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= | ||||||
|  | golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= | ||||||
|  | golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= | ||||||
|  | golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= | ||||||
|  | golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= | ||||||
|  | golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= | ||||||
|  | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= | ||||||
|  | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
|  | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||||||
|  | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= | ||||||
|  | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= | ||||||
|  | golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= | ||||||
|  | golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= | ||||||
|  | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
|   | |||||||
							
								
								
									
										93
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										93
									
								
								makefile
									
									
									
									
									
								
							| @@ -4,86 +4,31 @@ GITHASH=$(shell git rev-parse --short=8 HEAD) | |||||||
| GO_TAGS    = sqlite_foreign_keys sqlite_json | GO_TAGS    = sqlite_foreign_keys sqlite_json | ||||||
| GO_LDFLAGS = -s -w -X 'main.Version=$(VERSION)' -X 'main.GitHash=$(GITHASH)' | GO_LDFLAGS = -s -w -X 'main.Version=$(VERSION)' -X 'main.GitHash=$(GITHASH)' | ||||||
|  |  | ||||||
| GO_FLAGS         = -tags "$(GO_TAGS)"     -ldflags="$(GO_LDFLAGS)" | export GOARCH      ?= amd64 | ||||||
| GO_FLAGS_GUI     = -tags "$(GO_TAGS) gui" -ldflags="$(GO_LDFLAGS)" | export CGO_ENABLED  = 1 | ||||||
| GO_FLAGS_GUI_WIN = -tags "$(GO_TAGS) gui" -ldflags="$(GO_LDFLAGS) -H windowsgui" |  | ||||||
|  |  | ||||||
| export CGO_ENABLED=1 | build_default: | ||||||
|  | 	mkdir -p _output | ||||||
|  | 	go build -tags "$(GO_TAGS)" -ldflags="$(GO_LDFLAGS)" -o _output/yarr ./cmd/yarr | ||||||
|  |  | ||||||
| default: test host | build_macos: | ||||||
|  | 	mkdir -p _output/macos | ||||||
|  | 	GOOS=darwin go build -tags "$(GO_TAGS) macos" -ldflags="$(GO_LDFLAGS)" -o _output/macos/yarr ./cmd/yarr | ||||||
|  | 	cp src/platform/icon.png _output/macos/icon.png | ||||||
|  | 	go run ./cmd/package_macos -outdir _output/macos -version "$(VERSION)" | ||||||
|  |  | ||||||
| # platform-specific files | build_linux: | ||||||
|  | 	mkdir -p _output/linux | ||||||
|  | 	GOOS=linux go build -tags "$(GO_TAGS) linux" -ldflags="$(GO_LDFLAGS)" -o _output/linux/yarr ./cmd/yarr | ||||||
|  |  | ||||||
| etc/icon.icns: etc/icon_macos.png | build_windows: | ||||||
| 	mkdir -p etc/icon.iconset | 	mkdir -p _output/windows | ||||||
| 	sips -s format png --resampleWidth 1024 etc/icon_macos.png --out etc/icon.iconset/icon_512x512@2x.png | 	go run ./cmd/generate_versioninfo -version "$(VERSION)" -outfile src/platform/versioninfo.rc | ||||||
| 	sips -s format png --resampleWidth  512 etc/icon_macos.png --out etc/icon.iconset/icon_512x512.png |  | ||||||
| 	sips -s format png --resampleWidth  256 etc/icon_macos.png --out etc/icon.iconset/icon_256x256.png |  | ||||||
| 	sips -s format png --resampleWidth  128 etc/icon_macos.png --out etc/icon.iconset/icon_128x128.png |  | ||||||
| 	sips -s format png --resampleWidth   64 etc/icon_macos.png --out etc/icon.iconset/icon_32x32@2x.png |  | ||||||
| 	sips -s format png --resampleWidth   32 etc/icon_macos.png --out etc/icon.iconset/icon_32x32.png |  | ||||||
| 	sips -s format png --resampleWidth   16 etc/icon_macos.png --out etc/icon.iconset/icon_16x16.png |  | ||||||
| 	iconutil -c icns etc/icon.iconset -o etc/icon.icns |  | ||||||
|  |  | ||||||
| src/platform/versioninfo.rc: |  | ||||||
| 	./etc/windows_versioninfo.sh -version "$(VERSION)" -outfile src/platform/versioninfo.rc |  | ||||||
| 	windres -i src/platform/versioninfo.rc -O coff -o src/platform/versioninfo.syso | 	windres -i src/platform/versioninfo.rc -O coff -o src/platform/versioninfo.syso | ||||||
|  | 	GOOS=windows go build -tags "$(GO_TAGS) windows" -ldflags="$(GO_LDFLAGS) -H windowsgui" -o _output/windows/yarr.exe ./cmd/yarr | ||||||
| # build targets |  | ||||||
|  |  | ||||||
| host: |  | ||||||
| 	go build $(GO_FLAGS) -o out/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| darwin_amd64: |  | ||||||
| 	# cross-compilation not supported: CC="zig cc -target x86_64-macos-none" |  | ||||||
| 	GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| darwin_arm64: |  | ||||||
| 	# cross-compilation not supported: CC="zig cc -target aarch64-macos-none" |  | ||||||
| 	GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| linux_amd64: |  | ||||||
| 	CC="zig cc -target x86_64-linux-musl -O2 -g0" CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOOS=linux GOARCH=amd64 \ |  | ||||||
| 	go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| linux_arm64: |  | ||||||
| 	CC="zig cc -target aarch64-linux-musl -O2 -g0" CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOOS=linux GOARCH=arm64 \ |  | ||||||
| 	go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| linux_armv7: |  | ||||||
| 	CC="zig cc -target arm-linux-musleabihf -O2 -g0" CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOOS=linux GOARCH=arm GOARM=7 \ |  | ||||||
| 	go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| windows_amd64: |  | ||||||
| 	CC="zig cc -target x86_64-windows-gnu" GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| windows_arm64: |  | ||||||
| 	CC="zig cc -target aarch64-windows-gnu" GOOS=windows GOARCH=arm64 go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr |  | ||||||
|  |  | ||||||
| darwin_arm64_gui: etc/icon.icns |  | ||||||
| 	GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS_GUI) -o out/$@/yarr ./cmd/yarr |  | ||||||
| 	./etc/macos_package.sh $(VERSION) etc/icon.icns out/$@/yarr out/$@ |  | ||||||
|  |  | ||||||
| darwin_amd64_gui: etc/icon.icns |  | ||||||
| 	GOOS=darwin GOARCH=amd64 go build $(GO_FLAGS_GUI) -o out/$@/yarr ./cmd/yarr |  | ||||||
| 	./etc/macos_package.sh $(VERSION) etc/icon.icns out/$@/yarr out/$@ |  | ||||||
|  |  | ||||||
| windows_amd64_gui: src/platform/versioninfo.rc |  | ||||||
| 	GOOS=windows GOARCH=amd64 go build $(GO_FLAGS_GUI_WIN) -o out/$@/yarr.exe ./cmd/yarr |  | ||||||
|  |  | ||||||
| windows_arm64_gui: src/platform/versioninfo.rc |  | ||||||
| 	GOOS=windows GOARCH=arm64 go build $(GO_FLAGS_GUI_WIN) -o out/$@/yarr.exe ./cmd/yarr |  | ||||||
|  |  | ||||||
| serve: | serve: | ||||||
| 	go run $(GO_FLAGS) ./cmd/yarr -db local.db | 	go run -tags "$(GO_TAGS)" ./cmd/yarr -db local.db | ||||||
|  |  | ||||||
| test: | test: | ||||||
| 	go test $(GO_FLAGS) ./... | 	go test -tags "$(GO_TAGS)" ./... | ||||||
|  |  | ||||||
| .PHONY: \ |  | ||||||
| 	host \ |  | ||||||
| 	darwin_amd64 darwin_amd64_gui \ |  | ||||||
| 	darwin_arm64 darwin_arm64_gui \ |  | ||||||
| 	windows_amd64 windows_amd64_gui \ |  | ||||||
| 	windows_arm64 windows_arm64_gui \ |  | ||||||
| 	serve test |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build !windows | //go:build !windows | ||||||
|  | // +build !windows | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,3 @@ | |||||||
| //go:build windows |  | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build (darwin || windows) && gui | //go:build macos || windows | ||||||
|  | // +build macos windows | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build !gui | //go:build !windows && !macos | ||||||
|  | // +build !windows,!macos | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build darwin && gui | //go:build macos | ||||||
|  | // +build macos | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build windows && gui | //go:build windows | ||||||
|  | // +build windows | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build linux | //go:build !windows && !darwin | ||||||
|  | // +build !windows,!darwin | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build darwin | //go:build darwin | ||||||
|  | // +build darwin | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| //go:build windows | //go:build windows | ||||||
|  | // +build windows | ||||||
|  |  | ||||||
| package platform | package platform | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								vendor/golang.org/x/sys/windows/dll_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/golang.org/x/sys/windows/dll_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -43,8 +43,8 @@ type DLL struct { | |||||||
| // LoadDLL loads DLL file into memory. | // LoadDLL loads DLL file into memory. | ||||||
| // | // | ||||||
| // Warning: using LoadDLL without an absolute path name is subject to | // Warning: using LoadDLL without an absolute path name is subject to | ||||||
| // DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL], | // DLL preloading attacks. To safely load a system DLL, use LazyDLL | ||||||
| // or use [LoadLibraryEx] directly. | // with System set to true, or use LoadLibraryEx directly. | ||||||
| func LoadDLL(name string) (dll *DLL, err error) { | func LoadDLL(name string) (dll *DLL, err error) { | ||||||
| 	namep, err := UTF16PtrFromString(name) | 	namep, err := UTF16PtrFromString(name) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @@ -271,9 +271,6 @@ func (d *LazyDLL) NewProc(name string) *LazyProc { | |||||||
| } | } | ||||||
|  |  | ||||||
| // NewLazyDLL creates new LazyDLL associated with DLL file. | // NewLazyDLL creates new LazyDLL associated with DLL file. | ||||||
| // |  | ||||||
| // Warning: using NewLazyDLL without an absolute path name is subject to |  | ||||||
| // DLL preloading attacks. To safely load a system DLL, use [NewLazySystemDLL]. |  | ||||||
| func NewLazyDLL(name string) *LazyDLL { | func NewLazyDLL(name string) *LazyDLL { | ||||||
| 	return &LazyDLL{Name: name} | 	return &LazyDLL{Name: name} | ||||||
| } | } | ||||||
| @@ -413,3 +410,7 @@ func loadLibraryEx(name string, system bool) (*DLL, error) { | |||||||
| 	} | 	} | ||||||
| 	return &DLL{Name: name, Handle: h}, nil | 	return &DLL{Name: name, Handle: h}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | type errString string | ||||||
|  |  | ||||||
|  | func (s errString) Error() string { return string(s) } | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -1,15 +1,15 @@ | |||||||
| # github.com/mattn/go-sqlite3 v1.14.7 | # github.com/mattn/go-sqlite3 v1.14.7 | ||||||
| ## explicit; go 1.12 | ## explicit; go 1.12 | ||||||
| github.com/mattn/go-sqlite3 | github.com/mattn/go-sqlite3 | ||||||
| # golang.org/x/net v0.36.0 | # golang.org/x/net v0.33.0 | ||||||
| ## explicit; go 1.23 | ## explicit; go 1.18 | ||||||
| golang.org/x/net/html | golang.org/x/net/html | ||||||
| golang.org/x/net/html/atom | golang.org/x/net/html/atom | ||||||
| golang.org/x/net/html/charset | golang.org/x/net/html/charset | ||||||
| # golang.org/x/sys v0.30.0 | # golang.org/x/sys v0.28.0 | ||||||
| ## explicit; go 1.18 | ## explicit; go 1.18 | ||||||
| golang.org/x/sys/windows | golang.org/x/sys/windows | ||||||
| # golang.org/x/text v0.22.0 | # golang.org/x/text v0.21.0 | ||||||
| ## explicit; go 1.18 | ## explicit; go 1.18 | ||||||
| golang.org/x/text/encoding | golang.org/x/text/encoding | ||||||
| golang.org/x/text/encoding/charmap | golang.org/x/text/encoding/charmap | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user