sspt-autogen 13 KB
Newer Older
PoroCYon's avatar
PoroCYon committed
1
2
3
4
#!/usr/bin/env bash

print_help() {
    (>&2 cat <<EOF
PoroCYon's avatar
PoroCYon committed
5
Autogenerate an .sspt file for a package.
PoroCYon's avatar
PoroCYon committed
6
Usage: sspt autogen [-h|-?|--help]
PoroCYon's avatar
PoroCYon committed
7
           Print this help text and exit.
PoroCYon's avatar
PoroCYon committed
8
9
10
     - sspt autogen {-e|--edit} <package-name>
           Generate the .sspt file for this package and optionally edit
           it afterwards.
PoroCYon's avatar
PoroCYon committed
11
12
13
14
Supported VCSes: git, hg, svn, cvs, bzr, mtn, darcs
Supported build systems: npm, cargo, setuptools, idris, xbuild, stack,
    cabal, scons, gradle, sbt, bazel, meson, ninja, ant, mvn, cmake,
    qmake, autoconf, makefile
PoroCYon's avatar
PoroCYon committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
EOF
)
}

autogen_git() {
    cat >> ".sspt" <<EOF
sspt_pull() {
    git pull
}
sspt_version() {
    git rev-parse HEAD
}
sspt_prettyver() {
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
EOF
}
autogen_hg() {
    cat >> ".sspt" <<EOF
sspt_pull() {
    hg pull
}
sspt_version() {
    hg identify -i
}
sspt_prettyver() {
    printf "r%s.%s" "\$(hg identify -n)" "\$(hg identify -i)"
}
EOF
}
autogen_svn() {
    cat >> ".sspt" <<EOF
sspt_pull() {
    svn up
}
sspt_version() {
    svnversion
}
sspt_prettyver() {
    local ver="\$(svnversion)"
    printf "r%s" "\${ver//[[:alpha:]]}"
}
EOF
}
autogen_cvs() {
    # CVS doesn't have 'global' commits...
    cat >> ".sspt" <<EOF
sspt_pull() {
    cvs update
}
sspt_version() {
    date +%Y%m%d
}
sspt_prettyver() {
    date +%Y%m%d
}
EOF
}
autogen_bzr() {
    cat >> ".sspt" <<EOF
sspt_pull() {
    bzr update
}
sspt_version() {
    bzr revno
}
sspt_prettyver() {
    printf "r%s" "\$(bzr revno)"
}
EOF
}
autogen_mtn() {
    cat >> ".sspt" <<EOF
sspt_pull() {
    mtn pull
PoroCYon's avatar
PoroCYon committed
90
    mtn update
PoroCYon's avatar
PoroCYon committed
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
}
sspt_version() {
    mtn log --last=1 --no-graph | grep "Revision" | egrep -o "[A-Za-z0-9]$"
}
sspt_prettyver() {
    mtn log --last=1 --no-graph | grep "Revision" | egrep -o "[A-Za-z0-9]$"
}
EOF
}
autogen_darcs() {
    cat >> ".sspt" <<EOF
sspt_pull() {
    darcs pull
}
sspt_version() {
    darcs log -n 1 | head -1 | egrep -o "[A-Za-z0-9]$"
}
sspt_prettyver() {
    darcs log -n 1 | head -1 | egrep -o "[A-Za-z0-9]$"
}
EOF
}
autogen_vcs() {
    if [ -d ".git/" ]; then
        autogen_git
    elif [ -d ".hg/" ]; then
        autogen_hg
    elif [ -d ".svn/" ]; then
        autogen_svn
    elif [ -d "CVSROOT/" ]; then
        autogen_cvs
    elif [ -d ".bzr/" ]; then
        autogen_bzr
    elif [ -d "_MTN/" ]; then
        autogen_mtn
    elif [ -d "_darcs/" ]; then
        autogen_darcs
    else
PoroCYon's avatar
PoroCYon committed
129
130
        (>&2 echo "NOTE: could not detect repository type of package" \
            "'$1', add the .sspt file to make updating this pacakge possible.")
PoroCYon's avatar
PoroCYon committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
        # no upstream?
        cat >> ".sspt" <<EOF
sspt_pull() {
    true
}
sspt_version() {
    date +%Y%m%d
}
sspt_prettyver() {
    date +%Y%m%d
}
EOF
    fi
}
autogen_buildsys() {
    local REL_DIR="."
    local RELI_DIR="."
    local SSPT_FILE=".sspt"
    local CHANGED_DIR=""
    if [ -z "$DONT_LOOK_INTO_BUILD" ] && [ -d "build" ]; then
        pushd "build" >/dev/null
        CHANGED_DIR=1
        SSPT_FILE="../$SSPT_FILE"
        REL_DIR="./build"
        RELI_DIR="../"
    fi

PoroCYon's avatar
PoroCYon committed
158
159
    if [ -f "PKGBUILD" ]; then
        cat >> "$SSPT_FILE" <<EOF
160
export SSPT_TRACK_FILES="no"
PoroCYon's avatar
PoroCYon committed
161
162
163
164
165
166
167
sspt_config() {
    makepkg -o
}
sspt_build() {
    makepkg -e
}
sspt_install() {
pcy's avatar
fixes    
pcy committed
168
    makepkg -i --noconfirm && rm *.pkg.tar.xz
PoroCYon's avatar
PoroCYon committed
169
170
171
172
173
174
175
176
177
178
}
sspt_clean() {
    makepkg -c -e -o
}
sspt_clean_config() {
    true
}
EOF
    elif [ -f "APKBUILD" ]; then
        cat >> "$SSPT_FILE" <<EOF
179
export SSPT_TRACK_FILES="no"
PoroCYon's avatar
PoroCYon committed
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
sspt_config() {
    abuild prepare
}
sspt_build() {
    abuild build
}
sspt_install() {
    abuild package -i
}
sspt_clean() {
    abuild clean
}
sspt_clean_config() {
    abuild clean
    abuild cleancache
}
PoroCYon's avatar
PoroCYon committed
196
197
198
199
200
201
202
203
204
205
EOF
    elif [ -f "CMakeLists.txt" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    mkdir -p "$REL_DIR/cmake-build"
    pushd "$REL_DIR/cmake-build" >/dev/null
    cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=\$SSPT_DEST_DIR"
    popd >/dev/null
}
sspt_build() {
PoroCYon's avatar
PoroCYon committed
206
    make -C "$REL_DIR/cmake-build" -j$(nproc)
PoroCYon's avatar
PoroCYon committed
207
208
}
sspt_install() {
PoroCYon's avatar
PoroCYon committed
209
    make -C "$REL_DIR/cmake-build" install
PoroCYon's avatar
PoroCYon committed
210
211
}
sspt_clean() {
PoroCYon's avatar
PoroCYon committed
212
    make -C "$REL_DIR/cmake-build" clean
PoroCYon's avatar
PoroCYon committed
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
}
sspt_clean_config() {
    rm -rf "$REL_DIR/cmake-build"
}
EOF
    elif [ -f "./configure.ac" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    autoreconf -i
    "$REL_DIR/configure" "--prefix=\$SSPT_DEST_DIR"
}
sspt_build() {
    make -j$(nproc)
}
sspt_install() {
    make install "PREFIX=\$SSPT_DEST_DIR" "prefix=\$SSPT_DEST_DIR" "DESTDIR=\$SSPT_DEST_DIR"
}
sspt_clean() {
    make clean
}
sspt_clean_config() {
    rm -rf "$REL_DIR/configure" "$REL_DIR/"*akefile "$REL_DIR/"config.*
}
EOF
    elif [ -f "./configure" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    "$REL_DIR/configure" "--prefix=\$SSPT_DEST_DIR"
}
sspt_build() {
    make -j$(nproc)
}
sspt_install() {
    make install "PREFIX=\$SSPT_DEST_DIR" "prefix=\$SSPT_DEST_DIR" "DESTDIR=\$SSPT_DEST_DIR"
}
sspt_clean() {
    make clean
}
sspt_clean_config() {
    rm -rf "$REL_DIR/"*akefile "$REL_DIR/"config.*
}
EOF
    elif file_exists_glob ./*.pro; then
        local PRO_FILE="$(find ./*.pro -maxdepth 1 -type f | head -1)"

        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    qmake -makefile "$REL_DIR/$PRO_FILE"
}
sspt_build() {
    make -j$(nproc)
}
sspt_install() {
    make install "PREFIX=\$SSPT_DEST_DIR" "prefix=\$SSPT_DEST_DIR" "DESTDIR=\$SSPT_DEST_DIR"
}
sspt_clean() {
    make clean
}
sspt_clean_config() {
    rm "$REL_DIR/*akefile"
}
EOF
    elif file_exists_glob ./*akefile; then # support GNUmakefile etc.
        local MAKEFILE=$(find ./*akefile -maxdepth 1 -type f | head -1)
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    true
}
sspt_build() {
    make -f "$MAKEFILE" -j$(nproc)
}
sspt_install() {
    make -f "$MAKEFILE" install "PREFIX=\$SSPT_DEST_DIR" "prefix=\$SSPT_DEST_DIR" "DESTDIR=\$SSPT_DEST_DIR"
}
sspt_clean() {
    make -f "$MAKEFILE" clean
}
sspt_clean_config() {
    true
}
PoroCYon's avatar
PoroCYon committed
293
294
EOF
    elif [ -f "package.json" ]; then
PoroCYon's avatar
PoroCYon committed
295
        cat >> "$SSPT_FILE" <<EOF
pcy's avatar
pcy committed
296
export SSPT_TRACK_FILES="no"
PoroCYon's avatar
PoroCYon committed
297
sspt_config() {
PoroCYon's avatar
PoroCYon committed
298
    >&2 echo "NOTE: npm doesn't honor \$SSPT_DEST_DIR"
PoroCYon's avatar
PoroCYon committed
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
}
sspt_build() {
    true
}
sspt_install() {
    npm install
}
sspt_clean() {
    true
}
sspt_clean_config() {
    rm -rf "$REL_DIR/node_packages"
}
EOF
    elif [ -f "Cargo.toml" ]; then
        cat >> "$SSPT_FILE" <<EOF
pcy's avatar
pcy committed
315
export SSPT_TRACK_FILES="no"
PoroCYon's avatar
PoroCYon committed
316
sspt_config() {
PoroCYon's avatar
PoroCYon committed
317
    >&2 echo "You may want to edit the .sspt file to enable or disable some features."
PoroCYon's avatar
PoroCYon committed
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
}
sspt_build() {
    cargo build --release
}
sspt_install() {
    cargo install --root \$SSPT_DEST_DIR
}
sspt_clean() {
    cargo clean --release
}
sspt_clean_config() {
    true
}
EOF
    elif [ -f "setup.py" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
PoroCYon's avatar
PoroCYon committed
335
    >&2 echo "NOTE: sspt assumes that the setup.py script will be executed by the correct python binary."
PoroCYon's avatar
PoroCYon committed
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
    # ensure it is executable
    chmod +x $REL_DIR/setup.py
}
sspt_build() {
    "$REL_DIR/setup.py" build
}
sspt_install() {
    "$REL_DIR/setup.py" install -O2 --prefix \$SSPT_DEST_DIR
}
sspt_clean() {
    "$REL_DIR/setup.py" clean
}
sspt_clean_config() {
    "$REL_DIR/setup.py" clean -a
}
EOF
    elif [ -f "stack.yaml" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    stack build --only-configure
    (>&2 echo "NOTE: stack doesn't honor \$SSPT_DEST_DIR, but installs" \
        "everything to \$XDG_CONFIG_HOME , which is also the default value" \
        "of \$SSPT_DEST_DIR .")
}
sspt_build() {
    stack build --ghc-options -j$(nproc)
}
sspt_install() {
    stack install
}
sspt_clean() {
    stack clean
}
sspt_clean_config() {
    stack clean --full
}
EOF
373
    elif file_exists_glob ./*.cabal; then
PoroCYon's avatar
PoroCYon committed
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    cabal configure -O2 --user --prefix=\$SSPT_DEST_DIR --ghc-option=-j$(nproc)
}
sspt_build() {
    cabal build --ghc-option=-j$(nproc)
}
sspt_install() {
    cabal install --prefix=\$SSPT_DEST_DIR
}
sspt_clean() {
    cabal clean -s
}
sspt_clean_config() {
    rm -rf "$REL_DIR/dist"
}
EOF
    elif [ -f "SConstruct" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    (>&2 echo "NOTE: SCons cannot install packages.")
}
sspt_build() {
    scons
}
sspt_install() {
    (>&2 echo "NOTE: SCons cannot install packages.")
}
sspt_clean() {
    scons -c
}
sspt_clean_config() {
    true
}
EOF
    elif [ -f "build.gradle" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    (>&2 echo "NOTE: Gradle cannot install packages.")
}
sspt_build() {
    grdle -a
}
sspt_install() {
    (>&2 echo "NOTE: Gradle cannot install packages.")
}
sspt_clean() {
    (>&2 echo "NOTE: Gradle cannot clean packages.")
}
sspt_clean_config() {
    true
}
EOF
427
    elif file_exists_glob ./*.sbt; then
PoroCYon's avatar
PoroCYon committed
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    (>&2 echo "NOTE: sbt cannot install packages.")
}
sspt_build() {
    sbt
}
sspt_install() {
    (>&2 echo "NOTE: sbt cannot install packages.")
}
sspt_clean() {
    (>&2 echo "NOTE: sbt cannot clean packages.")
}
sspt_clean_config() {
    true
}
EOF
    elif [ -f "BUILD" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    (>&2 echo "NOTE: Bazel cannot install packages.")
}
sspt_build() {
    bazel build
}
sspt_install() {
    (>&2 echo "NOTE: Bazel cannot install packages.")
}
sspt_clean() {
    bazel clean
}
sspt_clean_config() {
    true
}
EOF
        (>&2 echo "NOTE: sspt cannot figure out which target to use. Please edit the .sstp file manually.")
        return 1
    elif [ -f "meson.build" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
pcy's avatar
pcy committed
468
    meson --backend ninja --buildtype release --strip --prefix \$SSPT_DEST_DIR "$REL_DIR/build"
PoroCYon's avatar
PoroCYon committed
469
470
}
sspt_build() {
pcy's avatar
pcy committed
471
    ninja -C "$REL_DIR/build"
PoroCYon's avatar
PoroCYon committed
472
473
}
sspt_install() {
pcy's avatar
pcy committed
474
    ninja -C "$REL_BUILD/build" install
PoroCYon's avatar
PoroCYon committed
475
476
}
sspt_clean() {
pcy's avatar
pcy committed
477
    ninja -C "$REL_DIR/build" clean
PoroCYon's avatar
PoroCYon committed
478
479
}
sspt_clean_config() {
pcy's avatar
pcy committed
480
    rm -rf "$REL_DIR/build"
PoroCYon's avatar
PoroCYon committed
481
482
483
484
485
}
EOF
    elif [ -f "build.ninja" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
pcy's avatar
pcy committed
486
    true
PoroCYon's avatar
PoroCYon committed
487
488
489
490
491
}
sspt_build() {
    ninja
}
sspt_install() {
pcy's avatar
pcy committed
492
    ninja install
PoroCYon's avatar
PoroCYon committed
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
}
sspt_clean() {
    ninja clean
}
sspt_clean_config() {
    true
}
EOF
    elif [ -f "build.xml" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    (>&2 echo "NOTE: ant cannot install packages.")
}
sspt_build() {
    ant
}
sspt_install() {
    (>&2 echo "NOTE: ant cannot install packages.")
}
sspt_clean() {
    ant clean
}
sspt_clean_config() {
    true
}
EOF
    elif [ -f "pom.xml" ]; then
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    true
}
sspt_build() {
    mvn -B package
}
sspt_install() {
    mvn -B install
}
sspt_clean() {
    mvn -B clean
}
sspt_clean_config() {
    true
}
EOF
PoroCYon's avatar
PoroCYon committed
537
538
    elif file_exists_glob ./*.ipkg; then
        local IPKG_FILE=$(find ./*.ipkg -maxdepth 1 -type f | head -1) # ensure it's only 1 file
PoroCYon's avatar
PoroCYon committed
539
540
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
PoroCYon's avatar
PoroCYon committed
541
    (>&2 echo "NOTE: idris doesn't honor \$SSPT_DEST_DIR")
PoroCYon's avatar
PoroCYon committed
542
543
}
sspt_build() {
PoroCYon's avatar
PoroCYon committed
544
    idris --build "$REL_DIR/$IPKG_FILE"
PoroCYon's avatar
PoroCYon committed
545
546
}
sspt_install() {
PoroCYon's avatar
PoroCYon committed
547
    idris --install "$REL_DIR/$IPKG_FILE" && idris --installdoc "$REL_DIR/$IPKG_FILE"
PoroCYon's avatar
PoroCYon committed
548
549
}
sspt_clean() {
PoroCYon's avatar
PoroCYon committed
550
    idris --clean "$REL_DIR/$IPKG_FILE"
PoroCYon's avatar
PoroCYon committed
551
552
553
554
}
sspt_clean_config() {
    true
}
PoroCYon's avatar
PoroCYon committed
555
EOF
PoroCYon's avatar
PoroCYon committed
556
557
558
    elif file_exists_glob ./*.sln; then
        local SLN_FILE=$(find ./*.sln -maxdepth 1 -type f | head -1)
        local PROBABLE_PROJECT_NAME=${SLN_FILE%.*}
PoroCYon's avatar
PoroCYon committed
559
560
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
PoroCYon's avatar
PoroCYon committed
561
    >&2 echo "NOTE: the 'install' command for xbuild projects is extremely hacky, you might want to tweak it."
PoroCYon's avatar
PoroCYon committed
562
563
}
sspt_build() {
PoroCYon's avatar
PoroCYon committed
564
    xbuild /p:Configuration=Release "$REL_DIR/$SLN_FILE"
PoroCYon's avatar
PoroCYon committed
565
566
}
sspt_install() {
PoroCYon's avatar
PoroCYon committed
567
568
    cp "$RELI_DIR/$PROBABLE_PROJECT_NAME/bin/Release/"*.exe \$SSPT_DEST_DIR/bin && \
        cp "$RELI_DIR/$PROBABLE_PROJECT_NAME/bin/Release/"*.dll \$SSPT_DEST_DIR/lib
PoroCYon's avatar
PoroCYon committed
569
570
}
sspt_clean() {
PoroCYon's avatar
PoroCYon committed
571
    xbuild /p:Configuration=Release "$REL_DIR/$SLN_FILE" /t:Clean
PoroCYon's avatar
PoroCYon committed
572
573
574
575
}
sspt_clean_config() {
    true
}
PoroCYon's avatar
PoroCYon committed
576
577
578
579
580
581
582
EOF
    elif ! [ -z "$CHANGED_DIR" ]; then
        # try top directory instead
        popd >/dev/null
        DONT_LOOK_INTO_BUILD=1 autogen_buildsys
        return $?
    else
pcy's avatar
pcy committed
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
        cat >> "$SSPT_FILE" <<EOF
sspt_config() {
    true
}
sspt_build() {
    true
}
sspt_install() {
    true
}
sspt_clean() {
    true
}
sspt_clean_config() {
    true
}
EOF
PoroCYon's avatar
PoroCYon committed
600
        (>&2 echo "Could not detect how to compile package '$1'.")
PoroCYon's avatar
PoroCYon committed
601
602
603
        return 1
    fi

PoroCYon's avatar
PoroCYon committed
604
    if ! [ -z "$CHANGED_DIR" ]; then
PoroCYon's avatar
PoroCYon committed
605
606
607
608
609
        popd >/dev/null
    fi
}

autogen_cwd() {
PoroCYon's avatar
PoroCYon committed
610
611
612
    if [ -f ".sspt" ]; then
        rm ".sspt"
    fi
PoroCYon's avatar
PoroCYon committed
613
614
    touch ".sspt"
    #echo "name=\"$(basename `pwd`)\"" >> ".sspt"
PoroCYon's avatar
PoroCYon committed
615
616
    autogen_vcs "$1"
    autogen_buildsys "$1"
PoroCYon's avatar
PoroCYon committed
617
618
619
620
    return $?
}

main() {
621
    local ESCAPED_PKG=$(escape_string "$1")
PoroCYon's avatar
PoroCYon committed
622

PoroCYon's avatar
fix _    
PoroCYon committed
623
624
    case "$1" in
        "-h"|"-?"|"--help")
PoroCYon's avatar
PoroCYon committed
625
626
            print_help
            ;;
PoroCYon's avatar
fix _    
PoroCYon committed
627
        "-e"|"--edit")
PoroCYon's avatar
PoroCYon committed
628
629
630
631
632
633
634
635
            if [ -z "$2" ]; then
                print_help
                exit
            fi

            main "$2"
            exec_subcommand edit "$2"
            ;;
PoroCYon's avatar
PoroCYon committed
636
        *)
637
            if ! exec_subcommand src-db exists "$1"; then
PoroCYon's avatar
PoroCYon committed
638
639
640
641
                (>&2 echo "Package '$1' doesn't exist.")
                exit 1
            fi

PoroCYon's avatar
PoroCYon committed
642
            local PACKAGE_DIR="$SSPT_DL_DIR/$ESCAPED_PKG"
PoroCYon's avatar
PoroCYon committed
643
644

            pushd "$PACKAGE_DIR" >/dev/null
PoroCYon's avatar
PoroCYon committed
645
            autogen_cwd "$1"
PoroCYon's avatar
PoroCYon committed
646
647
648
649
650
651
652
653
654
655
656
657
            local RETVAL=$?
            popd >/dev/null
            exit $RETVAL
            ;;
    esac
}

if [ $# -eq 0 ]; then
    print_help
    exit
fi

658
main "$@"
PoroCYon's avatar
PoroCYon committed
659