Skip to content

Commit

Permalink
use go build when the target and host platforms match [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellacosse committed Jan 18, 2024
1 parent e14729e commit 066f78c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tun2socks/build.action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

import url from 'url';
import os from 'os';
import {spawnStream} from '../build/spawn_stream.mjs';
import {getBuildParameters} from '../build/get_build_parameters.mjs';

Expand All @@ -22,9 +23,13 @@ import {getBuildParameters} from '../build/get_build_parameters.mjs';
* @param {string[]} parameters
*/
export async function main(...parameters) {
const {platform} = getBuildParameters(parameters);
const {platform: targetPlatform} = getBuildParameters(parameters);

await spawnStream('make', ['ios', 'macos', 'maccatalyst'].includes(platform) ? 'apple' : platform);
if (targetPlatform === os.platform()) {
return spawnStream('go', ['build', '-o', `output/build/${targetPlatformß}/tun2socks`, 'github.com/Jigsaw-Code/outline-go-tun2socks/src/tun2socks/outline']);
}

await spawnStream('make', ['ios', 'macos', 'maccatalyst'].includes(targetPlatform) ? 'apple' : targetPlatform);
}

if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
Expand Down

0 comments on commit 066f78c

Please sign in to comment.