Files
umbrix/Makefile

125 lines
4.5 KiB
Makefile
Raw Normal View History

2023-09-11 19:40:37 +03:30
include dependencies.properties
2023-08-19 22:27:23 +03:30
BINDIR=./libcore/bin
ANDROID_OUT=./android/app/libs
DESKTOP_OUT=./libcore/bin
GEO_ASSETS_DIR=./assets/core
2023-09-11 19:40:37 +03:30
2023-09-11 20:24:55 +03:30
BRANCH=$(shell git branch --show-current)
VERSION=$(shell git describe --tags --abbrev=0 || echo "unknown version")
2023-09-11 19:40:37 +03:30
CORE_NAME=hiddify-libcore
2023-09-12 10:10:14 +02:00
ifeq ($(BRANCH),RELEASE)
2023-09-11 21:19:55 +03:30
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/v$(core.version)
2023-09-12 10:10:14 +02:00
else
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/draft
2023-09-12 10:04:07 +02:00
endif
2023-09-12 10:10:14 +02:00
2023-09-12 15:22:58 +03:30
ifeq ($(BRANCH),RELEASE)
FLAVOR=prod
else
FLAVOR=dev
endif
TARGET=lib/main_$(FLAVOR).dart
2023-07-06 17:18:41 +03:30
get:
2023-07-18 01:38:39 +03:30
flutter pub get
2023-07-19 15:37:37 +02:00
2023-07-06 17:18:41 +03:30
gen:
dart run build_runner build --delete-conflicting-outputs
2023-07-19 15:37:37 +02:00
2023-07-06 17:18:41 +03:30
translate:
dart run slang
android-release: android-apk-release
2023-09-12 15:22:58 +03:30
2023-08-24 20:17:53 +00:00
android-apk-release:
2023-09-12 15:22:58 +03:30
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi --target $(TARGET)
2023-08-20 12:05:11 +00:00
android-aab-release:
2023-09-12 15:22:58 +03:30
flutter build appbundle --target $(TARGET)
2023-08-20 12:05:11 +00:00
windows-release:
2023-09-12 15:22:58 +03:30
flutter_distributor package --platform windows --targets exe --skip-clean --build-target $(TARGET)
linux-release:
2023-09-12 15:22:58 +03:30
flutter_distributor package --platform linux --targets appimage --skip-clean --build-target $(TARGET)
2023-08-19 22:27:23 +03:30
macos-release:
2023-09-12 15:22:58 +03:30
flutter_distributor package --platform macos --targets dmg --skip-clean --build-target $(TARGET)
2023-08-19 22:27:23 +03:30
ios-release: #not tested
2023-09-12 15:22:58 +03:30
flutter_distributor package --platform ios --targets ipa --build-export-options-plist ios/exportOptions.plist --build-target $(TARGET)
2023-09-15 09:32:29 +02:00
2023-09-11 21:19:55 +03:30
android-libs:
2023-08-19 22:27:23 +03:30
mkdir -p $(ANDROID_OUT)
2023-09-11 21:19:55 +03:30
curl -L $(CORE_URL)/$(CORE_NAME)-android.aar.gz | gunzip > $(ANDROID_OUT)/libcore.aar
2023-07-06 17:18:41 +03:30
2023-09-15 09:32:29 +02:00
android-apk-libs: android-libs
android-aab-libs: android-libs
windows-libs:
2023-08-19 22:27:23 +03:30
mkdir -p $(DESKTOP_OUT)
2023-09-11 21:19:55 +03:30
curl -L $(CORE_URL)/$(CORE_NAME)-windows-amd64.dll.gz | gunzip > $(DESKTOP_OUT)/libcore.dll
2023-07-19 13:12:18 +02:00
linux-libs:
2023-08-19 22:27:23 +03:30
mkdir -p $(DESKTOP_OUT)
2023-09-11 21:19:55 +03:30
curl -L $(CORE_URL)/$(CORE_NAME)-linux-amd64.so.gz | gunzip > $(DESKTOP_OUT)/libcore.so
2023-07-22 00:16:46 +02:00
2023-08-20 10:47:40 +00:00
macos-libs:
2023-07-22 10:45:10 +02:00
mkdir -p $(DESKTOP_OUT)/ &&\
2023-09-11 21:19:55 +03:30
curl -L $(CORE_URL)/$(CORE_NAME)-macos-universal.dylib.gz | gunzip > $(DESKTOP_OUT)/libcore.dylib
2023-07-22 00:16:46 +02:00
ios-libs: #not tested
mkdir -p $(DESKTOP_OUT)/ &&\
2023-09-11 21:19:55 +03:30
curl -L $(CORE_URL)/$(CORE_NAME)-ios-universal.xcframework.gz | gunzip > $(DESKTOP_OUT)/libcore.xcframework
2023-08-19 22:27:23 +03:30
get-geo-assets:
curl -L https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db -o $(GEO_ASSETS_DIR)/geoip.db
2023-08-22 01:01:55 +03:30
curl -L https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db -o $(GEO_ASSETS_DIR)/geosite.db
2023-08-19 22:27:23 +03:30
build-headers:
2023-09-11 21:19:55 +03:30
make -C libcore -f Makefile headers && mv $(BINDIR)/$(CORE_NAME)-headers.h $(BINDIR)/libcore.h
2023-08-19 22:27:23 +03:30
2023-07-21 22:16:43 +03:30
build-android-libs:
2023-09-11 21:19:55 +03:30
make -C libcore -f Makefile android && mv $(BINDIR)/$(CORE_NAME)-android.aar $(ANDROID_OUT)/libcore.aar
2023-07-21 22:16:43 +03:30
build-windows-libs:
2023-09-11 21:19:55 +03:30
make -C libcore -f Makefile windows-amd64 && mv $(BINDIR)/$(CORE_NAME)-windows-amd64.dll $(DESKTOP_OUT)/libcore.dll
2023-07-21 22:16:43 +03:30
2023-07-22 00:16:46 +02:00
build-linux-libs:
2023-09-11 21:19:55 +03:30
make -C libcore -f Makefile linux-amd64 && mv $(BINDIR)/$(CORE_NAME)-linux-amd64.dll $(DESKTOP_OUT)/libcore.so
2023-08-20 09:17:10 +00:00
build-macos-libs:
2023-09-11 21:19:55 +03:30
make -C libcore -f Makefile macos-universal && mv $(BINDIR)/$(CORE_NAME)-macos-universal.dylib $(DESKTOP_OUT)/libcore.dylib
build-ios-libs: #not tested
2023-09-12 10:04:07 +02:00
make -C libcore -f Makefile ios && mv $(BINDIR)/$(CORE_NAME)-ios.xcframework $(DESKTOP_OUT)/libcore.xcframework
2023-09-15 10:44:41 +02:00
release: ## Create a new tag for release.
@echo "previous version was $$(git describe --tags $$(git rev-list --tags --max-count=1))"
@echo "WARNING: This operation will creates version tag and push to github"
@bash -c '\
read -p "Version? (provide the next x.y.z semver) : " TAG && \
echo $$TAG &&\
[[ "$$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } && \
IFS="." read -r -a VERSION_ARRAY <<< "$$TAG" && \
BUILD_NUMBER=$$(( $${VERSION_ARRAY[0]} * 10000 + $${VERSION_ARRAY[1]} * 100 + $${VERSION_ARRAY[2]} )) && \
2023-09-15 11:08:21 +02:00
VERSION_STR="$${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}" && \
echo "version: $${VERSION_STR}+$${BUILD_NUMBER}" && \
sed -i "s/version: .*/version: $${VERSION_STR}+$${BUILD_NUMBER}/g" pubspec.yaml && \
git tag $${TAG} > /dev/null && \
gitchangelog > changelog.md || { git tag -d $${TAG}; echo "Please run pip install git gitchangelog pystache mustache markdown"; exit 2; } && \
git tag -d $${TAG} > /dev/null && \
2023-09-15 10:44:41 +02:00
git add pubspec.yaml changelog.md && \
# ./update_translations.sh && \
# git add assets/translations/* && \
2023-09-15 10:46:01 +02:00
git commit -m "release: version $${TAG} 🚀" && \
2023-09-15 10:44:41 +02:00
echo "creating git tag : $${TAG}" && \
2023-09-15 11:08:21 +02:00
git tag $${TAG} && \
git push -u origin HEAD --tags && \
2023-09-15 10:44:41 +02:00
echo "Github Actions will detect the new tag and release the new version."'