Makefile 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. DIST := dist
  2. IMPORT := code.gitea.io/gitea
  3. export GO111MODULE=off
  4. GO ?= go
  5. SED_INPLACE := sed -i
  6. SHASUM ?= shasum -a 256
  7. export PATH := $($(GO) env GOPATH)/bin:$(PATH)
  8. ifeq ($(OS), Windows_NT)
  9. EXECUTABLE ?= gitea.exe
  10. else
  11. EXECUTABLE ?= gitea
  12. UNAME_S := $(shell uname -s)
  13. ifeq ($(UNAME_S),Darwin)
  14. SED_INPLACE := sed -i ''
  15. endif
  16. endif
  17. BINDATA := modules/{options,public,templates}/bindata.go
  18. GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
  19. GOFMT ?= gofmt -s
  20. GOFLAGS := -i -v
  21. EXTRA_GOFLAGS ?=
  22. MAKE_VERSION := $(shell make -v | head -n 1)
  23. ifneq ($(DRONE_TAG),)
  24. VERSION ?= $(subst v,,$(DRONE_TAG))
  25. GITEA_VERSION ?= $(VERSION)
  26. else
  27. ifneq ($(DRONE_BRANCH),)
  28. VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
  29. else
  30. VERSION ?= master
  31. endif
  32. GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
  33. endif
  34. LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
  35. PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/)))
  36. SOURCES ?= $(shell find . -name "*.go" -type f)
  37. TAGS ?=
  38. TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
  39. SWAGGER_SPEC := templates/swagger/v1_json.tmpl
  40. SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
  41. SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
  42. SWAGGER_NEWLINE_COMMAND := -e '$$a\'
  43. TEST_MYSQL_HOST ?= mysql:3306
  44. TEST_MYSQL_DBNAME ?= testgitea
  45. TEST_MYSQL_USERNAME ?= root
  46. TEST_MYSQL_PASSWORD ?=
  47. TEST_MYSQL8_HOST ?= mysql8:3306
  48. TEST_MYSQL8_DBNAME ?= testgitea
  49. TEST_MYSQL8_USERNAME ?= root
  50. TEST_MYSQL8_PASSWORD ?=
  51. TEST_PGSQL_HOST ?= pgsql:5432
  52. TEST_PGSQL_DBNAME ?= testgitea
  53. TEST_PGSQL_USERNAME ?= postgres
  54. TEST_PGSQL_PASSWORD ?= postgres
  55. TEST_MSSQL_HOST ?= mssql:1433
  56. TEST_MSSQL_DBNAME ?= gitea
  57. TEST_MSSQL_USERNAME ?= sa
  58. TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
  59. # $(call strip-suffix,filename)
  60. strip-suffix = $(firstword $(subst ., ,$(1)))
  61. .PHONY: all
  62. all: build
  63. include docker/Makefile
  64. .PHONY: clean
  65. clean:
  66. $(GO) clean -i ./...
  67. rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \
  68. integrations*.test \
  69. integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-mysql8/ integrations/gitea-integration-sqlite/ \
  70. integrations/gitea-integration-mssql/ integrations/indexers-mysql/ integrations/indexers-mysql8/ integrations/indexers-pgsql integrations/indexers-sqlite \
  71. integrations/indexers-mssql integrations/mysql.ini integrations/mysql8.ini integrations/pgsql.ini integrations/mssql.ini
  72. .PHONY: fmt
  73. fmt:
  74. $(GOFMT) -w $(GOFILES)
  75. .PHONY: vet
  76. vet:
  77. $(GO) vet $(PACKAGES)
  78. .PHONY: generate
  79. generate:
  80. GO111MODULE=on $(GO) generate $(PACKAGES)
  81. .PHONY: generate-swagger
  82. generate-swagger:
  83. @hash swagger > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  84. $(GO) get -u github.com/go-swagger/go-swagger/cmd/swagger; \
  85. fi
  86. swagger generate spec -o './$(SWAGGER_SPEC)'
  87. $(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
  88. $(SED_INPLACE) $(SWAGGER_NEWLINE_COMMAND) './$(SWAGGER_SPEC)'
  89. .PHONY: swagger-check
  90. swagger-check: generate-swagger
  91. @diff=$$(git diff '$(SWAGGER_SPEC)'); \
  92. if [ -n "$$diff" ]; then \
  93. echo "Please run 'make generate-swagger' and commit the result:"; \
  94. echo "$${diff}"; \
  95. exit 1; \
  96. fi;
  97. .PHONY: swagger-validate
  98. swagger-validate:
  99. @hash swagger > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  100. $(GO) get -u github.com/go-swagger/go-swagger/cmd/swagger; \
  101. fi
  102. $(SED_INPLACE) '$(SWAGGER_SPEC_S_JSON)' './$(SWAGGER_SPEC)'
  103. swagger validate './$(SWAGGER_SPEC)'
  104. $(SED_INPLACE) '$(SWAGGER_SPEC_S_TMPL)' './$(SWAGGER_SPEC)'
  105. .PHONY: errcheck
  106. errcheck:
  107. @hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  108. $(GO) get -u github.com/kisielk/errcheck; \
  109. fi
  110. errcheck $(PACKAGES)
  111. .PHONY: lint
  112. lint:
  113. @echo 'make lint is depricated. Use "make revive" if you want to use the old lint tool, or "make golangci-lint" to run a complete code check.'
  114. .PHONY: revive
  115. revive:
  116. @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  117. $(GO) get -u github.com/mgechev/revive; \
  118. fi
  119. revive -config .revive.toml -exclude=./vendor/... ./... || exit 1
  120. .PHONY: misspell-check
  121. misspell-check:
  122. @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  123. $(GO) get -u github.com/client9/misspell/cmd/misspell; \
  124. fi
  125. misspell -error -i unknwon,destory $(GOFILES)
  126. .PHONY: misspell
  127. misspell:
  128. @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  129. $(GO) get -u github.com/client9/misspell/cmd/misspell; \
  130. fi
  131. misspell -w -i unknwon $(GOFILES)
  132. .PHONY: fmt-check
  133. fmt-check:
  134. # get all go files and run go fmt on them
  135. @diff=$$($(GOFMT) -d $(GOFILES)); \
  136. if [ -n "$$diff" ]; then \
  137. echo "Please run 'make fmt' and commit the result:"; \
  138. echo "$${diff}"; \
  139. exit 1; \
  140. fi;
  141. .PHONY: test
  142. test:
  143. GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
  144. .PHONY: coverage
  145. coverage:
  146. @hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  147. $(GO) get -u github.com/wadey/gocovmerge; \
  148. fi
  149. gocovmerge integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all;\
  150. .PHONY: unit-test-coverage
  151. unit-test-coverage:
  152. $(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
  153. .PHONY: vendor
  154. vendor:
  155. GO111MODULE=on $(GO) mod tidy && GO111MODULE=on $(GO) mod vendor
  156. .PHONY: test-vendor
  157. test-vendor: vendor
  158. @diff=$$(git diff vendor/); \
  159. if [ -n "$$diff" ]; then \
  160. echo "Please run 'make vendor' and commit the result:"; \
  161. echo "$${diff}"; \
  162. exit 1; \
  163. fi;
  164. .PHONY: test-sqlite
  165. test-sqlite: integrations.sqlite.test
  166. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
  167. .PHONY: test-sqlite\#%
  168. test-sqlite\#%: integrations.sqlite.test
  169. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $*
  170. .PHONY: test-sqlite-migration
  171. test-sqlite-migration: migrations.sqlite.test
  172. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
  173. generate-ini:
  174. sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
  175. -e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
  176. -e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
  177. -e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
  178. integrations/mysql.ini.tmpl > integrations/mysql.ini
  179. sed -e 's|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \
  180. -e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
  181. -e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
  182. -e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
  183. integrations/mysql8.ini.tmpl > integrations/mysql8.ini
  184. sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
  185. -e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
  186. -e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
  187. -e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
  188. integrations/pgsql.ini.tmpl > integrations/pgsql.ini
  189. sed -e 's|{{TEST_MSSQL_HOST}}|${TEST_MSSQL_HOST}|g' \
  190. -e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
  191. -e 's|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \
  192. -e 's|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \
  193. integrations/mssql.ini.tmpl > integrations/mssql.ini
  194. .PHONY: test-mysql
  195. test-mysql: integrations.test generate-ini
  196. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test
  197. .PHONY: test-mysql-migration
  198. test-mysql-migration: migrations.test generate-ini
  199. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test
  200. .PHONY: test-mysql8
  201. test-mysql8: integrations.test generate-ini
  202. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test
  203. .PHONY: test-mysql8-migration
  204. test-mysql8-migration: migrations.test generate-ini
  205. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.test
  206. .PHONY: test-pgsql
  207. test-pgsql: integrations.test generate-ini
  208. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
  209. .PHONY: test-pgsql-migration
  210. test-pgsql-migration: migrations.test generate-ini
  211. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test
  212. .PHONY: test-mssql
  213. test-mssql: integrations.test generate-ini
  214. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test
  215. .PHONY: test-mssql-migration
  216. test-mssql-migration: migrations.test generate-ini
  217. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./migrations.test
  218. .PHONY: bench-sqlite
  219. bench-sqlite: integrations.sqlite.test
  220. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  221. .PHONY: bench-mysql
  222. bench-mysql: integrations.test generate-ini
  223. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  224. .PHONY: bench-mssql
  225. bench-mssql: integrations.test generate-ini
  226. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  227. .PHONY: bench-pgsql
  228. bench-pgsql: integrations.test generate-ini
  229. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
  230. .PHONY: integration-test-coverage
  231. integration-test-coverage: integrations.cover.test generate-ini
  232. GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
  233. integrations.test: $(SOURCES)
  234. GO111MODULE=on $(GO) test -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.test
  235. integrations.sqlite.test: $(SOURCES)
  236. GO111MODULE=on $(GO) test -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
  237. integrations.cover.test: $(SOURCES)
  238. GO111MODULE=on $(GO) test -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test
  239. .PHONY: migrations.test
  240. migrations.test: $(SOURCES)
  241. $(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.test
  242. .PHONY: migrations.sqlite.test
  243. migrations.sqlite.test: $(SOURCES)
  244. $(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
  245. .PHONY: check
  246. check: test
  247. .PHONY: install
  248. install: $(wildcard *.go)
  249. $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
  250. .PHONY: build
  251. build: $(EXECUTABLE)
  252. $(EXECUTABLE): $(SOURCES)
  253. GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
  254. .PHONY: release
  255. release: release-dirs release-windows release-linux release-darwin release-copy release-compress release-check
  256. .PHONY: release-dirs
  257. release-dirs:
  258. mkdir -p $(DIST)/binaries $(DIST)/release
  259. .PHONY: release-windows
  260. release-windows:
  261. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  262. $(GO) get -u src.techknowlogick.com/xgo; \
  263. fi
  264. xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
  265. ifeq ($(CI),drone)
  266. cp /build/* $(DIST)/binaries
  267. endif
  268. .PHONY: release-linux
  269. release-linux:
  270. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  271. $(GO) get -u src.techknowlogick.com/xgo; \
  272. fi
  273. xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION) .
  274. ifeq ($(CI),drone)
  275. cp /build/* $(DIST)/binaries
  276. endif
  277. .PHONY: release-darwin
  278. release-darwin:
  279. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  280. $(GO) get -u src.techknowlogick.com/xgo; \
  281. fi
  282. xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
  283. ifeq ($(CI),drone)
  284. cp /build/* $(DIST)/binaries
  285. endif
  286. .PHONY: release-copy
  287. release-copy:
  288. cd $(DIST); for file in `find /build -type f -name "*"`; do cp $${file} ./release/; done;
  289. .PHONY: release-check
  290. release-check:
  291. cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
  292. .PHONY: release-compress
  293. release-compress:
  294. @hash gxz > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  295. $(GO) get -u github.com/ulikunitz/xz/cmd/gxz; \
  296. fi
  297. cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
  298. npm-check:
  299. @hash npm > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  300. echo "Please install Node.js 8.x or greater with npm"; \
  301. exit 1; \
  302. fi;
  303. @hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  304. echo "Please install Node.js 8.x or greater with npm"; \
  305. exit 1; \
  306. fi;
  307. .PHONY: npm
  308. npm: npm-check
  309. npm install --no-save
  310. .PHONY: npm-update
  311. npm-update: npm-check
  312. npx updates -cu
  313. rm -rf node_modules package-lock.json
  314. npm install --package-lock
  315. .PHONY: js
  316. js: npm
  317. npx eslint public/js
  318. .PHONY: css
  319. css: npm
  320. npx lesshint public/less/
  321. npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css
  322. $(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
  323. npx postcss --use autoprefixer --no-map --replace public/css/*
  324. @diff=$$(git diff public/css/*); \
  325. if ([ -n "$$CI" ] && [ -n "$$diff" ]); then \
  326. echo "Generated files in public/css have changed, please commit the result:"; \
  327. echo "$${diff}"; \
  328. exit 1; \
  329. fi;
  330. .PHONY: javascripts
  331. javascripts:
  332. echo "'make javascripts' is deprecated, please use 'make js'"
  333. $(MAKE) js
  334. .PHONY: stylesheets-check
  335. stylesheets-check:
  336. echo "'make stylesheets-check' is deprecated, please use 'make css'"
  337. $(MAKE) css
  338. .PHONY: generate-stylesheets
  339. generate-stylesheets:
  340. echo "'make generate-stylesheets' is deprecated, please use 'make css'"
  341. $(MAKE) css
  342. .PHONY: swagger-ui
  343. swagger-ui:
  344. rm -Rf public/vendor/assets/swagger-ui
  345. git clone --depth=10 -b v3.13.4 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui
  346. mv $(TMPDIR)/swagger-ui/dist public/vendor/assets/swagger-ui
  347. rm -Rf $(TMPDIR)/swagger-ui
  348. $(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../../swagger.v1.json;g" public/vendor/assets/swagger-ui/index.html
  349. .PHONY: update-translations
  350. update-translations:
  351. mkdir -p ./translations
  352. cd ./translations && curl -L https://crowdin.com/download/project/gitea.zip > gitea.zip && unzip gitea.zip
  353. rm ./translations/gitea.zip
  354. $(SED_INPLACE) -e 's/="/=/g' -e 's/"$$//g' ./translations/*.ini
  355. $(SED_INPLACE) -e 's/\\"/"/g' ./translations/*.ini
  356. mv ./translations/*.ini ./options/locale/
  357. rmdir ./translations
  358. .PHONY: generate-images
  359. generate-images:
  360. mkdir -p $(TMPDIR)/images
  361. inkscape -f $(PWD)/assets/logo.svg -w 880 -h 880 -e $(PWD)/public/img/gitea-lg.png
  362. inkscape -f $(PWD)/assets/logo.svg -w 512 -h 512 -e $(PWD)/public/img/gitea-512.png
  363. inkscape -f $(PWD)/assets/logo.svg -w 192 -h 192 -e $(PWD)/public/img/gitea-192.png
  364. inkscape -f $(PWD)/assets/logo.svg -w 120 -h 120 -jC -i layer1 -e $(TMPDIR)/images/sm-1.png
  365. inkscape -f $(PWD)/assets/logo.svg -w 120 -h 120 -jC -i layer2 -e $(TMPDIR)/images/sm-2.png
  366. composite -compose atop $(TMPDIR)/images/sm-2.png $(TMPDIR)/images/sm-1.png $(PWD)/public/img/gitea-sm.png
  367. inkscape -f $(PWD)/assets/logo.svg -w 200 -h 200 -e $(PWD)/public/img/avatar_default.png
  368. inkscape -f $(PWD)/assets/logo.svg -w 180 -h 180 -e $(PWD)/public/img/favicon.png
  369. inkscape -f $(PWD)/assets/logo.svg -w 128 -h 128 -e $(TMPDIR)/images/128-raw.png
  370. inkscape -f $(PWD)/assets/logo.svg -w 64 -h 64 -e $(TMPDIR)/images/64-raw.png
  371. inkscape -f $(PWD)/assets/logo.svg -w 32 -h 32 -jC -i layer1 -e $(TMPDIR)/images/32-1.png
  372. inkscape -f $(PWD)/assets/logo.svg -w 32 -h 32 -jC -i layer2 -e $(TMPDIR)/images/32-2.png
  373. composite -compose atop $(TMPDIR)/images/32-2.png $(TMPDIR)/images/32-1.png $(TMPDIR)/images/32-raw.png
  374. inkscape -f $(PWD)/assets/logo.svg -w 16 -h 16 -jC -i layer1 -e $(TMPDIR)/images/16-raw.png
  375. zopflipng -m -y $(TMPDIR)/images/128-raw.png $(TMPDIR)/images/128.png
  376. zopflipng -m -y $(TMPDIR)/images/64-raw.png $(TMPDIR)/images/64.png
  377. zopflipng -m -y $(TMPDIR)/images/32-raw.png $(TMPDIR)/images/32.png
  378. zopflipng -m -y $(TMPDIR)/images/16-raw.png $(TMPDIR)/images/16.png
  379. rm -f $(TMPDIR)/images/*-*.png
  380. convert $(TMPDIR)/images/16.png $(TMPDIR)/images/32.png \
  381. $(TMPDIR)/images/64.png $(TMPDIR)/images/128.png \
  382. $(PWD)/public/img/favicon.ico
  383. rm -rf $(TMPDIR)/images
  384. $(foreach file, $(shell find public/img -type f -name '*.png'),zopflipng -m -y $(file) $(file);)
  385. .PHONY: pr
  386. pr:
  387. $(GO) run contrib/pr/checkout.go $(PR)
  388. .PHONY: golangci-lint
  389. golangci-lint:
  390. @hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  391. export BINARY="golangci-lint"; \
  392. curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.16.0; \
  393. fi
  394. golangci-lint run